/* ========================================================
   KRAMIQ CRM – Theme System
   Themes: dark | light | cyber | emerald
   ======================================================== */

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

/* ── CSS Custom Properties (Dark Theme – Default) ── */
:root,
[data-theme="dark"] {
    --bg-base:         #0b1120;
    --bg-surface:      #111827;
    --bg-card:         #1a2236;
    --bg-card-hover:   #1f2a42;
    --bg-input:        #0f1929;
    --border-color:    #1e3053;
    --border-subtle:   #1a2845;

    --accent:          #10b981;
    --accent-dim:      #059669;
    --accent-glow:     rgba(16,185,129,0.18);
    --accent-2:        #0ea5e9;

    --text-primary:    #f1f5f9;
    --text-secondary:  #94a3b8;
    --text-muted:      #4b6280;
    --text-inverse:    #0b1120;

    --sidebar-bg:      #0d1526;
    --sidebar-width:   240px;
    --topbar-bg:       rgba(11,17,32,0.95);
    --topbar-height:   64px;

    --badge-confirmed:  #10b981;
    --badge-completed:  #3b82f6;
    --badge-waiting:    #f59e0b;
    --badge-cancelled:  #ef4444;
    --badge-noshow:     #8b5cf6;

    --shadow-card:     0 4px 24px rgba(0,0,0,0.35);
    --shadow-md:       0 8px 32px rgba(0,0,0,0.45);
    --radius-card:     14px;
    --radius-btn:      8px;
    --radius-badge:    6px;

    --chart-line:      #10b981;
    --chart-fill:      rgba(16,185,129,0.12);
    --chart-grid:      rgba(148,163,184,0.08);

    --scrollbar-thumb: #1e3053;
    --scrollbar-track: #0b1120;
}

/* ── Light Theme ── */
[data-theme="light"] {
    --bg-base:         #f0f4f8;
    --bg-surface:      #ffffff;
    --bg-card:         #ffffff;
    --bg-card-hover:   #f8fafc;
    --bg-input:        #f1f5f9;
    --border-color:    #e2e8f0;
    --border-subtle:   #f1f5f9;

    --accent:          #0d9488;
    --accent-dim:      #0f766e;
    --accent-glow:     rgba(13,148,136,0.12);
    --accent-2:        #0284c7;

    --text-primary:    #1e293b;
    --text-secondary:  #475569;
    --text-muted:      #94a3b8;
    --text-inverse:    #ffffff;

    --sidebar-bg:      #1e293b;
    --topbar-bg:       rgba(255,255,255,0.95);

    --badge-confirmed:  #059669;
    --badge-completed:  #2563eb;
    --badge-waiting:    #d97706;
    --badge-cancelled:  #dc2626;
    --badge-noshow:     #7c3aed;

    --shadow-card:     0 2px 12px rgba(0,0,0,0.08);
    --shadow-md:       0 6px 24px rgba(0,0,0,0.12);

    --chart-line:      #0d9488;
    --chart-fill:      rgba(13,148,136,0.10);
    --chart-grid:      rgba(0,0,0,0.06);

    --scrollbar-thumb: #cbd5e1;
    --scrollbar-track: #f1f5f9;
}

/* ── Midnight Cyber Theme ── */
[data-theme="cyber"] {
    --bg-base:         #04050f;
    --bg-surface:      #090b1a;
    --bg-card:         #0d1128;
    --bg-card-hover:   #111630;
    --bg-input:        #060814;
    --border-color:    #1a1f4b;
    --border-subtle:   #131840;

    --accent:          #a855f7;
    --accent-dim:      #9333ea;
    --accent-glow:     rgba(168,85,247,0.20);
    --accent-2:        #22d3ee;

    --text-primary:    #e2e8f0;
    --text-secondary:  #a5b4fc;
    --text-muted:      #3d4b7c;
    --text-inverse:    #04050f;

    --sidebar-bg:      #060814;
    --topbar-bg:       rgba(4,5,15,0.96);

    --badge-confirmed:  #a855f7;
    --badge-completed:  #22d3ee;
    --badge-waiting:    #fbbf24;
    --badge-cancelled:  #f87171;
    --badge-noshow:     #6366f1;

    --shadow-card:     0 4px 28px rgba(168,85,247,0.15);
    --shadow-md:       0 8px 40px rgba(168,85,247,0.2);

    --chart-line:      #a855f7;
    --chart-fill:      rgba(168,85,247,0.10);
    --chart-grid:      rgba(165,180,252,0.07);

    --scrollbar-thumb: #1a1f4b;
    --scrollbar-track: #04050f;
}

