/* ========================================
   THULASI — Premium SaaS Design System
   Inspired by Stripe / Linear / Notion
   ======================================== */

/* ===== DESIGN TOKENS ===== */
:root {
    --bg: #f9fafb;
    --bg-white: #ffffff;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-lighter: #e0e7ff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-white: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --border-focus: #a5b4fc;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --info: #3b82f6;
    --info-bg: #eff6ff;
    --info-text: #1e40af;
    --sidebar-width: 240px;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);
    --transition: all 0.15s ease;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-white: #1e293b;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-light: rgba(99,102,241,0.15);
    --primary-lighter: rgba(99,102,241,0.25);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --border-focus: #6366f1;
    --success-bg: rgba(16,185,129,0.15);
    --success-text: #34d399;
    --danger-bg: rgba(239,68,68,0.15);
    --danger-text: #f87171;
    --warning-bg: rgba(245,158,11,0.15);
    --warning-text: #fbbf24;
    --info-bg: rgba(59,130,246,0.15);
    --info-text: #60a5fa;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.4), 0 4px 6px rgba(0,0,0,0.3);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.5), 0 10px 10px rgba(0,0,0,0.3);
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-white: #1e293b;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-light: rgba(99,102,241,0.15);
    --primary-lighter: rgba(99,102,241,0.25);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #334155;
    --border-light: #1e293b;
    --border-focus: #6366f1;
    --success-bg: rgba(16,185,129,0.15);
    --success-text: #34d399;
    --danger-bg: rgba(239,68,68,0.15);
    --danger-text: #f87171;
    --warning-bg: rgba(245,158,11,0.15);
    --warning-text: #fbbf24;
    --info-bg: rgba(59,130,246,0.15);
    --info-text: #60a5fa;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.4), 0 4px 6px rgba(0,0,0,0.3);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.5), 0 10px 10px rgba(0,0,0,0.3);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.875rem;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-hover); }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 0.875rem;
    flex-shrink: 0;
}

.brand-info { min-width: 0; }
.sidebar-brand h2 { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }

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

.nav-section-label {
    font-size: 0.6875rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 12px 10px 6px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    color: var(--text-secondary);
    font-size: 0.8125rem; font-weight: 500;
    border-radius: var(--radius);
    transition: var(--transition);
    margin-bottom: 1px;
    text-decoration: none;
}
.nav-item:hover { background: var(--border-light); color: var(--text-primary); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; position: relative; }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.6; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer { padding: 10px; border-top: 1px solid var(--border-light); }
.logout-btn { color: var(--text-muted) !important; font-weight: 400 !important; }
.logout-btn:hover { color: var(--danger) !important; background: var(--danger-bg) !important; }

/* ===== TOP NAVBAR ===== */
.top-navbar {
    position: sticky; top: 0; z-index: 50;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    height: 56px;
    display: flex; align-items: center; justify-content: space-between;
}

.navbar-left { display: flex; align-items: center; gap: 16px; }
.navbar-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }
.navbar-breadcrumb { font-size: 0.75rem; color: var(--text-muted); }

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

.navbar-search { position: relative; }
.navbar-search input {
    width: 220px;
    padding: 6px 10px 6px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    background: var(--bg);
    color: var(--text-primary);
    transition: var(--transition);
}
.navbar-search input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); background: var(--bg-white); }
.navbar-search input::placeholder { color: var(--text-muted); }
.navbar-search-icon {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 14px; height: 14px; color: var(--text-muted); pointer-events: none;
}

.profile-dropdown { position: relative; cursor: pointer; }
.profile-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 600;
    transition: var(--transition);
}
.profile-avatar:hover { background: var(--primary-lighter); }

.profile-menu {
    position: absolute; top: calc(100% + 8px); right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    display: none; z-index: 200;
    overflow: hidden;
}
.profile-menu.open { display: block; }
.profile-menu-header { padding: 16px; border-bottom: 1px solid var(--border-light); }
.profile-menu-name { font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); }
.profile-menu-email { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.profile-menu-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px;
    font-size: 0.8125rem; color: var(--text-secondary);
    transition: var(--transition);
}
.profile-menu-item:hover { background: var(--bg); color: var(--text-primary); text-decoration: none; }
.profile-menu-item.danger { color: var(--danger); }
.profile-menu-item.danger:hover { background: var(--danger-bg); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }
.content-wrapper { max-width: 1200px; margin: 0 auto; padding: 32px; }

