/*
 * Tema: Hijau-Kuning Emas (Green-Gold)
 * Terkait Mata Kuliah: Aplikasi Komputer Perkantoran (Desain UI)
 */

:root {
    --color-primary-green: #006400;
    /* Hijau Gelap */
    --color-secondary-gold: #ffd700;
    /* Emas */
    --color-text-light: #ffffff;
    --color-text-dark: #333333;
    --color-background-light: #f4f4f4;

    /* URL Gambar */
    --background-image-url: url('../images/WhatsApp\ Image\ 2025-11-24\ at\ 6.56.28\ PM.jpeg');
}

/* --- PERBAIKAN STICKY SIDEBAR: Tambahkan height: 100% pada HTML/BODY --- */
html,
body {
    height: 100%;
    /* Memastikan elemen teratas bisa menentukan tinggi penuh */
}

/* ---------------------------------------------------------------------- */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;

    /* Body tetap putih/terang */
    background-color: var(--color-background-light);
}

/* -------------------- KONTEN UTAMA -------------------- */
#container {
    display: flex;
    min-height: 100vh;
    background-image: none;
    background-color: transparent;
}

/* -------------------- SIDEBAR (Menu Fitur) -------------------- */
#sidebar {
    width: 250px;
    background-color: var(--color-primary-green);
    color: var(--color-text-light);
    padding-top: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    flex-direction: column;

    /* === MODIFIKASI UNTUK SIDEBAR STICKY (FIXED) === */
    position: sticky;
    /* Membuat sidebar menempel saat scroll */
    top: 0;
    /* Menempel pada bagian atas (0px dari viewport) */
    /* DIHAPUS: height: 100vh; */
    /* Sidebar akan meregang ke tinggi penuh container (#container) karena flexbox. */
    overflow-y: auto;
    /* Memungkinkan sidebar untuk di-scroll jika kontennya melebihi tinggi layar */
    /* ======================================= */
}

.timbangan-icon {
    text-align: center;
    padding: 20px 0;
}

.timbangan-icon img {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 5px var(--color-secondary-gold));
}

#sidebar h3 {
    text-align: center;
    color: var(--color-secondary-gold);
    border-bottom: 2px solid var(--color-secondary-gold);
    padding-bottom: 10px;
    margin: 0 20px 20px 20px;
}

#sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-publik {
    flex-grow: 1;
    margin-bottom: 20px;
}

#sidebar ul li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--color-text-light);
    transition: background-color 0.3s;
}

#sidebar ul li a:hover {
    background-color: rgba(255, 215, 0, 0.2);
    color: var(--color-secondary-gold);
}

#login-admin {
    margin-top: auto;
    padding-bottom: 20px;
    list-style: none;
    padding-left: 0;
}

#login-admin li a {
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: bold;
}

/* -------------------- KONTEN UTAMA -------------------- */
#main-content {
    flex-grow: 1;
    padding: 0;
    /* Remove main-content padding here, it will be added to the containers */
    position: relative;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 5;
    /* Use flexbox to center content horizontally */
    display: flex;
    flex-direction: column;
    /* Stack items vertically */
    align-items: center;
    /* Center horizontally */
    padding-top: 40px;
    /* Add padding to the top of main-content */
}

/* Pseudo-element for Background Image */
#main-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--background-image-url);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    filter: none;
    z-index: -1;
}

/* --- List Items in Main Content --- */
#main-content ul {
    list-style: none;
    padding-left: 0;
    margin-top: 10px;
}

#main-content ul li {
    line-height: 1.8;
    margin-bottom: 5px;
    position: relative;
    padding-left: 25px;
}

#main-content ul li::before {
    content: "✔";
    color: var(--color-primary-green);
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 0;
}

/* ----------------------------------------------------------------------------- */

/* === MAIN HEADER (Green Box for H1 and Description) === */
header {
    background-color: var(--color-secondary-gold);
    color: var(--color-text-light);

    /* VERY IMPORTANT: Significantly reduce padding to wrap text tightly */
    padding: 15px 30px;

    /* Margin to center the box and give space */
    margin: 0 auto 15px auto;
    /* Center horizontally with auto margins */
    max-width: fit-content;
    /* Ensure the box only wraps its content */

    border-radius: 15px;
    /* Rounded corners */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    z-index: 1;
}

header h1 {
    color: black;
    margin: 0;
    /* No margin for H1 inside the compact header */
    font-size: 2em;
    /* Keep font size reasonable */
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    /* Prevent text from wrapping if not needed */
}

header p {
    color: black;
    margin: 5px 0 0 0;
    /* Small margin from H1 */
    font-size: 1em;
    font-weight: 300;
    white-space: nowrap;
    /* Prevent text from wrapping */
}

/* --- Search Form Styling (for search.php) --- */
form[action*="search"] {
    /* Make this also a compact green box */
    background-color: var(--color-primary-green);

    /* Adjust padding to be similar to the header */
    padding: 10px 15px;

    margin: 0 auto 30px auto;
    /* Center horizontally and space below */
    max-width: fit-content;
    /* Make the form box wrap its content */

    border-radius: 15px;
    /* Rounded corners */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    /* Space between input and button */
    position: relative;
    z-index: 1;
}

form[action*="search"] input[type="text"] {
    padding: 8px 12px;
    /* Smaller padding for input */
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    min-width: 250px;
    /* Ensure input is not too small */
}

form[action*="search"] button[type="submit"] {
    background-color: var(--color-secondary-gold);
    color: var(--color-text-dark);
    padding: 8px 18px;
    /* Smaller padding for button */
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 8px;
    transition: 0.2s;
    font-size: 0.95em;
}

