/* ==========================================================================
   GLOBAL CSS - SMKN 1 CIKAMPEK ADMIN
   Variabel Global, Reset, Base Layout (Sidebar & Main), dan Komponen Umum
   ========================================================================== */

:root {
    /* Color Palette */
    --primary-color: #0284c7;       /* Biru utama (Sky Blue) */
    --primary-hover: #0369a1;
    --sidebar-bg: #1e293b;          /* Gelap sidebar (Slate Dark) */
    --sidebar-hover: #334155;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #0284c7;
    --bg-color: #f4f6f9;            /* Background utama */
    --text-main: #334155;
    --text-muted: #64748b;
    --white: #ffffff;
    
    /* Semantic Colors (Action Buttons) */
    --success-color: #10b981;       /* Hijau (Simpan) */
    --success-hover: #059669;
    --danger-color: #ef4444;        /* Merah (Hapus/Logout) */
    --danger-hover: #dc2626;
    --warning-color: #f59e0b;       /* Kuning/Amber (Edit) */
    --warning-hover: #d97706;
    --neutral-color: #94a3b8;       /* Abu-abu (Batal) */
    --neutral-hover: #64748b;

    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --input-border: #cbd5e1;
    --box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    
    /* Dimensions */
    --sidebar-width: 260px;
    --border-radius: 8px;
    --border-radius-sm: 4px;
}

/* 1. GLOBAL RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* 2. SIDEBAR NAVIGATION (Berlaku untuk semua halaman admin) */
nav {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--white);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    padding: 20px 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 100;
}

nav::before {
    content: "SMKN 1 CIKAMPEK";
    display: block;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--sidebar-hover);
    color: #38bdf8;
}

nav ul {
    list-style: none;
}

nav ul li {
    margin: 4px 12px;
}

nav ul li a {
    display: block;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

nav ul li a:hover {
    background-color: var(--sidebar-hover);
    color: var(--white);
    padding-left: 20px;
}

/* Penanda Menu Aktif (Hanya menggunakan sistem Class .active) */
nav ul li a.active {
    background-color: var(--sidebar-active) !important;
    color: var(--white) !important;
    font-weight: bold;
}

/* Tombol Logout Sidebar */
nav ul li button {
    width: 100%;
    background-color: var(--danger-color);
    color: var(--white);
    border: none;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
    text-align: left;
    margin-top: 20px;
    transition: background 0.2s, transform 0.1s;
}

nav ul li button:hover {
    background-color: var(--danger-hover);
}

nav ul li button:active {
    transform: scale(0.98);
}

/* 3. MAIN CONTENT WRAPPER */
main#content {
    margin-left: var(--sidebar-width);
    padding: 40px;
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

main#content h1 {
    font-size: 1.8rem;
    color: #0f172a;
    margin-bottom: 8px;
    font-weight: 700;
}

main#content > p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

/* 4. GLOBAL MODAL (Untuk Fitur Zoom Gambar) */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    padding-top: 60px; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.8); 
    backdrop-filter: blur(4px); /* Efek blur estetik */
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 80%;
    max-height: 80vh;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from {transform:scale(0.8); opacity:0}
    to {transform:scale(1); opacity:1}
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
}

/* Thumbnail Gambar Default di Tabel */
.img-thumbnail {
    width: 80px; 
    height: 60px; 
    object-fit: cover; 
    border: 1px solid var(--border-color); 
    border-radius: var(--border-radius-sm); 
    padding: 2px; 
    display: block; 
    margin: 0 auto;
    cursor: pointer;
    transition: 0.3s;
}

.img-thumbnail:hover {
    opacity: 0.7;
    border-color: var(--primary-color);
}

/* ==========================================================================
   5. RESPONSIVE SIDEBAR & HAMBURGER (Untuk Layar Mobile < 768px)
   ========================================================================== */

/* Tombol Hamburger (Floating) */
.menu-toggle {
    display: none; /* Sembunyikan di desktop */
    position: fixed;
    top: 15px;
    left: 15px;
    width: 42px;
    height: 42px;
    background-color: #1e293b; /* Senada dengan warna sidebar */
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 22px;
    cursor: pointer;
    z-index: 150; /* Berada di atas elemen apa pun */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

/* Efek Overlay Gelap di Belakang Menu Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 99;
    animation: fadeIn 0.2s ease;
}

@media (max-width: 768px) {
    /* Tampilkan tombol hamburger */
    .menu-toggle {
        display: flex;
    }

    /* Sembunyikan sidebar ke luar layar kiri secara default */
    nav {
        left: -260px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
    }

    /* Class pemicu untuk memunculkan kembali sidebar */
    nav.active {
        left: 0;
    }

    /* Tampilkan overlay aktif jika kelas pemicu disematkan */
    .sidebar-overlay.active {
        display: block;
    }

    /* Lebarkan konten utama agar memenuhi layar */
    main#content {
        margin-left: 0;
        width: 100%;
        padding: 80px 20px 30px 20px; /* Ditambah padding top agar tidak tertutup tombol hamburger */
    }

    /* Lebarkan konten utama agar memenuhi layar dan dorong ke bawah */
    main#content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 80px !important; /* Tambahkan !important di sini untuk memaksa judul turun */
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    /* Opsional: Pastikan judul tidak memiliki margin atas negatif */
    main#content h1 {
        margin-top: 0 !important;
    }

    /* Tambahkan blok ini untuk menggeser tombol X ke kanan */
    .menu-toggle.geser-kanan {
        left: 260px !important; /* Geser ke sisi kanan sidebar */
        background-color: transparent !important; /* Hilangkan kotak background agar menyatu */
        box-shadow: none !important;
        font-size: 26px; /* Sedikit dibesarkan agar mudah diklik */
    }
}