/* ── Medical Emerald (Mint Light) Theme ── */
[data-theme="emerald"] {
    --bg-base:         #eefaf4;
    --bg-surface:      #ffffff;
    --bg-card:         #ffffff;
    --bg-card-hover:   #f0faf4;
    --bg-input:        #f3faf6;
    --border-color:    #c2ecd9;
    --border-subtle:   #e1f7ec;

    --accent:          #059669;
    --accent-dim:      #047857;
    --accent-glow:     rgba(5,150,105,0.12);
    --accent-2:        #0284c7;

    --text-primary:    #064e3b;
    --text-secondary:  #0f766e;
    --text-muted:      #34d399;
    --text-inverse:    #ffffff;

    --sidebar-bg:      #064e3b;
    --topbar-bg:       rgba(255,255,255,0.95);

    --badge-confirmed:  #059669;
    --badge-completed:  #2563eb;
    --badge-waiting:    #d97706;
    --badge-cancelled:  #dc2626;
    --badge-noshow:     #7c3aed;

    --shadow-card:     0 2px 14px rgba(5,150,105,0.06);
    --shadow-md:       0 6px 24px rgba(5,150,105,0.10);

    --chart-line:      #059669;
    --chart-fill:      rgba(5,150,105,0.08);
    --chart-grid:      rgba(0,0,0,0.05);

    --scrollbar-thumb: #a7f3d0;
    --scrollbar-track: #eefaf4;
}

/* ══════════════════════════════════════════════════════
   GLOBAL BASE
   ══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }

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

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s ease;
}

.sidebar-logo:hover {
    opacity: 0.85;
}

.sidebar-logo .logo-icon {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800;
    color: var(--text-inverse);
    flex-shrink: 0;
    box-shadow: 0 0 16px var(--accent-glow);
}

.sidebar-logo .logo-text h2 {
    font-size: 16px; font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
    letter-spacing: -0.3px;
}

.sidebar-logo .logo-text span {
    font-size: 10px; font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.nav-section-label {
    font-size: 10px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 8px 12px 4px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px; font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    position: relative;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
}

.nav-item.has-submenu { cursor: pointer; }

.nav-submenu-item {
    display: flex; align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px; font-weight: 500;
    transition: all 0.2s ease;
}

.nav-submenu-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-submenu-item.active {
    color: var(--accent);
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: var(--text-inverse);
    font-size: 10px; font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
    line-height: 1.4;
}

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid var(--border-color);
}

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ── SIDEBAR COLLAPSED (DESKTOP) ── */
@media (min-width: 901px) {
    .sidebar.collapsed { width: 70px; }
    .sidebar.collapsed .logo-text,
    .sidebar.collapsed .nav-section-label,
    .sidebar.collapsed .nav-item .nav-text,
    .sidebar.collapsed .submenu-chevron,
    .sidebar.collapsed .nav-submenu {
        display: none !important;
    }
    .sidebar.collapsed .sidebar-logo {
        padding: 20px 10px 16px;
        justify-content: center;
    }
    .sidebar.collapsed .nav-item {
        justify-content: center;
        padding: 12px;
    }
    .sidebar.collapsed .nav-item svg { margin: 0; }
    .sidebar.collapsed + .main-content { margin-left: 70px; }
}

/* ── TOPBAR ── */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center;
    padding: 0 24px;
    position: sticky; top: 0;
    z-index: 90;
    backdrop-filter: blur(12px);
    gap: 16px;
}

.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.topbar-title p { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-btn {
    width: 36px; height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary);
    transition: all 0.2s;
    position: relative;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); }
