/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* Variabel CSS untuk konsistensi */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --text-color: #212529;
    --body-bg: #f4f7f6;
    --sidebar-bg: #ffffff;
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Reset dan Body Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
    line-height: 1.6;
}

/* Layout Utama */
.page-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    box-shadow: var(--box-shadow);
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    transition: transform 0.3s ease-in-out, background-color 0.3s;
    z-index: 1000;
    overflow-y: auto; 
}

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding: 2rem;
    transition: margin-left 0.3s ease-in-out;
}

.top-header {
    display: none; /* Disembunyikan, akan muncul di mode mobile */
}

/* Komponen Card */
.card {
    background-color: #ffffff;
    border-radius: var(--border-radius);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
    transition: background-color 0.3s;
}
.card h2 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.card p {
    color: var(--secondary-color);
}

/* Form Styling */
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.2s;
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.filter-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* Tombol (Button) Styling */
.btn, .btn-submit, .btn-export {
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    text-align: center;
    font-weight: 500;
    transition: background-color 0.2s;
}
.btn-primary, .btn-submit { background-color: var(--primary-color); color: white; }
.btn-primary:hover, .btn-submit:hover { background-color: #0069d9; }
.btn-success { background-color: var(--success-color); color: white; }
.btn-success:hover { background-color: #218838; }
.btn-secondary { background-color: var(--secondary-color); color: white; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-danger { background-color: var(--danger-color); color: white; }
.btn-danger:hover { background-color: #c82333; }
.form-buttons { display: flex; gap: 1rem; }

/* Tabel (Table) Styling */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}
.table th, .table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
    vertical-align: middle;
    transition: background-color 0.3s, border-color 0.3s;
}
.table thead th {
    background-color: var(--light-color);
    font-weight: 600;
}
.table tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,0.02);
}
.table-container {
    overflow-x: auto;
}

/* Flash Message */
.flash-message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
}
.flash-message.success {
    background-color: #d4edda;
    color: #155724;
}
.flash-message.danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* === Dark Mode Styles === */
body.dark-mode {
    --primary-color: #3a96ff;
    --secondary-color: #adb5bd;
    --success-color: #31d05a;
    --danger-color: #ff4d6b;
    --warning-color: #ffca2c;
    --info-color: #28b8d2;
    --light-color: #343a40; /* Darker light color */
    --dark-color: #e9ecef; /* Lighter dark color */
    --text-color: #e9ecef; /* Light text for dark backgrounds */
    --body-bg: #121212; /* Main dark background */
    --sidebar-bg: #1e1e1e; /* Slightly lighter dark for surfaces */
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

body.dark-mode .card,
body.dark-mode .top-header {
    background-color: #1e1e1e;
    border: 1px solid #343a40;
}
body.dark-mode .card p { color: #adb5bd; }

body.dark-mode .sidebar {
    background-color: var(--sidebar-bg);
    border-right: 1px solid #343a40;
}

body.dark-mode .table thead th,
body.dark-mode .table tfoot td {
    background-color: #343a40;
    color: var(--text-color);
}
body.dark-mode .table tbody tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, 0.03); }
body.dark-mode .table th, body.dark-mode .table td { border-color: #495057; }
body.dark-mode .form-group input, body.dark-mode .form-group select {
    background-color: #343a40;
    border-color: #495057;
    color: var(--text-color);
}
body.dark-mode .form-group input::placeholder, body.dark-mode .form-group select::placeholder { color: var(--secondary-color); }
body.dark-mode .sidebar-header { border-bottom-color: #495057; }
body.dark-mode .sidebar-nav li a { color: #adb5bd; }
body.dark-mode .sidebar-nav li a:hover { background-color: #343a40; color: #ffffff; }
body.dark-mode .sidebar-divider { border-top-color: #495057; }
body.dark-mode .sidebar-heading { color: #868e96; }
body.dark-mode .login-card { background-color: #1e1e1e; }
body.dark-mode .chart-container { background-color: #1e1e1e; border: 1px solid #343a40; }

/* Dark mode toggle button */
.theme-toggle {
    background: none;
    border: 1px solid #ced4da;
    color: var(--secondary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}
.theme-toggle:hover {
    background-color: var(--light-color);
    color: var(--text-color);
}
body.dark-mode .theme-toggle {
    border-color: #495057;
    color: var(--secondary-color);
}
body.dark-mode .theme-toggle:hover {
    background-color: #343a40;
    color: #ffffff;
}

/* Header untuk Desktop */
.desktop-header-utils {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}
.welcome-user {
    color: var(--secondary-color);
    font-weight: 500;
}
.header-icon-btn {
    background: none;
    border: 1px solid #ced4da;
    color: var(--secondary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    text-decoration: none;
}
.header-icon-btn:hover {
    background-color: var(--light-color);
    color: var(--text-color);
}
body.dark-mode .header-icon-btn {
    border-color: #495057;
    color: var(--secondary-color);
}
body.dark-mode .header-icon-btn:hover {
    background-color: #343a40;
    color: #ffffff;
}

/* === Confirmation Modal Styling === */
.confirm-modal {
    display: none; /* Sembunyikan secara default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}
.confirm-modal .modal-content {
    background-color: #fff;
    margin: auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 450px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
}
.confirm-modal .modal-header {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.confirm-modal .modal-body p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}
.confirm-modal .modal-footer {
    text-align: center;
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}
body.dark-mode .confirm-modal .modal-content {
    background-color: var(--sidebar-bg); /* #1e1e1e */
    border: 1px solid #343a40;
}
body.dark-mode .confirm-modal .modal-header {
    border-bottom-color: #343a40;
}

/* === Footer Styling === */
.main-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e3e6f0;
    color: var(--secondary-color);
    font-size: 0.9em;
    transition: all 0.3s;
}

body.dark-mode .main-footer {
    border-top-color: #495057;
}


/* === Tampilan Mobile (Responsive) === */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 240px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 15px rgba(0,0,0,0.1);
    }
    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        padding-top: calc(var(--header-height) + 1rem); /* Beri ruang untuk header */
    }

    .top-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background-color: #ffffff;
        padding: 0 1rem;
        height: var(--header-height);
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        box-shadow: var(--box-shadow);
        z-index: 999;
    }
    
    /* PERBAIKAN BARU: Grup kiri (tombol dan judul) */
    .header-left {
        display: flex;
        align-items: center;
        gap: 1rem;
    }

    .top-header h3 {
        color: var(--primary-color);
        font-size: 1.2rem;
    }
    .header-utils-mobile {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .menu-toggle {
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--dark-color);
    }
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.4);
        z-index: 998;
        display: none; /* Akan diaktifkan oleh JS */
    }
    .overlay.active {
        display: block;
    }

    /* Sembunyikan header desktop di mobile */
    .desktop-header-utils {
        display: none;
    }
}

