/* --- 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); } }

/* --- Mobile Menu Styles --- */
main {
    transition: filter 0.3s ease-in-out;
}
body.menu-is-open main {
    pointer-events: none;
    filter: blur(3px);
}
#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 Menu Overrides --- */
@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; }

/* --- Preloader Styles --- */
#preloader { transition: opacity 0.75s ease-in-out; }
.preloader-hidden { opacity: 0; pointer-events: none; }
@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; }

/* --- Loading Indicator and Table Styles --- */
.loading-indicator { display: flex; justify-content: center; align-items: center; padding: 20px; font-size: 1.125rem; color: #005B54; font-weight: 500; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    animation: fadeIn 0.5s ease-in-out;
    table-layout: fixed;
    word-wrap: break-word;
}

/* Lebar spesifik untuk kolom tabel Sertifikasi Halal (JPH) */
.data-table.data-table-jph th:nth-child(1),
.data-table.data-table-jph td:nth-child(1) { width: 7%; } /* No. */

/* Lebar spesifik untuk kolom tabel Produk Hukum (8 kolom) */
.data-table.data-table-hukum th:nth-child(1),
.data-table.data-table-hukum td:nth-child(1) { width: 10%; } /* Jenis Peraturan */
.data-table.data-table-hukum th:nth-child(2),
.data-table.data-table-hukum td:nth-child(2) { width: 10%; } /* Pemrakarsa */
.data-table.data-table-hukum th:nth-child(3),
.data-table.data-table-hukum td:nth-child(3) { width: 7%; }  /* Nomor */
.data-table.data-table-hukum th:nth-child(4),
.data-table.data-table-hukum td:nth-child(4) { width: 6%; }  /* Tahun -- DIUBAH DARI 5% */
.data-table.data-table-hukum th:nth-child(5),
.data-table.data-table-hukum td:nth-child(5) { width: 13%; } /* Tentang */
.data-table.data-table-hukum th:nth-child(6),
.data-table.data-table-hukum td:nth-child(6) { width: 8%; } /* Status */
.data-table.data-table-hukum th:nth-child(7),
.data-table.data-table-hukum td:nth-child(7) { width: 7%; }  /* Dokumen */
.data-table.data-table-hukum th:nth-child(8),
.data-table.data-table-hukum td:nth-child(8) { width: 18%; } /* Resume */

/* Gaya Tabel Minimalis Modern */
.data-table thead th {
    background-color: transparent;
    color: #374151;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #d1d5db;
}
.data-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}
.data-table tbody tr:nth-child(even) {
    background-color: transparent;
}
.data-table tbody tr:nth-child(odd) {
    background-color: transparent;
}
.data-table tbody tr:hover {
    background-color: #f9fafb;
}
.data-table td {
    padding: 1rem;
    color: #4b5563;
    vertical-align: top;
}
.data-table .font-medium { font-weight: 500; color: #111827; }
.data-table .link { color: #059669; text-decoration: underline; }
.data-table .link:hover { color: #047857; }
.data-table .status-badge { padding: 0.25rem 0.75rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.status-berlaku { background-color: #dcfce7; color: #166534; }
.status-diubah { background-color: #b9e8ff; color: #1f5b98; }
.status-tidak_berlaku { background-color: #fee2e2; color: #991b1b; }
.status-tersertifikasi { background-color: #dcfce7; color: #166534; }
.status-dalam_proses { background-color: #fef9c3; color: #854d0e; }
.status-belum_tersertifikasi { background-color: #fee2e2; color: #991b1b; }

/* --- Gaya untuk Tombol "Baca selengkapnya" --- */
.resume-text-container .full-text.hidden,
.resume-text-container .short-text.hidden {
    display: none;
}
.read-more-btn {
    background: none;
    border: none;
    color: #059669;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-top: 0.5rem;
    display: inline-block;
    font-size: 0.8rem;
}
.read-more-btn:hover {
    color: #047857;
    text-decoration: underline;
}

/* --- Penyesuaian Tabel Responsif --- */
@media (max-width: 767px) {
    #data-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        min-width: 800px;
    }
    #data-table-container.bg-white {
        padding: 0.5rem;
    }

    /* START: Penyesuaian Lebar & Font Tabel Hukum di Mobile */
    .data-table.data-table-hukum {
      font-size: 0.75rem; /* Ukuran font diperkecil */
      min-width: 1090px;   /* Lebar total tabel disesuaikan agar lebih ringkas */
    }

    .data-table.data-table-hukum th,
    .data-table.data-table-hukum td {
      padding: 0.75rem; /* Padding diperkecil agar lebih padat */
    }

    /* Baris ini ditambahkan untuk memastikan header tidak terpotong */
    .data-table.data-table-hukum th {
      white-space: nowrap;
    }

    /* Atur ulang lebar kolom dengan nilai baru yang lebih ringkas */
    .data-table.data-table-hukum th:nth-child(1), .data-table.data-table-hukum td:nth-child(1) { width: 140px; }
    .data-table.data-table-hukum th:nth-child(2), .data-table.data-table-hukum td:nth-child(2) { width: 140px; }
    .data-table.data-table-hukum th:nth-child(3), .data-table.data-table-hukum td:nth-child(3) { width: 80px; }
    .data-table.data-table-hukum th:nth-child(4), .data-table.data-table-hukum td:nth-child(4) { width: 70px; } /* -- DIUBAH DARI 60px */
    .data-table.data-table-hukum th:nth-child(5), .data-table.data-table-hukum td:nth-child(5) {
      width: 220px;
      white-space: normal;
    }
    .data-table.data-table-hukum th:nth-child(6), .data-table.data-table-hukum td:nth-child(6) { width: 110px; }
    .data-table.data-table-hukum th:nth-child(7), .data-table.data-table-hukum td:nth-child(7) { width: 70px; }
    .data-table.data-table-hukum th:nth-child(8), .data-table.data-table-hukum td:nth-child(8) {
      width: 260px;
      white-space: normal;
    }
    /* END: Penyesuaian */
}

/* --- Gaya Tombol Paginasi --- */
.pagination-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

/* --- Gaya Modal Metadata --- */
#metadata-modal {
    transition: opacity 0.3s ease-in-out;
}
#metadata-modal-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}
.metadata-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
}
.metadata-item {
    display: table-row;
}
.metadata-key, .metadata-value {
    display: table-cell;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
    vertical-align: top;
}
.metadata-item:last-child .metadata-key,
.metadata-item:last-child .metadata-value {
    border-bottom: none;
}
.metadata-key {
    font-weight: 600;
    color: #6b7280;
    width: 120px;
}
.metadata-value {
    color: #374151;
    word-break: break-word;
}
@media (max-width: 640px) {
    #metadata-modal-content {
        max-height: 75vh;
        overflow-y: auto;
    }
}