/* public/css/app.css - Sistem Desain Modern SMK Al-Farizi (Professional & Eye-Comfort Palette) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    /* Royal Sapphire & Trust Blue */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-dark: #1e3a8a;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    
    /* Deep Slate / Midnight Navy */
    --secondary: #0f172a;
    --secondary-light: #1e293b;
    --secondary-border: #334155;
    
    /* Institutional Semantic Accents */
    --success: #059669;
    --success-hover: #047857;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;
    
    --warning: #d97706;
    --warning-hover: #b45309;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;
    
    --danger: #e11d48;
    --danger-hover: #be123c;
    --danger-light: #fff1f2;
    --danger-border: #fecdd3;
    
    --info: #0284c7;
    --info-light: #f0f9ff;
    
    /* Comfort Slate Backgrounds */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    
    /* High-Readability Typography */
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    
    /* Soft Elevation Shadows (Anti-Fatigue) */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

/* Custom Eye-Comfort Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

h1, h2, h3, h4, h5, h6, .brand-font {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* ==========================================================================
   LAYOUT STRUCTURES (DESKTOP ADMIN & MOBILE FIRST GURU/PIKET)
   ========================================================================== */

/* Admin Layout with Sleek Sidebar */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    border-right: 1px solid #1e293b;
}

.admin-sidebar .brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #334155;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    padding: 12px 14px 6px;
    letter-spacing: 0.8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #cbd5e1;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.nav-item.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.6);
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    max-width: calc(100% - 260px);
    background-color: var(--bg-main);
    min-height: 100vh;
}

/* Mobile-First Layout (Guru & Guru Piket) */
.mobile-wrapper {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100vh;
    background: #ffffff;
    box-shadow: 0 0 35px rgba(15, 23, 42, 0.07);
    position: relative;
    padding-bottom: 84px;
}

.mobile-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: white;
    padding: 24px 20px 22px;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    position: relative;
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.2);
}

.mobile-nav-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 540px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 14px;
    z-index: 100;
    box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.05);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.18s ease;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item .icon {
    font-size: 20px;
}

/* ==========================================================================
   CARDS & STATS
   ========================================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    margin-bottom: 22px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); border: 1px solid #dbeafe; }
.stat-icon.green { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }

.stat-value {
    font-size: 24px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    line-height: 1.15;
}

.stat-label {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* ==========================================================================
   BUTTONS & BADGES
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: var(--shadow-xs);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}
.btn-success:hover {
    background: var(--success-hover);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 2px 8px rgba(225, 29, 72, 0.25);
}
.btn-danger:hover {
    background: var(--danger-hover);
    color: white;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.35);
}

.btn-outline {
    background: white;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-main);
    border-color: var(--border-hover);
    color: var(--text-main);
}

.btn:disabled, .btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: grayscale(0.5);
    transform: none !important;
    box-shadow: none !important;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-success { background: var(--success-light); color: var(--success); border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-info { background: var(--info-light); color: var(--info); border: 1px solid #bae6fd; }
.badge-neutral { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border-color); }

/* ==========================================================================
   TABLES & FORMS
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: white;
    box-shadow: var(--shadow-xs);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.table th {
    background: #f8fafc;
    padding: 13px 16px;
    font-weight: 700;
    font-size: 11.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 13px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: var(--text-main);
}

.table tbody tr:hover {
    background: #f8fafc;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 13.5px;
    font-family: inherit;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ==========================================================================
   SCANNER UI & POP-UPS
   ========================================================================== */
.scanner-viewport {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow-lg);
    margin: 16px 0;
}

.mode-switcher {
    display: flex;
    background: #e2e8f0;
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
    margin: 12px 0;
}

.mode-switcher button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s;
}

.mode-switcher button.active {
    background: white;
    color: #0f172a;
    box-shadow: var(--shadow-sm);
}

.popup-student-card {
    position: absolute;
    inset: 12px;
    background: rgba(16, 185, 129, 0.96);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    z-index: 50;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.popup-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: white;
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

/* Micro-animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease forwards;
}

.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 600;
    font-size: 13.5px;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
}
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }
    .admin-sidebar {
        position: relative;
        width: 100%;
        height: auto;
    }
    .admin-main {
        margin-left: 0;
        max-width: 100%;
        padding: 16px;
    }
}
