/* =========================================
   1. ROOT & VARIABEL DASAR
========================================= */
:root {
    --primary: #2c3e50; 
    --accent: #3498db; 
    --success: #27ae60;
    --warning: #f39c12; 
    --danger: #e74c3c; 
    --bg: #f4f7f6;
    --sidebar-width: 250px;
}

body { 
    font-family: 'Inter', 'Poppins', sans-serif; 
    background: linear-gradient(rgba(244, 247, 246, 0.6), rgba(244, 247, 246, 0.8)), url('latar.jpg') center/cover no-repeat;
    margin: 0; 
    padding: 0; 
    color: #333; 
    font-size: 13px; 
}

/* =========================================
   2. TYPOGRAPHY & LAYOUT UTAMA
========================================= */
h3 { margin-top: 0; color: var(--primary); border-left: 5px solid var(--accent); padding-left: 12px; margin-bottom: 20px; font-size: 17px; }

.container { 
    max-width: 1300px; 
    margin: 0 auto; 
    margin-left: 260px;
    padding: 130px 30px 50px 30px; 
    transition: all 0.3s;
}

.card { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); margin-bottom: 25px; position: relative; }

.grid-1 { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.grid-3 input { width: 100%; box-sizing: border-box;}
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.label-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 30px; /* TINGGI TETAP agar tidak berantakan */
    margin-bottom: 5px;
}

