/* ============================================================
   Real-time Auto-Booking System - Design System
   Premium Dark Theme with Glassmorphism
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');

/* ============================================================
   CSS Variables (Design Tokens)
   ============================================================ */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 30, 60, 0.6);
    --bg-card-hover: rgba(40, 40, 80, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-hover: rgba(255, 255, 255, 0.1);
    --bg-sidebar: rgba(15, 15, 35, 0.95);
    --bg-navbar: rgba(15, 15, 35, 0.85);

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-primary-light: #818cf8;
    --accent-primary-dark: #4f46e5;
    --accent-secondary: #06b6d4;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #3b82f6;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
    --gradient-hero: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 40%, #16213e 100%);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #818cf8;

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(99, 102, 241, 0.3);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --shadow-success-glow: 0 0 20px rgba(16, 185, 129, 0.3);

    /* Typography */
    --font-primary: 'Inter', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Light Theme Override
   ============================================================ */
[data-theme="light"] {
    /* Colors - Light Theme (Purple/Blue/White Focus) */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-glass: rgba(255, 255, 255, 0.8);
    --bg-glass-hover: rgba(255, 255, 255, 0.95);
    --bg-sidebar: rgba(255, 255, 255, 0.98);
    --bg-navbar: rgba(255, 255, 255, 0.95);

    /* Text */
    --text-primary: #1e1b4b;
    /* Very dark purple-blue */
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-accent: #6d28d9;
    /* Deep purple */

    /* Accent overrides for Light theme to be more Purple/Blue */
    --accent-primary: #7c3aed;
    /* Purple */
    --accent-primary-light: #8b5cf6;
    --accent-primary-dark: #6d28d9;
    --accent-secondary: #3b82f6;
    /* Blue */

    /* Borders */
    --border-color: rgba(99, 102, 241, 0.15);
    --border-glass: rgba(99, 102, 241, 0.2);
    --border-accent: rgba(124, 58, 237, 0.4);

    /* Shadows - Lighter softer shadows with purple tint */
    --shadow-sm: 0 1px 3px rgba(124, 58, 237, 0.05);
    --shadow-md: 0 4px 12px rgba(124, 58, 237, 0.08);
    --shadow-lg: 0 10px 25px rgba(124, 58, 237, 0.12);
    --shadow-glow: 0 0 15px rgba(124, 58, 237, 0.2);
    --shadow-success-glow: 0 0 15px rgba(59, 130, 246, 0.2);

    /* Gradients - White to Light Purple/Blue */
    --gradient-hero: linear-gradient(135deg, #ffffff 0%, #f3e8ff 40%, #e0e7ff 100%);
    --gradient-card: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(248, 250, 252, 0.9) 100%);
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: var(--gradient-hero);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animated Background Particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--accent-primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-secondary);
}

/* ============================================================
   Layout
   ============================================================ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    position: relative;
    z-index: 1;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--space-xl) 0;
}

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
    background: var(--bg-navbar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.navbar-brand .icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    list-style: none;
}

.navbar-nav a {
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    font-weight: 500;
}

.navbar-nav a:hover,
.navbar-nav a.active {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================================
   Cards (Glassmorphism)
   ============================================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ============================================================
   Stats Cards
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--gradient-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.1;
}

.stat-card.primary::after {
    background: var(--accent-primary);
}

.stat-card.success::after {
    background: var(--accent-success);
}

.stat-card.warning::after {
    background: var(--accent-warning);
}

.stat-card.danger::after {
    background: var(--accent-danger);
}

.stat-card.info::after {
    background: var(--accent-info);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: var(--space-xs);
}

.stat-value.primary {
    color: var(--accent-primary-light);
}

.stat-value.success {
    color: var(--accent-success);
}

.stat-value.warning {
    color: var(--accent-warning);
}

.stat-value.danger {
    color: var(--accent-danger);
}

.stat-value.info {
    color: var(--accent-info);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-icon {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    font-size: 1.5rem;
    opacity: 0.6;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
    transform: translateY(-1px);
    color: white;
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
    color: white;
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.btn-ghost:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.btn-google {
    background: #fff;
    color: #333;
    font-weight: 600;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.btn-google:hover {
    background: #f8f8f8;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    color: #333;
}

.btn-google img {
    width: 22px;
    height: 22px;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.05rem;
}

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-accent);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   Badges / Tags
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ============================================================
   Alerts / Notifications
   ============================================================ */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    border: 1px solid;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

/* ============================================================
   Login / Hero Section
   ============================================================ */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 85vh;
    text-align: center;
    padding: var(--space-2xl);
}

.hero-card {
    max-width: 520px;
    width: 100%;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2xl);
    line-height: 1.7;
}

.hero-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    display: block;
}

/* ============================================================
   Page Headers
   ============================================================ */
