/* ========================================
   ABSENSI SISWA - Modern Blue Theme (ACD Style)
   Modern & Clean Design with Dark/Light Mode
   ======================================== */

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

* {
    margin-top: 2px;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Emerald Green Palette - Light Mode */
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #10b981;
    --primary-50: #ecfdf5;
    --primary-100: #d1fae5;

    /* Neutral - Light Mode */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Background */
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-alt: #f8fafc;
    --bg-input: #f8fafc;
    --bg-sidebar: #ffffff;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Border */
    --border-color: #e2e8f0;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #10b981;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);

    /* Border Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* Dark Mode */
[data-theme="dark"] {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #34d399;
    --primary-50: #064e3b;
    --primary-100: #065f46;

    --white: #1e293b;
    --gray-50: #0f172a;
    --gray-100: #1e293b;
    --gray-200: #334155;
    --gray-300: #475569;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #cbd5e1;
    --gray-700: #e2e8f0;
    --gray-800: #f1f5f9;
    --gray-900: #f8fafc;

    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card-alt: #0f172a;
    --bg-input: #334155;
    --bg-sidebar: #1e293b;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: #475569;

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-muted);
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Background Pattern */
.bg-pattern {
    background-color: var(--primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(255,255,255,0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255,255,255,0.1) 0px, transparent 50%);
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 40px 40px 60px;
    text-align: center;
    position: relative;
}

.login-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
}

.login-icon {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.login-icon svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.login-header h1 {
    color: var(--white);
    font-size: 1.5rem;
    font-weight: 600;
}

.login-header p {
    color: rgba(255,255,255,0.8);
    font-size: 0.875rem;
    margin-top: 5px;
}

.login-body {
    padding: 50px 40px 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.2s;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-block {
    width: 100%;
}

.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: var(--gray-500);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--gray-600);
    transform: translateY(-2px);
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 20px 0;
    z-index: 999;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--gray-50);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--gray-200);
    border-radius: 3px;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    padding: 0 20px;
}

.sidebar-logo-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    border-radius: 8px;
}

.sidebar-logo-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-logo-text h2 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.sidebar-logo-text p {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.2;
}

.sidebar-nav {
    padding: 0 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    padding: 8px 12px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--primary-50);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-item svg,
.nav-item i {
    width: 18px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
    font-size: 16px;
}

.nav-item i {
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item span {
    font-weight: 500;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: 10px;
    border: 1px solid var(--gray-200);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 0.85rem;
}

.user-details {
    flex: 1;
    line-height: 1.3;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
}

.user-role {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    margin-top: 70px;
    background: var(--bg-body);
    min-height: calc(100vh - 70px);
    padding: 24px;
}

.top-bar {
    background: var(--white);
    padding: 20px 30px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;

}

.page-title h1 {
    margin: 0;
    line-height: 1;
}

.page-title svg, .page-title i {
    color: var(--primary);
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.content-area {
    padding: 0;
}

/* Content Header with Gradient (ACD Style) */
.content-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 14px;
    padding: 16px 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35);
    color: white;
}

.content-header::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 150px; height: 150px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}

.content-header::after {
    content: '';
    position: absolute;
    bottom: -50px; right: 100px;
    width: 110px; height: 110px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.content-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: white;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.content-header p {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    position: relative;
    z-index: 1;
}

/* Cards (ACD Style) */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 24px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.hadir {
    background: linear-gradient(135deg, var(--primary) 0%, #10b981 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.stat-icon.alpha {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.stat-icon.izin {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.stat-icon.sakit {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-content h3 {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-800);
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 4px;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Tables (ACD Style) */
.table-container {
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.table-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--gray-50);
    border-radius: 5px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--gray-200);
    border-radius: 5px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--primary) !important;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table tbody td {
    font-size: 0.85rem;
    color: var(--gray-600);
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: var(--gray-50);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: capitalize;
}

.badge-hadir {
    background: var(--primary-100);
    color: var(--primary-dark);
}

.badge-alpha {
    background: #fee2e2;
    color: #dc2626;
}

.badge-izin {
    background: #fef3c7;
    color: #d97706;
}

.badge-sakit {
    background: #d1fae5;
    color: #059669;
}

.badge-terlambat {
    background: #fce7f3;
    color: #db2777;
}

.badge-pending {
    background: #fef3c7;
    color: #d97706;
}

.badge-diterima {
    background: var(--primary-100);
    color: var(--primary-dark);
}

.badge-ditolak {
    background: #fee2e2;
    color: #dc2626;
}

/* Buttons */
.btn-sm {
    padding: 6px 12px;
    font-size: 10px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Form Elements */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* Absensi Button */
.absen-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: 4px solid;
    margin: 0 auto;
}

.absen-btn.hadir-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary-light);
    color: var(--white);
    box-shadow: 0 10px 30px rgba(5, 150, 105, 0.3);
}

