:root {
    --primary: #006838;
    --primary-dark: #00502a;
    --primary-light: #e8f5e9;
    --secondary: #6c757d;
    --success: #06d6a0;
    --danger: #ef476f;
    --warning: #ffd166;
    --info: #118ab2;
    --dark: #1a1a2e;
    --light: #ffffff;
    --bg-gradient: linear-gradient(135deg, #006838 0%, #00502a 50%, #004d26 100%);
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

[data-bs-theme="dark"] {
    --primary-light: #0a2e1a;
    --light: #1a1a2e;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
    --shadow: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
}

.auth-page {
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

[data-bs-theme="dark"] .auth-card {
    background: #16213e;
}

.auth-header {
    padding: 30px;
    text-align: center;
    background: var(--bg-gradient);
    color: white;
}

.auth-header .logo {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.auth-header h4 { font-weight: 700; margin-bottom: 5px; }
.auth-header p { opacity: 0.9; font-size: 0.9rem; margin: 0; }

.auth-body { padding: 30px; }

.auth-body .form-control {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    transition: var(--transition);
    font-size: 0.95rem;
}

.auth-body .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 104, 56, 0.15);
}

.auth-body .form-floating label { padding-left: 16px; }

.btn-primary {
    background: var(--primary);
    border: none;
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 12px 24px;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.navbar-custom {
    background: white !important;
    box-shadow: var(--shadow-sm);
    padding: 12px 0;
}

[data-bs-theme="dark"] .navbar-custom {
    background: #16213e !important;
}

.navbar-custom .navbar-brand {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.4rem;
}

.navbar-custom .nav-link {
    font-weight: 500;
    color: var(--dark);
    padding: 8px 16px !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

[data-bs-theme="dark"] .navbar-custom .nav-link {
    color: #e0e0e0;
}

.logout-btn {
    background: none;
    border: 2px solid var(--danger);
    color: var(--danger);
    padding: 6px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
}

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

.stat-card {
    background: white;
    border: none;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

[data-bs-theme="dark"] .stat-card {
    background: #16213e;
}

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

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 15px;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
}

[data-bs-theme="dark"] .stat-card .stat-number {
    color: white;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--secondary);
    font-weight: 500;
}

.queue-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

[data-bs-theme="dark"] .queue-card {
    background: #16213e;
}

.queue-card .queue-number {
    font-size: 4rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    letter-spacing: 2px;
}

.queue-card .queue-label {
    font-size: 1rem;
    color: var(--secondary);
    font-weight: 500;
    margin-top: 10px;
}

.queue-card .queue-status {
    display: inline-block;
    padding: 6px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 15px;
}

.bg-queue-pending { background: #fff3cd; color: #856404; }
.bg-queue-waiting { background: #cce5ff; color: #004085; }
.bg-queue-called { background: #d4edda; color: #155724; }
.bg-queue-serving { background: #d1ecf1; color: #0c5460; }
.bg-queue-served { background: #d4edda; color: #155724; }
.bg-queue-missed { background: #f8d7da; color: #721c24; }
.bg-queue-expired { background: #f8d7da; color: #721c24; }

[data-bs-theme="dark"] .bg-queue-pending { background: #3d3200; color: #ffd166; }
[data-bs-theme="dark"] .bg-queue-waiting { background: #00264d; color: #6cb2ff; }
[data-bs-theme="dark"] .bg-queue-called { background: #003320; color: #06d6a0; }
[data-bs-theme="dark"] .bg-queue-serving { background: #003344; color: #6edff6; }
[data-bs-theme="dark"] .bg-queue-served { background: #003320; color: #06d6a0; }
[data-bs-theme="dark"] .bg-queue-missed { background: #3d0010; color: #ff6b8a; }

.get-queue-btn {
    background: var(--bg-gradient);
    border: none;
    color: white;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.get-queue-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.get-queue-btn:hover::before { left: 100%; }

.get-queue-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

[data-bs-theme="dark"] .timeline::before {
    background: #2a2a4a;
}

.timeline-item {
    position: relative;
    padding-left: 55px;
    margin-bottom: 25px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-icon {
    position: absolute;
    left: 11px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid white;
    z-index: 1;
}

[data-bs-theme="dark"] .timeline-icon {
    border-color: #1a1a2e;
}

.timeline-content {
    background: var(--light);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

[data-bs-theme="dark"] .timeline-content {
    background: #1e1e3a;
}

.timeline-content .time {
    font-size: 0.8rem;
    color: var(--secondary);
}

.counter-badge {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin: 0 auto;
}

.counter-serving {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

[data-bs-theme="dark"] .counter-serving {
    background: #16213e;
}

.counter-serving:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.counter-serving .serving-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
}

.btn-counter {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: var(--transition);
    margin: 3px;
}

.btn-counter:hover {
    transform: translateY(-2px);
}

.admin-sidebar {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    position: sticky;
    top: 20px;
}

[data-bs-theme="dark"] .admin-sidebar {
    background: #16213e;
}

.admin-sidebar .nav-link {
    color: var(--dark);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    margin-bottom: 4px;
    font-weight: 500;
}

[data-bs-theme="dark"] .admin-sidebar .nav-link {
    color: #e0e0e0;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.admin-sidebar .nav-link i {
    width: 22px;
    margin-right: 8px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
    cursor: pointer;
}

.theme-switch input { display: none; }

.theme-switch .slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #e9ecef;
    border-radius: 28px;
    transition: var(--transition);
}

.theme-switch .slider::before {
    content: '\f185';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #ffd166;
}

.theme-switch input:checked + .slider {
    background: var(--primary);
}

.theme-switch input:checked + .slider::before {
    transform: translateX(28px);
    content: '\f186';
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.counter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.hero-section {
    background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('../img/isucauayan.png') center / cover no-repeat;
    padding: 130px 0;
    color: white;
    text-align: center;
}

.hero-section h1 {
    text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.hero-section .btn {
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.hero-section h1 {
    font-weight: 800;
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero-section p {
    opacity: 0.9;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.table-custom {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

[data-bs-theme="dark"] .table-custom {
    background: #16213e;
}

.table-custom thead {
    background: var(--primary-light);
}

[data-bs-theme="dark"] .table-custom thead {
    background: #1e2248;
}

.table-custom th {
    color: var(--primary);
    font-weight: 600;
    border-bottom: none;
}

.table-custom td {
    vertical-align: middle;
}

.queue-display {
    background: var(--dark);
    color: white;
    padding: 10px 0;
    text-align: center;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1050;
    display: none;
}

.live-display .queue-display { display: block; }

.toast-container-custom {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1060;
}

@media (max-width: 768px) {
    .queue-card .queue-number { font-size: 3rem; }
    .counter-grid { grid-template-columns: 1fr; }
    .stat-card .stat-number { font-size: 1.5rem; }
    .hero-section h1 { font-size: 1.8rem; }
    .auth-card { margin: 10px; }
    .auth-header { padding: 20px; }
    .auth-body { padding: 20px; }

    .queue-card { padding: 20px 15px; }
    .queue-card .h3 { font-size: 1.5rem; }
    .navbar-custom .btn { font-size: 0.85rem; }
    .table-custom td, .table-custom th { white-space: nowrap; }
    .admin-sidebar .nav-link { padding: 8px 12px; font-size: 0.9rem; }
    .admin-sidebar { padding: 15px; }
    .get-queue-btn { padding: 14px 30px; font-size: 1rem; }
    .counter-serving .serving-number { font-size: 2rem; }
    .counter-serving { padding: 15px; }
    .dropdown-menu { font-size: 0.85rem; }
}

@media (max-width: 576px) {
    .queue-card .queue-number { font-size: 2.5rem; }
    .queue-card .row .col-4 .h3 { font-size: 1.3rem; }
    .stat-card { padding: 15px; }
    .table-custom td, .table-custom th { font-size: 0.8rem; padding: 6px; }
    .admin-sidebar { margin-bottom: 15px; }
    .navbar-custom .navbar-brand { font-size: 1.1rem; }
    .hero-section { padding: 40px 0; }
    .hero-section h1 { font-size: 1.5rem; }
    .counter-serving .serving-number { font-size: 1.8rem; }
    .navbar-custom .container-fluid { padding: 0 12px; }
    .container-fluid.my-4 { padding: 0 12px; }
    .toast-container-custom { right: 10px; left: 10px; }
    .toast-container-custom .toast { min-width: unset !important; width: 100%; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse-animation { animation: pulse 2s infinite; }

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

.slide-in { animation: slideIn 0.5s ease; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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