.page-header {
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.page-description {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ============================================================
   Grid Layouts
   ============================================================ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-lg);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    max-width: 550px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ============================================================
   Admin Sidebar Layout
   ============================================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    padding: var(--space-lg) 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 99999;
    overflow-y: auto;
    transition: width var(--transition-base);
}

.admin-sidebar.collapsed {
    width: 70px;
    overflow: hidden;
}

.admin-sidebar.collapsed .sidebar-header {
    flex-direction: column;
    padding: var(--space-md) 0;
    margin-bottom: var(--space-lg);
}

.admin-sidebar.collapsed .sidebar-brand span:not(.icon),
.admin-sidebar.collapsed .sidebar-section-title,
.admin-sidebar.collapsed .sidebar-nav a span:not(.nav-badge):not(.nav-icon) {
    display: none;
    opacity: 0;
}

.admin-sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 0.625rem 0;
}

.admin-sidebar.collapsed .sidebar-nav .nav-badge {
    position: absolute;
    top: 5px;
    right: 15px;
    font-size: 0.6rem;
    padding: 2px 5px;
}

.sidebar-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 10px;
    position: absolute;
    top: 15px;
    right: 15px;
    transition: all var(--transition-fast);
    z-index: 1000;
    /* Ensure it's above everything in the sidebar */
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
}

.admin-sidebar.collapsed .sidebar-toggle-btn {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    top: 15px;
}

.admin-sidebar.collapsed .sidebar-brand {
    padding: 0;
    justify-content: center;
    margin-top: 40px;
    /* Space for the toggle button */
}

.sidebar-brand {
    padding: 0 var(--space-lg);
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: margin var(--transition-base);
}

.sidebar-brand .icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: var(--space-lg);
}

.sidebar-section-title {
    padding: 0 var(--space-lg);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    white-space: nowrap;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.625rem var(--space-lg);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    position: relative;
    white-space: nowrap;
}

.sidebar-nav a:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-primary-light);
    border-left-color: var(--accent-primary);
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-nav .nav-badge {
    margin-left: auto;
    background: var(--accent-danger);
    color: white;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
}

.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: var(--space-xl);
    position: relative;
    z-index: 10;
    transition: margin-left var(--transition-base);
}

.admin-main.expanded {
    margin-left: 70px;
}

/* ============================================================
   Schedule Grid (Teacher Timetable)
   ============================================================ */
.schedule-grid {
    display: table !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
    background: var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.schedule-grid thead,
.schedule-grid tbody {
    display: table-row-group;
}

.schedule-grid tr {
    display: table-row;
}

.schedule-grid th,
.schedule-grid td {
    display: table-cell;
}

.schedule-header {
    background: rgba(99, 102, 241, 0.15);
    padding: var(--space-md);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent-primary-light);
    text-align: center;
}

.schedule-time {
    background: rgba(99, 102, 241, 0.08);
    padding: var(--space-md);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    width: 100px;
}

.schedule-cell {
    background: var(--bg-secondary);
    padding: var(--space-sm);
    min-height: 60px;
    vertical-align: top;
    transition: background var(--transition-fast);
}

.schedule-cell:hover {
    background: rgba(99, 102, 241, 0.05);
}

.schedule-booking {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-sm);
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
    margin-bottom: 2px;
    text-align: center;
}

.schedule-booking .course-name {
    font-weight: 600;
    color: var(--accent-primary-light);
}

.schedule-booking .teacher-name {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-glass);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: var(--space-xl) auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   Utilities
   ============================================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--accent-success);
}

.text-danger {
    color: var(--accent-danger);
}

.text-warning {
    color: var(--accent-warning);
}

.mt-sm {
    margin-top: var(--space-sm);
}

.mt-md {
    margin-top: var(--space-md);
}

.mt-lg {
    margin-top: var(--space-lg);
}

.mt-xl {
    margin-top: var(--space-xl);
}

.mb-sm {
    margin-bottom: var(--space-sm);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

.mb-xl {
    margin-bottom: var(--space-xl);
}

.d-flex {
    display: flex;
}

.d-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-sm {
    gap: var(--space-sm);
}

.gap-md {
    gap: var(--space-md);
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hidden {
    display: none !important;
}

/* ============================================================
   Toast Notification
   ============================================================ */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: toastIn 0.3s ease;
    font-size: 0.9rem;
}

.toast.success {
    border-left: 3px solid var(--accent-success);
}

.toast.error {
    border-left: 3px solid var(--accent-danger);
}

.toast.info {
    border-left: 3px solid var(--accent-info);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-md);
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        display: none;
    }

    .admin-main {
        margin-left: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .card {
        padding: var(--space-lg);
    }

    .schedule-grid {
        display: table;
        overflow-x: auto;
    }

    .navbar-nav {
        display: none;
    }
}