.topbar-btn .notif-dot {
    position: absolute; top: 6px; right: 7px;
    width: 7px; height: 7px;
    background: var(--accent); border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.doctor-pill {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 30px; cursor: pointer;
    transition: border-color 0.2s;
}
.doctor-pill:hover { border-color: var(--accent); }
.doctor-pill .avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: white;
}
.doctor-pill .name { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* ── PAGE CONTENT ── */
.page-content { padding: 24px; flex: 1; }

/* ══════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--border-subtle); }

.card-header {
    padding: 18px 20px 0;
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.card-body { padding: 18px 20px; }

/* ── STAT CARDS ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: all 0.25s ease;
    cursor: default;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.stat-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
    font-size: 20px;
}
.stat-icon.teal  { background: rgba(16,185,129,0.15); color: #10b981; }
.stat-icon.blue  { background: rgba(59,130,246,0.15); color: #3b82f6; }
.stat-icon.amber { background: rgba(245,158,11,0.15); color: #f59e0b; }
.stat-icon.purple{ background: rgba(139,92,246,0.15); color: #8b5cf6; }

.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--text-primary); line-height: 1.1; margin: 4px 0; letter-spacing: -1px; }
.stat-sub { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.stat-up { color: #10b981; font-weight: 600; }
.stat-down { color: #ef4444; font-weight: 600; }

/* ══════════════════════════════════════════════════════
   STATUS BADGES
   ══════════════════════════════════════════════════════ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-badge);
    font-size: 11px; font-weight: 600;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.badge-confirmed  { background: rgba(16,185,129,0.15);  color: var(--badge-confirmed); }
.badge-completed  { background: rgba(59,130,246,0.15);  color: var(--badge-completed); }
.badge-waiting    { background: rgba(245,158,11,0.15);  color: var(--badge-waiting); }
.badge-cancelled  { background: rgba(239,68,68,0.15);   color: var(--badge-cancelled); }
.badge-no-show,
.badge-no_show    { background: rgba(139,92,246,0.15);  color: var(--badge-noshow); }

/* ══════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
    padding: 10px 14px;
    font-size: 11px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border-color);
    text-align: left; white-space: nowrap;
}

.data-table td {
    padding: 13px 14px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.patient-name { font-weight: 600; color: var(--text-primary); }
.patient-phone { font-size: 12px; color: var(--text-muted); }
.appt-time { font-size: 13px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-btn);
    font-size: 13px; font-weight: 600;
    cursor: pointer; border: none;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-dim); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
    background: transparent; color: var(--text-secondary);
    padding: 6px 10px;
}
.btn-ghost:hover { color: var(--accent); background: var(--accent-glow); }

.btn-danger { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 7px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ══════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ══════════════════════════════════════════════════════
/* ── MODAL OVERLAY ── */
.modal-overlay {
    display: none; /* hidden by default */
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open {
    display: flex; /* show when open */
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
    padding: 20px;
    box-shadow: var(--shadow-card);
}

   MODALS
   ══════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%; max-width: 500px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-md);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-close {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--bg-card); border: none;
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.modal-close:hover { background: var(--accent-glow); color: var(--accent); }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ══════════════════════════════════════════════════════
   QUICK ACTIONS PANEL
   ══════════════════════════════════════════════════════ */
.quick-action-btn {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    font-family: inherit;
    text-decoration: none;
}
.quick-action-btn:last-child { margin-bottom: 0; }
.quick-action-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateX(2px);
}
.quick-action-btn .qa-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
}
.qa-teal  { background: rgba(16,185,129,0.15); color: #10b981; }
.qa-blue  { background: rgba(14,165,233,0.15); color: #0ea5e9; }
.qa-green { background: rgba(34,197,94,0.15);  color: #22c55e; }
.qa-amber { background: rgba(245,158,11,0.15); color: #f59e0b; }
.qa-purple{ background: rgba(139,92,246,0.15); color: #8b5cf6; }

.quick-action-btn .qa-label { font-size: 13px; font-weight: 600; }
.quick-action-btn .qa-desc  { font-size: 11px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════
   CHART AREA
   ══════════════════════════════════════════════════════ */
.chart-container { position: relative; width: 100%; }

/* ══════════════════════════════════════════════════════
   ALERTS / TOAST
   ══════════════════════════════════════════════════════ */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px; font-weight: 500;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px;
}
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #10b981; }
.alert-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #ef4444; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #f59e0b; }

.toast-stack {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 13px; font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    min-width: 280px;
    display: flex; align-items: center; gap: 10px;
    animation: slideInRight 0.3s ease;
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid #ef4444; }

/* ══════════════════════════════════════════════════════
   THEME SWITCHER
   ══════════════════════════════════════════════════════ */
.theme-switcher {
    display: flex; flex-direction: column; gap: 8px;
}
.theme-option {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer; transition: all 0.2s;
    background: var(--bg-input);
}
.theme-option:hover { border-color: var(--accent); }
.theme-option.active { border-color: var(--accent); background: var(--accent-glow); }
.theme-swatch {
    width: 32px; height: 32px; border-radius: 8px;
    flex-shrink: 0;
}
.swatch-dark    { background: linear-gradient(135deg, #0b1120 50%, #10b981 50%); }
.swatch-light   { background: linear-gradient(135deg, #ffffff 50%, #0d9488 50%); border: 1px solid #e2e8f0; }
.swatch-cyber   { background: linear-gradient(135deg, #04050f 50%, #a855f7 50%); }
.swatch-emerald { background: linear-gradient(135deg, #eefaf4 50%, #059669 50%); border: 1px solid #c2ecd9; }
.theme-option-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.theme-option-sub   { font-size: 11px; color: var(--text-muted); }

/* ══════════════════════════════════════════════════════
   QR CODE MODAL
   ══════════════════════════════════════════════════════ */
.qr-display {
    background: white;
    border-radius: 16px;
    padding: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 16px auto;
    width: 240px; height: 240px;
}
.qr-display img { width: 200px; height: 200px; }

/* ══════════════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════════════ */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.page-header h2 { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.page-header p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════════
   GRID UTILITIES
   ══════════════════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-dash { display: grid; grid-template-columns: 1fr 280px; gap: 20px; }

/* ══════════════════════════════════════════════════════
   SEARCH & FILTER BAR
   ══════════════════════════════════════════════════════ */
.filter-bar {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-bar .form-control { max-width: 200px; padding: 8px 12px; font-size: 13px; }
.search-input { position: relative; }
.search-input input { padding-left: 36px; }
.search-input .search-icon {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
    width: 15px; height: 15px;
}

/* ══════════════════════════════════════════════════════
   PATIENT PROFILE
   ══════════════════════════════════════════════════════ */
.patient-avatar-lg {
    width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 800; color: white;
    margin-right: 16px; flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════ */
.empty-state {
    text-align: center; padding: 60px 20px;
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-state p  { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ══════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-base);
    padding: 20px;
    position: relative; overflow: hidden;
}

.login-bg-glow {
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    top: -150px; right: -100px;
    pointer-events: none;
}
.login-bg-glow-2 {
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14,165,233,0.1) 0%, transparent 70%);
    bottom: -100px; left: -80px;
    pointer-events: none;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-md);
    position: relative; z-index: 1;
}

.login-logo {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 28px;
}
.login-logo-icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 800; color: white;
    box-shadow: 0 0 24px var(--accent-glow);
}
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.login-logo span { font-size: 11px; color: var(--text-muted); display: block; }

.login-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

/* ══════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.fade-in { animation: fadeIn 0.4s ease forwards; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}
.live-indicator {
    width: 8px; height: 8px; background: #10b981; border-radius: 50%;
    animation: pulse-dot 1.8s ease-in-out infinite;
    display: inline-block;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-dash { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: 260px; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
    .grid-2 { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
}
@media (max-width: 600px) {
    .stat-grid { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .form-row-3 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .page-header div { width: 100%; }
    .page-header .btn { width: 100%; justify-content: center; }
    
    .topbar-title p { display: none; }
    .topbar-title h1 { font-size: 15px; }
    
    .doctor-pill .name { display: none; }
    .doctor-pill { padding: 6px; }
    
    #global-clinic-filter { width: 130px !important; }
}


/* Doctor Dropdown Menu */
.doctor-dropdown-container {
    position: relative;
}
.doctor-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    width: 200px;
    z-index: 1000;
    overflow: hidden;
    padding: 6px 0;
    animation: fadeIn 0.2s ease;
}
.doctor-dropdown-menu.show {
    display: block;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.dropdown-item:hover {
    background: var(--bg-card-hover);
    color: var(--accent);
}

/* Global Switch Toggle CSS */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  margin: 0;
}
.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color, #ccc);
  transition: .2s;
  border-radius: 22px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--accent, #10b981);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

.disabled-link {
  pointer-events: none !important;
  opacity: 0.55 !important;
  cursor: not-allowed !important;
}
