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

/* ============================================
   ESTILOS PREMIUM - Sistema de Asistencia
   Colegio Mercedario RVDO (Glassmorphism & Modern UI)
   ============================================ */

:root {
    /* ── Paleta Profesional ── */
    --primary: #1e3a5f;
    --primary-hover: #162d4a;
    --primary-light: #eaf0f7;
    --accent: #c0862e;
    --accent-hover: #a87325;
    --accent-light: #faf5ec;
    --success: #2e7d5b;
    --success-light: #e6f4ee;
    --danger: #c0392b;
    --danger-light: #fdecea;
    --warning: #d4851e;
    --warning-light: #fdf3e6;
    --info: #2471a3;
    --info-light: #e8f1f8;
    
    --dark: #1a1f2e;
    --gray: #5a6478;
    --gray-light: #cfd5de;
    --light: #f5f7fa;
    --white: #ffffff;
    
    --border: rgba(207, 213, 222, 0.6);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.1);
    --shadow-glass: 0 8px 32px rgba(30, 58, 95, 0.06);
    
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: #f1f5f9;
    background-image: 
        radial-gradient(at 40% 20%, rgba(30,58,95,0.04) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(192,134,46,0.04) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(46,125,91,0.04) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--dark);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── LOGIN ── */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #0e1f33 100%);
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1;
    transform: translateY(0);
    transition: var(--transition);
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .icon {
    font-size: 56px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-logo h1 {
    font-size: 24px;
    color: var(--dark);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--gray);
    font-size: 15px;
    margin-top: 6px;
    font-weight: 500;
}

/* ── FORMS ── */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition);
    outline: none;
    background: var(--white);
    color: var(--dark);
    box-shadow: var(--shadow-sm);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.12);
}

.form-group input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(30, 58, 95, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 58, 95, 0.35);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(46, 125, 91, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(46, 125, 91, 0.35);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--gray-light);
    color: var(--gray);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── NAVIGATION ── */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 18px;
    color: var(--dark);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.navbar-brand .icon {
    font-size: 28px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.navbar-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--gray);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.navbar-nav a svg {
    flex-shrink: 0;
    vertical-align: middle;
}

.btn svg {
    flex-shrink: 0;
    vertical-align: middle;
}

.navbar-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.navbar-nav a.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(30, 58, 95, 0.25);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-user .username {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    background: var(--gray-light);
    padding: 6px 12px;
    border-radius: 20px;
}

/* ── LAYOUT ── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
    animation: fadeIn 0.5s ease-out forwards;
}

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

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

/* ── CARDS ── */
.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-glass);
    overflow: hidden;
    transition: var(--transition);
}

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

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.5);
}

.card-body {
    padding: 24px;
}

/* ── STATS GRID ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

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

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.5);
}

.stat-card .stat-icon.blue { background: linear-gradient(135deg, #3d6fa0, #1e3a5f); color: white; }
.stat-card .stat-icon.green { background: linear-gradient(135deg, #4caf6e, #2e7d5b); color: white;  }
.stat-card .stat-icon.red { background: linear-gradient(135deg, #e06050, #c0392b); color: white; }
.stat-card .stat-icon.orange { background: linear-gradient(135deg, #d4a04e, #c0862e); color: white; }

.stat-card .stat-info {
    flex: 1;
}

.stat-card .stat-info .stat-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    color: var(--dark);
    letter-spacing: -1px;
}

.stat-card .stat-info .stat-label {
    font-size: 14px;
    color: var(--gray);
    margin-top: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── SCANNER ── */
.scanner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 20px;
}

.scanner-video-container {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    border: 4px solid var(--white);
}

#qr-reader {
    width: 100% !important;
}

#qr-reader video {
    border-radius: calc(var(--radius-lg) - 4px);
    object-fit: cover;
}

.scan-result {
    width: 100%;
    max-width: 500px;
}

.scan-result-card {
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.scan-result-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.4), transparent);
    transform: translateX(-100%);
    animation: shine 2s infinite;
}

@keyframes shine {
    100% { transform: translateX(100%); }
}

@keyframes bounceIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.scan-result-card.entry {
    background: linear-gradient(135deg, var(--success-light), var(--white));
    border: 2px solid var(--success);
}

.scan-result-card.exit {
    background: linear-gradient(135deg, var(--danger-light), var(--white));
    border: 2px solid var(--danger);
}

.scan-result-card.error {
    background: linear-gradient(135deg, var(--warning-light), var(--white));
    border: 2px solid var(--warning);
}