/* ===== AUTH LAYOUT ===== */
.auth-layout {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    padding: 24px;
}
.auth-container { width: 100%; max-width: 400px; }
.auth-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-icon { font-size: 2rem; margin-bottom: 12px; }
.auth-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.025em; }
.auth-header p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 4px; }
.auth-form .form-group { margin-bottom: 16px; }
.auth-form label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="tel"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: var(--transition);
}
.auth-form input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.auth-form input::placeholder { color: var(--text-muted); }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.8125rem; color: var(--text-secondary); }
.auth-footer a { font-weight: 500; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.025em; }
.page-subtitle { color: var(--text-secondary); font-size: 0.875rem; margin-top: 4px; }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.card-header h2 { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border-light); background: var(--bg); }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-focus); transform: translateY(-2px); }
.stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.stat-icon { font-size: 1.25rem; color: var(--text-muted); }
.stat-value { display: block; font-size: 2rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.03em; line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; display: block; }
.stat-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
    padding: 10px 16px; text-align: left;
    font-size: 0.6875rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    white-space: nowrap;
}
.table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8125rem; color: var(--text-primary);
    vertical-align: middle;
}
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.6875rem; font-weight: 500; line-height: 1.4;
}
.badge-active, .badge-present, .badge-paid, .badge-completed { background: var(--success-bg); color: var(--success-text); }
.badge-pending, .badge-partial { background: var(--warning-bg); color: var(--warning-text); }
.badge-inactive, .badge-absent, .badge-cancelled { background: var(--danger-bg); color: var(--danger-text); }
.badge-scheduled { background: var(--info-bg); color: var(--info-text); }
.badge-late { background: var(--warning-bg); color: var(--warning-text); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.8125rem; font-weight: 500;
    cursor: pointer; transition: var(--transition);
    white-space: nowrap; line-height: 1.5;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: var(--text-white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(79,70,229,0.2); }
.btn-primary:active { transform: translateY(0) scale(0.98); box-shadow: none; }
.btn-secondary { background: var(--bg-white); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--text-muted); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: var(--text-white); border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }
.btn-sm { padding: 4px 12px; font-size: 0.75rem; }
.btn-lg { padding: 12px 24px; font-size: 0.9375rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem; color: var(--text-primary);
    background: var(--bg-white); transition: var(--transition);
    font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-muted); }
.form-group input:disabled, .form-group select:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }
.form-group small { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.8125rem; color: var(--text-secondary); }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px;
    font-size: 0.8125rem; display: flex; align-items: flex-start; gap: 10px;
}
.alert-error { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #fde68a; }
.alert-info { background: var(--info-bg); color: var(--info-text); border: 1px solid #bfdbfe; }

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px; margin-top: 32px;
}
.action-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px; text-align: center;
    transition: var(--transition);
}
.action-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.action-icon { display: block; font-size: 1.5rem; margin-bottom: 12px; }
.action-label { font-weight: 500; color: var(--text-primary); font-size: 0.8125rem; }

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 16px; border-radius: var(--radius);
    color: white; font-size: 0.8125rem; font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    max-width: 360px;
    display: flex; align-items: center; gap: 8px;
    transition: all 0.3s ease;
}
.toast-icon { font-size: 0.875rem; flex-shrink: 0; }
.toast-icon { font-size: 0.875rem; flex-shrink: 0; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state-text { font-size: 0.9375rem; margin-bottom: 4px; }
.empty-state-sub { font-size: 0.8125rem; color: var(--text-muted); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 24px;
}
.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-xl); border: 1px solid var(--border);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-close {
    background: none; border: none; font-size: 1.25rem;
    cursor: pointer; color: var(--text-muted);
    padding: 4px; border-radius: var(--radius-sm); transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn {
    padding: 12px 16px; border: none; background: none;
    font-size: 0.8125rem; font-weight: 500; color: var(--text-muted);
    cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
    transition: var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== LIST CARDS ===== */
.list-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 16px;
    transition: var(--transition);
}
.list-card:hover { border-color: var(--border-focus); box-shadow: var(--shadow); }
.list-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8125rem; font-weight: 600; color: var(--primary);
    flex-shrink: 0; background: var(--primary-light);
}
.list-info { flex: 1; min-width: 0; }
.list-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.list-details { font-size: 0.75rem; color: var(--text-secondary); }
.list-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.list-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ===== TAGS ===== */
.tag {
    display: inline-flex; align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 0.6875rem; font-weight: 500;
    background: var(--primary-light); color: var(--primary);
}