.absen-btn.hadir-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(5, 150, 105, 0.4);
}

.absen-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.absen-btn svg {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Welcome Section */
.welcome-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-xl);
    padding: 30px;
    color: var(--white);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.welcome-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-section p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Calendar Date Picker */
.date-display {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.date-display .day {
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary);
    line-height: 1;
}

.date-display .month {
    font-size: 1rem;
    color: var(--gray-600);
    font-weight: 500;
}

.date-display .year {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Attendance Summary */
.attendance-summary {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--white);
    border-radius: 30px;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
}

.summary-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.summary-dot.hadir { background: var(--primary); }
.summary-dot.alpha { background: var(--danger); }
.summary-dot.izin { background: var(--warning); }
.summary-dot.sakit { background: var(--info); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 999;
        position: fixed;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }

    .top-navbar {
        left: 0 !important;
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Overlay when sidebar open on mobile */
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 998;
    }
}

@media (max-width: 768px) {
    /* ===== LAYOUT ===== */
    .dashboard-wrapper {
        flex-direction: column;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 12px !important;
        min-height: 100vh;
    }

    .content-area {
        padding: 12px !important;
    }

    /* ===== GRIDS ===== */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }

    /* ===== TOP BAR ===== */
    .top-bar {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .top-navbar {
        left: 0 !important;
        padding: 0 12px;
        height: 56px;
    }

    .page-title {
        font-size: 1.2rem !important;
    }

    /* ===== CONTENT HEADER ===== */
    .content-header {
        padding: 16px !important;
        margin-bottom: 16px !important;
        border-radius: var(--radius-lg) !important;
    }

    .content-header h2 {
        font-size: 1.2rem !important;
    }

    .content-header p {
        font-size: 0.85rem !important;
    }

    /* ===== CARDS ===== */
    .card {
        border-radius: var(--radius-lg) !important;
        margin-bottom: 12px;
    }

    .card-header {
        padding: 14px 16px !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-title {
        font-size: 0.95rem !important;
    }

    .card-body {
        padding: 14px 16px !important;
    }

    /* ===== STAT CARDS ===== */
    .stat-card {
        padding: 14px !important;
        gap: 10px;
    }

    .stat-icon {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px;
        border-radius: 10px !important;
    }

    .stat-icon svg {
        width: 20px !important;
        height: 20px !important;
    }

    .stat-value {
        font-size: 1.5rem !important;
    }

    .stat-content h3 {
        font-size: 0.78rem !important;
    }

    /* ===== WELCOME SECTION ===== */
    .welcome-section {
        padding: 16px !important;
        border-radius: var(--radius-lg) !important;
        margin-bottom: 14px;
    }

    .welcome-section h2 {
        font-size: 1.2rem !important;
    }

    .welcome-section p {
        font-size: 0.85rem !important;
    }

    .attendance-summary {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    /* ===== QUICK ACTIONS ===== */
    .quick-actions {
        gap: 8px;
        margin-bottom: 14px;
    }

    .quick-action-btn {
        padding: 12px 8px !important;
        font-size: 0.8rem;
    }

    .quick-action-btn svg {
        width: 20px !important;
        height: 20px !important;
        margin-bottom: 5px !important;
    }

    /* ===== TABLES ===== */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th, .table td {
        padding: 10px 10px !important;
        font-size: 0.82rem !important;
        white-space: nowrap;
    }

    /* ===== FORMS ===== */
    .form-control {
        font-size: 16px !important; /* prevent iOS zoom */
        padding: 10px 12px !important;
    }

    .btn {
        padding: 10px 16px !important;
        font-size: 0.875rem !important;
    }

    .btn-block {
        padding: 12px !important;
    }

    /* ===== SIDEBAR for dashboard-siswa ===== */
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    /* ===== NAVBAR ICONS ===== */
    .navbar-actions {
        gap: 6px !important;
    }

    .user-info-nav .user-name {
        display: none;
    }

    .user-info-nav .user-role {
        display: none;
    }

    /* ===== BADGES ===== */
    .badge {
        font-size: 0.72rem !important;
        padding: 3px 8px !important;
    }

    /* ===== LOCATION STATUS ===== */
    .location-status {
        font-size: 0.85rem;
        padding: 10px 12px !important;
    }

    /* ===== PAGE HEADER ===== */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .main-content {
        padding: 10px !important;
    }

    .content-header h2 {
        font-size: 1.1rem !important;
    }

    .stat-value {
        font-size: 1.3rem !important;
    }

    .quick-actions {
        flex-wrap: wrap;
    }

    .quick-action-btn {
        min-width: calc(50% - 4px);
        flex: none;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--gray-300);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-400);
    font-size: 0.9rem;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.quick-action-btn {
    flex: 1;
    padding: 15px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    text-align: center;
    text-decoration: none;
    color: var(--gray-700);
    transition: all 0.2s;
}

.quick-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

.quick-action-btn svg {
    width: 24px;
    height: 24px;
    margin-bottom: 8px;
    color: var(--primary);
}

.quick-action-btn span {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Tab Navigation */
.tabs {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    background: var(--gray-800);
    color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   THEME TOGGLE (Dark/Light Mode)
   ============================================ */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--gray-300);
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active::before {
    left: 27px;

}
.toggle-icon {
    font-size: 14px;
    color: var(--text-muted);
    width: 16px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   TOP NAVBAR STYLES
   ============================================ */
.top-navbar {
    background: var(--bg-card);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    height: 70px;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.burger-button {
    width: 40px;
    height: 40px;
    background: var(--bg-card-alt);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.burger-button:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.burger-line {
    width: 18px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.burger-button:hover .burger-line {
    background: white;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.btn-dashboard {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--info);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-dashboard:hover {
    background: #0891b2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Updated Dashboard Layout for Fixed Navbar */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    z-index: 999;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s ease;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    background: var(--bg-body);
    min-height: calc(100vh - 70px);
    padding: 24px;
    transition: all 0.3s ease;
}

.top-bar {
    display: none; /* Hide old top-bar, use top-navbar instead */
}

/* Collapsed Sidebar Styles */
body.sidebar-collapsed .sidebar {
    width: 70px;
}

body.sidebar-collapsed .sidebar-header {
    padding: 0 10px 20px;
    justify-content: center;
}

body.sidebar-collapsed .sidebar-logo {
    justify-content: center;
    padding: 0 10px;
}

body.sidebar-collapsed .sidebar-logo-img {
    width: 40px;
}

body.sidebar-collapsed .sidebar-logo-text {
    display: none;
}

body.sidebar-collapsed .nav-section-title,
body.sidebar-collapsed .nav-item span {
    display: none;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 12px;
}

body.sidebar-collapsed .nav-item svg,
body.sidebar-collapsed .nav-item i {
    margin-right: 0;
}

body.sidebar-collapsed .top-navbar {
    left: 70px;
}

body.sidebar-collapsed .main-content {
    margin-left: 70px;
}

/* Burger button animation when collapsed */
body.sidebar-collapsed .burger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

body.sidebar-collapsed .burger-line:nth-child(2) {
    opacity: 0;
}

body.sidebar-collapsed .burger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}