.scan-result-card .result-icon {
    font-size: 64px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.scan-result-card .result-name {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.scan-result-card .result-grade {
    font-size: 16px;
    color: var(--gray);
    margin-bottom: 12px;
    font-weight: 600;
}

.scan-result-card .result-type {
    display: inline-block;
    padding: 8px 24px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 16px;
    color: var(--white);
    margin-bottom: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.scan-result-card.entry .result-type { background: var(--success); }
.scan-result-card.exit .result-type { background: var(--danger); }
.scan-result-card.tardanza .result-type { background: var(--warning); }

.scan-result-card .result-time {
    font-size: 15px;
    color: var(--gray);
    font-weight: 600;
}

/* Birthday message */
.birthday-message {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #e15f41, #f5cd79);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 15px;
    animation: pulse 1s infinite alternate;
}

/* ── TABLE ── */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
}

table th {
    background: var(--light);
    padding: 16px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray);
    letter-spacing: 1px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    vertical-align: middle;
}

table tr:hover td {
    background: var(--primary-light);
}

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

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-entry { background: var(--success-light); color: #065f46; }
.badge-exit { background: var(--danger-light); color: #991b1b; }
.badge-tardanza { background: var(--warning-light); color: #9a3412; }
.badge-level { background: var(--gray-light); color: var(--dark); text-transform: capitalize; }
.badge-inicial { background: #FFF3E0; color: #E65100; }
.badge-primaria { background: #E8F5E9; color: #2E7D32; }
.badge-secundaria { background: #E3F2FD; color: #1565C0; }

/* ── SEARCH ── */
.search-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.search-bar input {
    flex: 1;
    min-width: 250px;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(30, 58, 95, 0.08); }

.search-bar select {
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    color: var(--dark);
    outline: none;
    background: var(--light);
    cursor: pointer;
}

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active { display: flex; opacity: 1; }

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal { transform: scale(1); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 30px;
    border-bottom: 1px solid var(--border);
    background: var(--light);
}

.modal-header h3 { font-size: 20px; font-weight: 800; color: var(--dark); }

.modal-close {
    background: var(--gray-light);
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    color: var(--dark);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); transform: rotate(90deg); }

.modal-body { padding: 30px; }

.modal-footer {
    display: flex; justify-content: flex-end; gap: 16px;
    padding: 24px 30px; border-top: 1px solid var(--border);
    background: var(--light);
}

/* ── RECENT SCANS ── */
.recent-list { list-style: none; }
.recent-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; border-bottom: 1px solid var(--border);
    transition: var(--transition);
    border-radius: var(--radius-sm);
}
.recent-item:hover { background: var(--light); transform: translateX(5px); }
.recent-item:last-child { border-bottom: none; }
.recent-item .info { display: flex; align-items: center; gap: 16px; }

.recent-item .avatar {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; color: var(--white);
    box-shadow: var(--shadow-sm);
}
.recent-item .avatar.entry { background: linear-gradient(135deg, var(--success), #059669); }
.recent-item .avatar.exit { background: linear-gradient(135deg, var(--danger), #b91c1c); }

.recent-item .name { font-weight: 700; font-size: 15px; color: var(--dark); margin-bottom: 4px; }
.recent-item .grade-info { font-size: 13px; color: var(--gray); font-weight: 500; }
.recent-item .time-info { text-align: right; font-size: 14px; color: var(--gray); }
.recent-item .time-info .type { font-weight: 700; display: block; margin-bottom: 4px; }

/* ── ALERTS & TOASTS ── */
.alert {
    padding: 16px 20px; border-radius: var(--radius-sm); margin-bottom: 20px;
    font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 12px;
}
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }

.toast-container { position: fixed; top: 90px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 12px; }
.toast {
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px);
    border-radius: var(--radius-sm); padding: 16px 24px;
    box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 12px;
    min-width: 300px; animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 15px; font-weight: 600; border: 1px solid var(--border);
}
.toast.success { border-left: 6px solid var(--success); }
.toast.error { border-left: 6px solid var(--danger); }

@keyframes slideInRight {
    0% { transform: translateX(120%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* ── TABS ── */
.tabs { display: flex; gap: 8px; border-bottom: 2px solid var(--border); margin-bottom: 24px; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--gray-light); border-radius: 4px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mb-20 { margin-bottom: 20px; }
.tab {
    padding: 12px 24px; background: none; border: none;
    font-size: 15px; font-weight: 600; color: var(--gray);
    cursor: pointer; border-bottom: 3px solid transparent;
    margin-bottom: -2px; transition: var(--transition);
}
.tab:hover { color: var(--primary); background: var(--primary-light); border-radius: 8px 8px 0 0; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── QR CODE DISPLAY ── */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.qr-card {
    background: var(--white); border-radius: var(--radius); padding: 24px; text-align: center;
    box-shadow: var(--shadow-md); border: 1px solid var(--border); transition: var(--transition);
}
.qr-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.qr-card img { width: 140px; height: 140px; margin-bottom: 16px; border-radius: 8px; }
.qr-card .qr-name { font-size: 15px; font-weight: 800; margin-bottom: 4px; color: var(--dark); }
.qr-card .qr-grade { font-size: 13px; color: var(--gray); font-weight: 500; }
.qr-card .qr-code {
    display: inline-block; background: var(--primary-light); color: var(--primary);
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 800; margin-top: 12px;
}

/* ── EMPTY & LOADING ── */
.empty-state { text-align: center; padding: 80px 20px; color: var(--gray); }
.empty-state .icon { font-size: 64px; margin-bottom: 20px; filter: grayscale(1); opacity: 0.5; }
.empty-state h3 { font-size: 20px; margin-bottom: 10px; color: var(--dark); font-weight: 800; }
.empty-state p { font-size: 15px; font-weight: 500; }

.loading { display: flex; align-items: center; justify-content: center; padding: 60px; }
.spinner {
    width: 50px; height: 50px; border: 4px solid var(--gray-light);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

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

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .main-content { padding: 16px 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
    .page-header h2 { font-size: 20px; }
    .page-header > div { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
    .page-header > div .btn { font-size: 12px; padding: 6px 10px; flex: 0 1 auto; }
    .search-bar { flex-direction: column; gap: 10px; padding: 12px; margin-bottom: 16px; }
    .search-bar input { min-width: 100%; }
    .modal { margin: 16px; }
    .table-container { border-radius: 0; box-shadow: none; border-left: 0; border-right: 0; margin-left: -12px; margin-right: -12px; width: calc(100% + 24px); max-width: 100vw; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table td, table th { padding: 10px 12px; font-size: 13px; }
    .hide-mobile { display: none !important; }
    .dashboard-two-col { grid-template-columns: 1fr !important; }
    .admin-grid { grid-template-columns: 1fr !important; }
    .card-header { font-size: 14px; padding: 14px 16px; }
    .card-body { padding: 16px; }
}

@media (max-width: 600px) {
    /* Fixed Top Header */
    .mobile-header {
        display: flex !important;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 60px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 0 16px;
        align-items: center;
        justify-content: space-between;
        z-index: 1100;
        border-bottom: 1px solid var(--border);
    }
    
    .mobile-header-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        font-weight: 800;
        font-size: 16px;
        color: var(--dark);
        text-decoration: none;
    }

    /* Fixed Bottom Tab Bar */
    .navbar {
        position: fixed;
        bottom: 0; top: auto; left: 0; right: 0;
        height: 65px;
        padding: 0 8px;
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border);
        border-bottom: none;
        z-index: 1100;
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
        display: flex !important;
        justify-content: space-around;
        align-items: stretch;
    }

    .navbar-brand, .navbar-user { display: none !important; }

    .navbar-nav {
        width: 100%;
        display: flex;
        justify-content: space-around;
        align-items: stretch;
        gap: 0;
    }

    .navbar-nav li { flex: 1; display: flex; }

    .navbar-nav a {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        width: 100%;
        height: 100%;
        padding: 0;
        border-radius: 0;
        background: transparent !important;
        box-shadow: none !important;
        color: var(--gray);
        position: relative;
    }

    .navbar-nav a svg {
        width: 22px;
        height: 22px;
        margin: 0;
        stroke-width: 2;
    }

    .navbar-nav a .nav-text {
        display: block !important;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .navbar-nav a.active {
        color: var(--primary);
    }

    .navbar-nav a.active::after {
        content: '';
        position: absolute;
        top: 0; left: 50%;
        transform: translateX(-50%);
        width: 32px; height: 3px;
        background: var(--primary);
        border-radius: 0 0 4px 4px;
    }

    .main-content {
        margin-top: 60px;
        padding-bottom: 80px;
    }

    /* Stat Cards & Buttons */
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-card .stat-icon { width: 44px; height: 44px; }
    .stat-card .stat-info .stat-value { font-size: 24px; }

    .btn:not(.btn-sm) { padding: 12px 20px; font-size: 14px; }
    .page-header h2 { font-size: 18px; }
}

.mobile-header { display: none; }

@media print {
    .navbar, .btn, .search-bar, .no-print { display: none !important; }
    body { background: white !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; }
    .qr-grid { grid-template-columns: repeat(4, 1fr) !important; }
}