/* ===== HAMBURGER ===== */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition);
}
.hamburger:hover { background: var(--bg); }
.hamburger svg { width: 22px; height: 22px; }

/* ===== SIDEBAR BACKDROP ===== */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar-backdrop.open { display: block; opacity: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .navbar-search { display: none; }
}

@media (max-width: 768px) {
    /* Hamburger visible */
    .hamburger { display: flex; align-items: center; justify-content: center; }

    /* Sidebar as slide-out drawer */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
        border-right: none;
        height: 100vh;
    }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }

    /* Main content fills full width */
    .main-content { margin-left: 0; }
    .app-layout { flex-direction: column; }
    .content-wrapper { padding: 16px; }

    /* Top navbar adjustments */
    .top-navbar { padding: 0 16px; height: 52px; }
    .navbar-title { font-size: 0.875rem; }

    /* Stats: 2-col */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.5rem; }

    /* Forms stack vertically */
    .form-row { flex-direction: column; gap: 0; }

    /* List cards stay horizontal but tighter */
    .list-card { padding: 14px; gap: 12px; }
    .list-avatar { width: 36px; height: 36px; font-size: 0.75rem; }
    .list-name { font-size: 0.8125rem; }
    .list-details { font-size: 0.6875rem; }
    .list-actions { flex-direction: column; gap: 6px; }
    .list-actions .btn { width: 100%; justify-content: center; }

    /* Page headers */
    .page-header-row { flex-direction: column; gap: 12px; }
    .page-header h1 { font-size: 1.25rem; }

    /* Quick actions: 2-col */
    .quick-actions { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .action-card { padding: 16px; }

    /* Tabs scrollable */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab-btn { padding: 10px 12px; font-size: 0.75rem; white-space: nowrap; }

    /* Profile dropdown aligns to right edge */
    .profile-menu { right: -8px; }

    /* Modal full-width on mobile */
    .modal { max-width: calc(100% - 32px); margin: 16px; }

    /* Table scroll */
    .table-container { margin: 0 -16px; padding: 0 16px; }

    /* Empty states */
    .empty-state { padding: 32px 16px; }
    .empty-state-icon { font-size: 2rem; }
}

@media (max-width: 480px) {
    /* Stats: 1-col */
    .stats-grid { grid-template-columns: 1fr; }

    /* Smaller text */
    .page-header h1 { font-size: 1.125rem; }
    .page-subtitle { font-size: 0.8125rem; }
    .card-header { padding: 14px 16px; }
    .card-body { padding: 16px; }
    .card-header h2 { font-size: 0.875rem; }

    /* Full-width primary buttons */
    .btn-primary { width: 100%; }

    /* Quick actions: 1-col */
    .quick-actions { grid-template-columns: 1fr; }

    /* List cards: stack vertically */
    .list-card { flex-direction: column; text-align: center; padding: 16px; }
    .list-actions { flex-direction: row; width: 100%; }
    .list-actions .btn { flex: 1; }

    /* Badges smaller */
    .badge { font-size: 0.625rem; padding: 1px 6px; }

    /* Toast full-width */
    .toast { max-width: calc(100% - 32px); }
}

/* ===== HTMX ===== */
.htmx-indicator { display: none; opacity: 0; transition: opacity 0.2s ease; }
.htmx-request .htmx-indicator { display: inline-flex; opacity: 1; }
.htmx-request.htmx-indicator { display: inline-flex; opacity: 1; }
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SKELETON LOADER ===== */
.skeleton {
    background: linear-gradient(90deg, var(--border-light) 25%, var(--border) 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-title { height: 20px; margin-bottom: 12px; width: 40%; }
.skeleton-card { height: 80px; margin-bottom: 8px; border-radius: var(--radius-lg); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }

/* ===== UTILITY ===== */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }

/* ===== REPORT LINKS ===== */
.report-links { display: flex; flex-direction: column; gap: 8px; }
.report-link {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem; font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-white);
    transition: var(--transition);
}
.report-link:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.report-link.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); font-weight: 600; }

