/* --- Base and Animation Styles --- */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    overflow-x: hidden;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* --- Perbaikan untuk dropdown yang menutupi menu mobile --- */
main {
    transition: filter 0.3s ease-in-out;
}
body.menu-is-open main {
    pointer-events: none;
    filter: blur(3px);
}

/* --- Style untuk Preloader --- */
#preloader {
    transition: opacity 0.75s ease-in-out;
}
.preloader-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Animasi bar loading baru */
@keyframes loading-bars {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}
.loading-bar {
    width: 8px;
    height: 40px;
    margin: 0 3px;
    border-radius: 4px;
    animation: loading-bars 1.2s infinite ease-in-out;
}
.loading-bar:nth-child(1) { background-color: #3498db; animation-delay: 0s; }
.loading-bar:nth-child(2) { background-color: #e67e22; animation-delay: 0.1s; }
.loading-bar:nth-child(3) { background-color: #f1c40f; animation-delay: 0.2s; }
.loading-bar:nth-child(4) { background-color: #2ecc71; animation-delay: 0.3s; }
.loading-bar:nth-child(5) { background-color: #9b59b6; animation-delay: 0.4s; }


/* --- MOBILE FIRST MENU STYLES (Default) --- */
#main-nav-analysis {
    position: fixed;
    top: 0;
    right: 0;
    width: 90%;
    max-width: 22rem;
    height: 100vh;
    background-color: white;
    box-shadow: -10px 0 15px -3px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 40;
}
#main-nav-analysis.is-open {
    transform: translateX(0);
}

#main-nav-analysis .main-menu-list {
    padding: 6rem 1rem 2rem 1.5rem;
}
#main-nav-analysis .main-menu-list > li {
    margin-bottom: 0.5rem;
}
#main-nav-analysis .main-menu-list a {
    font-size: 1.125rem;
}

.dropdown-menu, .dropdown-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, padding 0.3s ease-in-out;
    padding: 0;
    background-color: transparent;
}
.dropdown-menu.is-open, .dropdown-submenu.is-open {
    max-height: 1000px;
}
.dropdown-menu.is-open {
    padding: 0.5rem 0 0 0.75rem;
}
.dropdown-submenu.is-open {
    padding: 0.5rem 0 0.5rem 1rem;
    margin-top: 0.5rem;
    background-color: #f9fafb;
    border-radius: 0.25rem;
}

.arrow-indicator {
    transition: transform 0.3s ease-in-out;
    display: inline-block;
}
.dropdown.is-open > a .arrow-indicator,
.dropdown-item.is-open > a .arrow-indicator {
    transform: rotate(90deg);
}

#mobile-menu-button-analysis .hamburger-line { transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; }
#mobile-menu-button-analysis.is-open .hamburger-line-1 { transform: translateY(8px) rotate(45deg); }
#mobile-menu-button-analysis.is-open .hamburger-line-2 { opacity: 0; }
#mobile-menu-button-analysis.is-open .hamburger-line-3 { transform: translateY(-8px) rotate(-45deg); }

/* --- DESKTOP OVERRIDES (Layar Medium ke Atas) --- */
@media (min-width: 768px) {
    #main-nav-analysis {
        position: relative;
        height: auto;
        width: auto;
        max-width: none;
        transform: none;
        overflow: visible;
        box-shadow: none;
        background-color: transparent;
    }
    #main-nav-analysis .main-menu-list {
        display: flex;
        flex-direction: row;
        align-items: center;
        padding: 0;
        gap: 1.5rem;
    }
    #main-nav-analysis .main-menu-list > li {
        margin-bottom: 0;
    }
     #main-nav-analysis .main-menu-list a {
        font-size: 1rem;
    }

    .dropdown-menu, .dropdown-submenu {
        position: absolute;
        display: none;
        max-height: none;
        overflow: visible;
        background-color: white;
        box-shadow: 0 8px 16px rgba(0,0,0,0.1);
        z-index: 100;
        border-radius: 0.5rem;
        min-width: 220px;
        padding: 0.5rem 0;
        transition: none; 
    }
    .dropdown-menu {
        left: 0;
        top: 100%;
    }
    .dropdown-submenu {
        right: 100%;
        left: auto;
        top: 0;
    }
    
    .dropdown:hover > .dropdown-menu,
    .dropdown-item:hover > .dropdown-submenu {
        display: block;
    }
    .arrow-indicator {
        display: none;
    }
}