/* =========================================
   3. FORM & INPUT STYLES
========================================= */
label { font-size: 10px; font-weight: 800; color: #7f8c8d; text-transform: uppercase; display: block; margin-bottom: 5px; }
.label-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
input, textarea, select { padding: 10px; border: 1px solid #ddd; border-radius: 6px; width: 100%; box-sizing: border-box; font-size: 13px; font-family: inherit; }

.form-section { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.section-title { margin-top: 0; margin-bottom: 15px; color: #1a202c; font-size: 14px; font-weight: 800; border-bottom: 2px dashed #edf2f7; padding-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.dynamic-group { background: #fcfcfc; padding: 15px; border: 1px solid #eef2f7; border-radius: 8px; margin-bottom: 15px; }

.row-item { display: grid; gap: 10px; margin-bottom: 8px; align-items: center; }
.row-dest { grid-template-columns: 2fr 1.5fr 40px; }
.row-team { grid-template-columns: 1.5fr 1fr 1fr 40px; }

/* =========================================
   4. BUTTONS
========================================= */
.btn-main { background: var(--success); color: white; border: none; padding: 10px 20px; border-radius: 6px; font-weight: bold; cursor: pointer; }
.btn-reset { background: #95a5a6; color: white; border: none; padding: 10px 20px; border-radius: 6px; font-weight: bold; cursor: pointer; }
.btn-del { background: var(--danger); border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; color: white; font-size: 11px; }
.btn-edit { background: var(--warning); border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; color: white; font-size: 11px; margin-bottom: 2px; }
.btn-nom { background: #8e44ad; border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; color: white; font-size: 11px; margin-bottom: 2px; }

.nav-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-nav { background: #eef7ff; border: 1px solid #cce5ff; color: #007bff; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 12px; transition: 0.3s; font-weight: 600; }
.btn-nav:hover { background: #d6ebff; border-color: #b3d7ff; }
.btn-nav.active { background: var(--accent); color: white; border-color: var(--accent); font-weight: bold; box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3); }

/* =========================================
   5. TABLES, SEARCH & PAGINATION
========================================= */
table { width: 100%; border-collapse: collapse; margin-top: 15px; background: white; border-radius: 8px; }
th { background: #f8f9fa; text-align: left; padding: 12px; border-bottom: 2px solid #edf2f7; color: #4a5568; font-size: 11px; text-transform: uppercase; }
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; color: #2d3748; vertical-align: top; }

.search-container { margin-bottom: 15px; display: flex; gap: 10px; }
.search-input { flex: 1; padding: 10px 15px; border: 2px solid #edf2f7; border-radius: 8px; outline: none; transition: 0.3s; background: #fff; }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1); }

.pagination-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 15px; border-top: 1px solid #eee; }
.pg-info { color: #666; font-size: 12px; }
.pg-btns { display: flex; gap: 5px; }
.btn-pg { padding: 5px 10px; border: 1px solid #ddd; background: white; border-radius: 4px; cursor: pointer; font-size: 11px; }
.btn-pg:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-pg.active { background: var(--accent); color: white; border-color: var(--accent); }

/* =========================================
   6. LOGIN & OVERLAY COMPONENTS (MODAL BEAUTIFIED)
======================================== */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4); /* Gelap transparan */
    backdrop-filter: blur(8px); /* Efek kaca buram pada dashboard belakang */
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Persiapan Animasi */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Saat Javascript mengubahnya menjadi display: flex, aktifkan animasi */
#login-overlay[style*="display: flex"] {
    opacity: 1;
    visibility: visible;
}

.login-card {
    background: #ffffff;
    padding: 35px 30px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.2) inset;
    width: 100%;
    max-width: 360px;
    text-align: center;
    position: relative;
    /* Animasi Pop-up Membal */
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#login-overlay[style*="display: flex"] .login-card {
    transform: scale(1) translateY(0);
}

.login-logo {
    height: 60px;
    margin-bottom: 15px;
}

/* Tombol Close (X) Modal */
.btn-close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}
.btn-close-modal:hover {
    background: #fee2e2;
    color: #ef4444;
    transform: rotate(90deg); /* Efek putar saat dihover */
}

/* Gaya Pilihan Role */
.role-selection { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.btn-role { display: flex; align-items: center; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 16px; cursor: pointer; transition: all 0.2s ease; text-align: left; }
.btn-role:hover { border-color: #3b82f6; background: #f8fafc; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1); }
.btn-role .icon-box { font-size: 20px; width: 40px; height: 40px; display: flex; justify-content: center; align-items: center; border-radius: 10px; margin-right: 15px; flex-shrink: 0; }
.btn-role .text-box { display: flex; flex-direction: column; }
.btn-role b { font-size: 13px; color: #1e293b; font-weight: 700; margin-bottom: 2px; }
.btn-role small { font-size: 11px; color: #64748b; font-weight: 500; }

/* Gaya Form Input */
#login-form-container { display: none; animation: fadeIn 0.3s ease-out; }
#login-form-container label { font-size: 11px; font-weight: 700; color: #475569; letter-spacing: 0.5px; display: block; margin-bottom: 6px; text-transform: uppercase; }
#login-form-container input[type="text"], #login-form-container input[type="password"] { width: 100%; padding: 12px 16px; background: #f8fafc; border: 1.5px solid #cbd5e1; border-radius: 12px; font-size: 13px; color: #1e293b; box-sizing: border-box; transition: all 0.3s ease; }
#login-form-container input:focus { outline: none; border-color: #3b82f6; background: #ffffff; box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); }

/* Tombol Submit */
.btn-login-submit { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; border: none; width: 100%; padding: 14px; border-radius: 12px; font-size: 14px; font-weight: 700; letter-spacing: 1px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25); margin-top: 10px; }
.btn-login-submit:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4); }

.btn-back:hover { color: #0f172a; text-decoration: underline; }

/* Password Wrapper */
.password-wrapper { position: relative; display: block; width: 100%; }
.password-wrapper input[type="password"], .password-wrapper input[type="text"] { width: 100%; padding-right: 40px; box-sizing: border-box; }
.toggle-password { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; padding: 0; outline: none; transition: 0.2s; }
.toggle-password:hover { transform: translateY(-50%) scale(1.1); }

/* =========================================
   7. SIDEBAR & NAVIGATION
========================================= */
.sidebar { background-color: #1e293b; color: #f8fafc; width: 260px; height: 100vh; padding: 24px 16px; display: flex; flex-direction: column; box-sizing: border-box; position: fixed; top: 0; left: 0; bottom: 0; z-index: 1001; box-shadow: 2px 0 10px rgba(0,0,0,0.1); }
.sidebar-header { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-bottom: 24px; border-bottom: 1px solid rgba(193, 183, 183, 0.71); margin-bottom: 24px; }
.sidebar-logo { height: 50px; width: auto; object-fit: contain; transition: transform 0.3s ease; }
.sidebar-logo:hover { transform: scale(1.05); }
.menu-label { color: #94a3b8; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 12px; padding-left: 12px; display: block; }
.sidebar-menu { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; padding: 0 15px;}

.sidebar .btn-nav { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; background: transparent; border: none; color: #cbd5e1; font-size: 14px; font-weight: 500; text-align: left; border-radius: 10px; cursor: pointer; transition: all 0.2s ease; margin-bottom: 8px; }
.sidebar .btn-nav:hover { background-color: rgba(255, 255, 255, 0.08); color: #f8fafc; transform: translateX(4px); }
.sidebar .btn-nav.active { background-color: #3b82f6; color: #ffffff; font-weight: 600; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); border-color: transparent;}

.adm-only { margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-direction: column; gap: 4px; }
.nav-icon { font-size: 16px; min-width: 24px; text-align: center; }
header { left: var(--sidebar-width) !important; width: calc(100% - var(--sidebar-width)) !important; }

/* =========================================
   8. WIDGETS & OTHERS (Running Text, Clock)
========================================= */
.digital-clock { display: inline-block; background: #453838; color: #2fca4e; padding: 4px 12px; border-radius: 50px; font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 16px; font-weight: 800; border: 2px solid var(--accent); box-shadow: 0 4px 10px rgba(52, 152, 219, 0.2); font-variant-numeric: tabular-nums; letter-spacing: 1px; margin-top: 5px; transition: all 0.3s ease; }
.digital-clock:hover { transform: scale(1.05); background: var(--accent); color: #563434; box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4); }
#public-dashboard .digital-clock { font-size: 20px; padding: 6px 18px; border-width: 3px; }

.running-text-container { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--primary); color: white; height: 40px; display: flex; align-items: center; z-index: 10000; overflow: hidden; border-top: 3px solid var(--accent); box-shadow: 0 -2px 10px rgba(0,0,0,0.2); }
.running-text-content { white-space: nowrap; padding-left: 100%; display: inline-block; animation: marquee 25s linear infinite; font-size: 14px; font-weight: 500; letter-spacing: 0.5px; }
#public-dashboard { padding-bottom: 50px !important; }

details.dropdown-aksi { position: relative; display: inline-block; font-family: 'Poppins', sans-serif; margin-top: 4px; }
details.dropdown-aksi summary { list-style: none; background: #f8fafc; color: #334155; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 12px; font-size: 8.5pt; font-weight: 600; cursor: pointer; user-select: none; transition: 0.2s; }
details.dropdown-aksi summary::-webkit-details-marker { display: none; }
details.dropdown-aksi summary:hover, details.dropdown-aksi[open] summary { background: #e2e8f0; }
details.dropdown-aksi .dropdown-menu { position: absolute; right: 0; top: 100%; margin-top: 5px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 6px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); z-index: 1000; min-width: 170px; display: flex; flex-direction: column; padding: 6px; gap: 2px; }
details.dropdown-aksi .dropdown-menu button { text-align: left; background: transparent; border: none; padding: 8px 10px; font-size: 8.5pt; border-radius: 4px; cursor: pointer; font-weight: 500; transition: 0.2s; }
.dropdown-menu .btn-st:hover { background: #f0f9ff; color: #0284c7; }
.dropdown-menu .btn-keu:hover { background: #f0fdf4; color: #16a34a; }
.dropdown-menu .btn-spd:hover { background: #fff7ed; color: #ea580c; }
.dropdown-menu .btn-lain:hover { background: #faf5ff; color: #7e22ce; }
.dd-divider { height: 1px; background: #e2e8f0; margin: 4px 0; }

.history-dropdown { display: none; position: absolute; background: white; border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); z-index: 1500; max-height: 250px; overflow-y: auto; width: 350px; }
.history-item { padding: 10px 12px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 12px; display: flex; justify-content: space-between; align-items: center; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes marquee { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } }

/* =========================================
   9. PRINT STYLES
========================================= */
#preview-overlay { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.8); 
    z-index: 2000; 
    overflow-y: auto; 
    padding: 20px 0; 
}

.print-page { 
    background: white; 
    width: 210mm; 
    margin: 0 auto 30px auto; 
    padding: 2cm; 
    box-shadow: 0 0 10px rgba(0,0,0,0.1); 
    box-sizing: border-box; 
    font-family: Arial, sans-serif; 
    position: relative; 
    overflow: visible; 
}

@media print {
    @page {
        size: A4 portrait;
        margin: 0; 
    }

    .no-print, .navbar, .nav-btns, button, #login-overlay, .sidebar, header { 
        display: none !important; 
    }
    
    /* 1. Tambahkan height: auto agar body tidak memotong halaman */
    html, body { 
        background: white !important; 
        margin: 0 !important; 
        padding: 0 !important; 
        height: auto !important; 
        overflow: visible !important; 
    }
    
    .container { 
        margin: 0 !important; 
        max-width: 100% !important; 
        padding: 0 !important; 
        display: block !important; 
        height: auto !important;
        overflow: visible !important;
    }
    
    .container > div:not(#preview-overlay) {
        display: none !important;
    }
    
    /* 2. KUNCI UTAMA: Bebaskan tinggi overlay dan matikan scrollbar */
    #preview-overlay { 
        position: absolute !important; 
        top: 0 !important;
        left: 0 !important;
        display: block !important; 
        padding: 0 !important; 
        background: white !important; 
        height: auto !important; /* Ini yang akan memunculkan halaman ke-2, ke-3, dst */
        overflow: visible !important; /* Ini yang akan menghilangkan tongkat bar */
    }
    
    .print-page { 
        width: 210mm !important; 
        min-height: 297mm !important; 
        margin: 0 !important; 
        padding: 2cm !important; 
        box-sizing: border-box !important;
        box-shadow: none !important; 
        display: block !important; 
        overflow: visible !important; 
        page-break-after: always !important; 
        break-after: page !important; 
    }
    
    .print-page:last-child { 
        page-break-after: auto !important; 
        break-after: auto !important; 
    }
    
    .watermark { 
        position: absolute !important; 
        top: 55% !important; 
        left: 50% !important; 
        transform: translate(-50%, -50%) rotate(-45deg) !important; 
        font-size: 150pt !important; 
        color: rgba(0, 0, 0, 0.15) !important; 
        z-index: 9999 !important; 
        pointer-events: none; 
        user-select: none; 
        white-space: nowrap; 
        font-weight: 900 !important;
        display: block !important; 
    }
}

/* =========================================
   10. STYLE UNTUK NOTIFIKASI MENU
========================================= */
.badge-notif {
    background-color: var(--danger, #e74c3c);
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(231, 76, 60, 0.4);
    animation: pulseNotif 2s infinite;
}

@keyframes pulseNotif {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* =========================================
   11. TOGGLE SWITCH & ROLE SETTINGS MODAL
========================================= */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: #22c55e; }
input:checked + .slider:before { transform: translateX(20px); }

.role-setting-group { margin-bottom: 20px; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #ffffff; }
.role-setting-header { background: #f8fafc; padding: 12px 15px; font-weight: 700; color: #1e293b; border-bottom: 1px solid #e2e8f0; font-size: 14px; }
.role-setting-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-bottom: 1px solid #f1f5f9; }
.role-setting-item:last-child { border-bottom: none; }
.role-setting-label { font-size: 13px; color: #475569; font-weight: 500; }