/* ===== ATTENDANCE BAR ===== */
.attendance-bar {
    display: flex; height: 8px;
    border-radius: 9999px; overflow: hidden;
    background: var(--border-light);
}
.attendance-bar-segment { transition: width 0.3s ease; }

/* ===== DEMO BANNER ===== */
.demo-banner {
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 8px 16px;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 500;
    border-bottom: 1px solid #fde68a;
}
.demo-banner a { color: var(--warning-text); text-decoration: underline; font-weight: 600; }

/* ===== DEMO TOUR ===== */
.demo-tour-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000;
    padding: 24px;
}
.demo-tour-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
    text-align: center;
}
.demo-tour-card h4 { font-size: 1.125rem; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.demo-tour-card p { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.875rem; }
.demo-tour-actions { display: flex; gap: 12px; justify-content: center; }
.demo-tour-actions button {
    padding: 8px 20px;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--primary);
    background: var(--primary);
    color: white;
}
.demo-tour-actions button:hover { background: var(--primary-hover); }
.demo-tour-skip {
    background: transparent !important;
    border-color: var(--border) !important;
    color: var(--text-secondary) !important;
}
.demo-tour-skip:hover { background: var(--bg) !important; border-color: var(--text-muted) !important; }

/* Premium Plan Badges */
.plan-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 6px;
    margin-left: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    vertical-align: middle;
    position: relative;
    overflow: hidden;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.plan-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-20deg);
    animation: shine 3s infinite;
    z-index: -1;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

.plan-badge-basic {
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #eff6ff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border: 1px solid #60a5fa;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.plan-badge-pro {
    background: linear-gradient(135deg, #78350f, #f59e0b, #fbbf24);
    color: #fffbeb;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid #fcd34d;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.plan-badge-enterprise {
    background: linear-gradient(135deg, #4c1d95, #8b5cf6, #c4b5fd);
    color: #f5f3ff;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid #ddd6fe;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.plan-badge-premium {
    background: linear-gradient(135deg, #10b981, #059669, #047857);
    color: #ecfdf5;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid #34d399;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* PREIMIUM PRICING CARDS */
.pricing-container {
    padding: 2rem 0;
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    align-items: center;
}

.pricing-card {
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 2.5rem 2rem;
    position: relative;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pricing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.popular-card {
    border: 2px solid #3b82f6;
    transform: scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.15);
}
.popular-card:hover { transform: scale(1.05) translateY(-8px); }

.premium-card {
    border: 2px solid transparent;
    background: linear-gradient(var(--surface), var(--surface)) padding-box,
                linear-gradient(135deg, #10b981, #059669) border-box;
}

.popular-badge, .current-plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.current-plan-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.pricing-header {
    text-align: center;
    margin-bottom: 2rem;
}

.plan-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.plan-title-free { color: var(--text-secondary); }
.plan-title-basic { 
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.plan-title-pro { 
    background: linear-gradient(135deg, #d97706, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.plan-title-premium {
    background: linear-gradient(135deg, #059669, #34d399);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.plan-price {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.plan-price .currency {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.plan-price .amount {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.plan-price .period {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 1.5rem;
    margin-left: 0.25rem;
}

.pricing-features {
    flex-grow: 1;
    margin-bottom: 2rem;
}

.pricing-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pricing-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.check-icon {
    width: 20px;
    height: 20px;
    color: #10b981;
    flex-shrink: 0;
}

.pricing-action {
    display: flex;
    justify-content: center;
}

.pricing-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.outline-btn {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
}
.outline-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.primary-btn {
    background: var(--primary);
    border: 2px solid var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}
.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}


/* Gradient Pricing Buttons */
.btn-pricing {
    border: none !important;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 700;
    letter-spacing: 0.5px;
}

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

.btn-pricing-basic {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-pricing-pro {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-pricing-premium {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