form[action*="search"] button[type="submit"]:hover {
    background-color: #e6c300;
}


/* -------------------- OTHER ELEMENTS -------------------- */
h2 {
    color: black;
    text-align: left;
    /* Ensure h2 outside header is left aligned */
    width: 100%;
    /* Take full width of its parent */
    padding: 0 25px;
    /* Add padding to match general content area */
    box-sizing: border-box;
}

.sidang-table-wrapper {
    width: 100%;
    padding: 0 25px;
    box-sizing: border-box;
}

/* -------------------- ELEMEN LAIN (Tabel) -------------------- */

.sidang-table {
    width: 100%;
    /* Pastikan tabel mengisi lebar konten */
    border-collapse: collapse;
    margin-top: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    background-color: var(--color-text-light);
}

.sidang-table th,
.sidang-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    /* Tambahkan word-break agar konten panjang di kolom sempit tidak merusak layout */
    word-break: break-word;
}

.sidang-table th {
    background-color: var(--color-primary-green);
    color: var(--color-text-light);
    font-weight: bold;
}

.sidang-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.sidang-table tr:hover {
    background-color: #e9e9e9;
}

/* --- Hapus Styling Mobile untuk Desktop --- */

/* Pastikan style default untuk desktop/tablet (> 600px) tidak bertumpuk */
.sidang-table tr {
    display: table-row;
    /* Normal, tidak bertumpuk */
    margin-bottom: 0;
    border-bottom: 1px solid #ddd;
}

.sidang-table td {
    display: table-cell;
    /* Normal, tidak bertumpuk */
    text-align: left;
    padding-left: 12px;
    /* Kembalikan padding normal */
}

.sidang-table td::before {
    content: none;
    /* Sembunyikan label mobile */
}


.search-result-header {
    background-color: var(--color-primary-green);
    color: var(--color-text-light);
    padding: 10px 15px;
    font-size: 1.2em;
    font-weight: bold;
    margin-top: 20px;
    margin-bottom: 0;
    width: 100%;
    box-sizing: border-box;
}

/* === WIDGET HOME (PENAMBAHAN) === */
.home-widget {
    background-color: var(--color-background-light);
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 30px;
    /* Tambahkan margin bawah agar ada jarak ke link di bawahnya */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 450px;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Tambahan efek transisi kecil */
    transition: transform 0.3s ease-in-out;
}

.home-widget:hover {
    transform: scale(1.02);
    /* Sedikit membesar saat di-hover */
}

.home-widget p {
    margin: 0;
    line-height: 1.2;
}

/* ======================================= */

/* -------------------- RESPONSIVENESS (Media Queries) -------------------- */

@media (max-width: 768px) {
    #container {
        display: block;
    }

    #sidebar {
        width: 100%;
        height: auto;
        position: static;
        /* Kembali ke static/normal di mode mobile */
        padding-top: 0;
        padding-bottom: 0;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .timbangan-icon {
        padding: 10px;
    }

    #sidebar h3 {
        display: none;
    }

    .menu-publik {
        flex-grow: 0;
        margin-bottom: 0;
    }

    #sidebar ul {
        display: flex;
        flex-wrap: wrap;
        padding: 0 10px;
    }

    #sidebar ul li a {
        padding: 8px 15px;
        font-size: 0.9em;
        white-space: nowrap;
        border-radius: 3px;
    }

    #login-admin {
        margin-top: 0;
        padding-bottom: 10px;
        width: 100%;
        text-align: center;
    }

    #main-content {
        padding: 15px;
        /* Reduce main-content padding for smaller screens */
    }

    header {
        padding: 10px 20px;
        /* Further reduce padding for header on mobile */
        margin: 0 auto 10px auto;
        /* Adjust margin */
        width: auto;
        /* Allow header to adjust width */
    }

    header h1 {
        font-size: 1.6em;
        /* Smaller font size for H1 */
    }

    header p {
        font-size: 0.9em;
        /* Smaller font size for description */
    }

    form[action*="search"] {
        flex-direction: column;
        /* Stack input and button vertically */
        padding: 10px;
        margin: 0 auto 20px auto;
        width: auto;
        /* Allow form to adjust width */
    }

    form[action*="search"] input[type="text"],
    form[action*="search"] button[type="submit"] {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
        /* Space between stacked items */
        min-width: unset;
        /* Remove min-width for full responsiveness */
    }

    form[action*="search"] button[type="submit"] {
        margin-bottom: 0;
        /* No margin for the last item */
    }
}

/* 2. Jadikan Tabel menjadi 'Stack' (bertumpuk) HANYA pada layar yang sangat kecil */
@media (max-width: 600px) {
    .sidang-table {
        border: 0;
    }

    .sidang-table th {
        /* Sembunyikan header tabel asli */
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }

    .sidang-table tr {
        border-bottom: 3px solid #ddd;
        display: block;
        /* Bertumpuk */
        margin-bottom: 0.625em;
    }

    .sidang-table td {
        /* Jadikan setiap sel (kolom) sebagai baris penuh */
        border-bottom: 1px solid #eee;
        display: block;
        font-size: 0.8em;
        text-align: right;
        padding-left: 45%;
        /* Ruang untuk label */
        position: relative;
    }

    .sidang-table td::before {
        /* Gunakan atribut data-label untuk menampilkan header sebagai label */
        content: attr(data-label);
        float: left;
        font-weight: bold;
        text-transform: uppercase;
        color: var(--color-primary-green);
    }

    /* Style tambahan untuk tampilan mobile yang lebih rapi */
    .sidang-table td:last-child {
        border-bottom: 0;
    }

    .sidang-table td strong,
    .sidang-table td small {
        display: block;
        text-align: right;
    }
}