.dropdown-item {
    position: relative;
}
.dropdown-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    color: #4b5563;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}
.dropdown-link:hover {
    background-color: #f3f4f6;
    color: #007369;
}
.dropdown-link.disabled {
    color: #9ca3af;
    cursor: not-allowed;
}
.dropdown-link.disabled:hover {
    background-color: transparent;
}

/* --- Other Page Specific Styles --- */
.loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    font-size: 1.125rem;
    color: #005B54;
    font-weight: 500;
    gap: 0.5rem;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
#details-modal, #alert-modal { transition: opacity 0.3s ease; }

/* --- Style untuk Tabel Data --- */
#table-container {
    padding: 0.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    animation: fadeIn 0.5s ease-in-out;
}

.data-table thead th {
    background-color: #f9fafb; /* gray-50 */
    color: #374151; /* gray-700 */
    font-weight: 600;
    padding: 0.75rem 1rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #e5e7eb; /* gray-200 */
}

.data-table tbody tr {
    border-bottom: 1px solid #e5e7eb; /* gray-200 */
    transition: background-color 0.2s ease;
}

.data-table tbody tr:nth-child(even) {
    background-color: #ffffff;
}

.data-table tbody tr:nth-child(odd) {
    background-color: #f9fafb; /* gray-50 */
}

.data-table tbody tr:hover {
    background-color: #f0fdfa; /* emerald-50 */
}

.data-table td {
    padding: 0.75rem 1rem;
    color: #4b5563; /* gray-600 */
}

.data-table td:not(:first-child), .data-table th:not(:first-child), .data-table tfoot td:not(:first-child) {
    text-align: right;
}

.data-table .font-medium {
    font-weight: 500;
    color: #111827; /* gray-900 */
}

.data-table tfoot td {
    font-weight: 700;
    color: #111827; /* gray-900 */
    background-color: #f3f4f6; /* gray-100 */
    padding: 0.75rem 1rem;
    border-top: 2px solid #e5e7eb;
}

/* PENAMBAHAN: Style untuk Metadata Modal */
#metadata-modal {
    transition: opacity 0.3s ease-in-out;
}
#metadata-modal > div { /* Target the direct child for animation */
    transition: transform 0.3s ease-in-out;
}

#metadata-modal-content h3 {
    font-size: 1.125rem; /* PERUBAHAN: Ukuran judul diperkecil */
    font-weight: 700;
    color: #111827; /* gray-900 */
    border-bottom: 1px solid #e5e7eb; /* gray-200 */
    padding-bottom: 0.5rem; /* PERUBAHAN: Spasi bawah dikurangi */
    margin-bottom: 0.75rem; /* PERUBAHAN: Spasi bawah dikurangi */
}

.metadata-item {
    display: grid;
    grid-template-columns: 90px 1fr; /* PERUBAHAN: Lebar kolom key dikurangi */
    gap: 8px;
    padding: 0.5rem 0; /* PERUBAHAN: Spasi atas-bawah dikurangi */
    border-bottom: 1px solid #f3f4f6; /* gray-100 */
}

.metadata-item:last-child {
    border-bottom: none;
}

.metadata-key {
    font-weight: 600;
    color: #6b7280; /* gray-500 */
    font-size: 0.8rem; /* PERUBAHAN: Ukuran font diperkecil */
}

.metadata-value {
    color: #374151; /* gray-700 */
    font-size: 0.8rem; /* PERUBAHAN: Ukuran font diperkecil */
    word-break: break-word;
}

/* PENAMBAHAN: Perbaikan Tampilan Mobile untuk Modal Metadata */
@media (max-width: 640px) {
    #metadata-modal-content {
        /* Menetapkan tinggi maksimum agar tidak melebihi layar */
        max-height: 75vh; 
        /* Menambahkan scrollbar jika kontennya lebih panjang dari tinggi maksimum */
        overflow-y: auto;
    }
}