/* ============================================================
   SmileCare Dental Clinic — Premium Admin Theme v5
   Modern glassmorphism + gradient design
   ============================================================ */

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

/* ── Design Tokens ── */
:root {
    /* Brand */
    --brand-1:       #2563eb;
    --brand-2:       #7c3aed;
    --brand-3:       #0ea5e9;
    --grad-main:     linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --grad-sidebar:  linear-gradient(180deg, #0f0c29 0%, #1a1040 50%, #0f172a 100%);
    --grad-success:  linear-gradient(135deg, #059669, #10b981);
    --grad-warning:  linear-gradient(135deg, #d97706, #f59e0b);
    --grad-danger:   linear-gradient(135deg, #dc2626, #ef4444);
    --grad-info:     linear-gradient(135deg, #0284c7, #38bdf8);
    --grad-purple:   linear-gradient(135deg, #7c3aed, #a78bfa);
    --grad-teal:     linear-gradient(135deg, #0891b2, #06b6d4);

    /* Semantic */
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --primary-light: #dbeafe;
    --primary-bg:    #eff6ff;
    --success:       #059669;
    --success-bg:    #d1fae5;
    --danger:        #dc2626;
    --danger-bg:     #fee2e2;
    --warning:       #d97706;
    --warning-bg:    #fef3c7;
    --info:          #0284c7;
    --info-bg:       #e0f2fe;
    --purple:        #7c3aed;
    --purple-bg:     #ede9fe;

    /* Layout */
    --sidebar-w:     260px;
    --topbar-h:      64px;

    /* Surface */
    --bg-body:       #f0f4ff;
    --bg-card:       #ffffff;
    --bg-card-2:     #f8faff;
    --text:          #0f172a;
    --text-muted:    #64748b;
    --text-light:    #94a3b8;
    --border:        #e2e8f0;
    --border-light:  #f1f5f9;

    /* Effects */
    --radius:        14px;
    --radius-sm:     8px;
    --radius-lg:     20px;
    --radius-full:   999px;
    --shadow-xs:     0 1px 3px rgba(37,99,235,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow:        0 4px 16px rgba(37,99,235,.08), 0 2px 6px rgba(0,0,0,.04);
    --shadow-md:     0 8px 32px rgba(37,99,235,.12), 0 4px 12px rgba(0,0,0,.06);
    --shadow-lg:     0 20px 60px rgba(37,99,235,.16), 0 8px 24px rgba(0,0,0,.08);
    --shadow-glow:   0 0 0 3px rgba(37,99,235,.18);

    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;

    /* Transition */
    --ease:  cubic-bezier(.4,0,.2,1);
    --fast:  .15s;
    --med:   .25s;
    --slow:  .35s;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-body);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body.app-body { display: flex; min-height: 100vh; }

/* CRITICAL: form tag invisible to flex */
body.app-body > form {
    display: contents;
}
@supports not (display: contents) {
    body.app-body > form { display: flex; flex: 1; min-height: 100vh; width: 100%; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7d2e8; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ══════════════════════════════════════════
   SIDEBAR — Premium gradient design
   ══════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--grad-sidebar);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--med) var(--ease),
                width var(--med) var(--ease);
    flex-shrink: 0;
    border-right: 1px solid rgba(255,255,255,.04);
}

/* Sidebar collapsed */
body.sidebar-collapsed .sidebar { width: 68px; }
body.sidebar-collapsed .sidebar .clinic-info,
body.sidebar-collapsed .sidebar .nav-menu span,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .sidebar-footer-user > div,
body.sidebar-collapsed .sidebar .sidebar-close-btn { display: none !important; }
body.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: 11px 0; margin: 1px 10px; }
body.sidebar-collapsed .sidebar .nav-link i { font-size: 18px; width: auto; }
body.sidebar-collapsed .main-wrapper { margin-left: 68px; }

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 1040;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ── Sidebar Header ── */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
    min-height: 74px;
}

.clinic-logo {
    width: 44px; height: 44px;
    background: var(--grad-main);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(37,99,235,.45);
}

.clinic-info { flex: 1; min-width: 0; }
.clinic-info h3 {
    color: #f1f5f9;
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -.2px;
}
.clinic-info small { color: rgba(148,163,184,.7); font-size: 11px; }

.sidebar-close-btn {
    background: none; border: none;
    color: rgba(148,163,184,.6);
    cursor: pointer; font-size: 16px;
    padding: 4px; border-radius: 6px;
    display: none; flex-shrink: 0;
    transition: color var(--fast);
}
.sidebar-close-btn:hover { color: #f1f5f9; }

/* ── Nav Menu ── */
.nav-menu { list-style: none; padding: 10px 0; flex: 1; }

.nav-section {
    padding: 16px 18px 5px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(148,163,184,.4);
    white-space: nowrap;
}

.nav-item { margin: 1px 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(148,163,184,.85);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--fast), color var(--fast), transform var(--fast);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.nav-link i {
    width: 20px;
    font-size: 15px;
    text-align: center;
    flex-shrink: 0;
    opacity: .75;
    transition: opacity var(--fast);
}

.nav-link:hover {
    background: rgba(255,255,255,.07);
    color: #f1f5f9;
    transform: translateX(2px);
}
.nav-link:hover i { opacity: 1; }

.nav-link.active {
    background: linear-gradient(135deg, rgba(37,99,235,.85), rgba(124,58,237,.7));
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.nav-link.active i { opacity: 1; }
.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: #fff;
    border-radius: 0 4px 4px 0;
    opacity: .7;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    background: rgba(0,0,0,.2);
}

.sidebar-footer-user {
    display: flex; align-items: center; gap: 9px;
    flex: 1; min-width: 0;
}

.sidebar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37,99,235,.4);
}

.sidebar-username {
    font-size: 12.5px; font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-role { font-size: 10.5px; color: rgba(148,163,184,.6); }

.sidebar-logout-btn {
    color: rgba(248,113,113,.8);
    font-size: 16px;
    text-decoration: none;
    padding: 7px;
    border-radius: var(--radius-sm);
    transition: background var(--fast), color var(--fast);
    flex-shrink: 0;
}
.sidebar-logout-btn:hover { background: rgba(220,38,38,.2); color: #fca5a5; }

/* ══════════════════════════════════════════
   MAIN WRAPPER
   ══════════════════════════════════════════ */
.main-wrapper {
    margin-left: var(--sidebar-w);
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
    transition: margin-left var(--med) var(--ease);
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226,232,240,.8);
    display: flex;
    align-items: center;
    padding: 0 22px;
    gap: 14px;
    position: sticky; top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(226,232,240,.5), 0 4px 20px rgba(37,99,235,.04);
}

.sidebar-toggle {
    background: none; border: none;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--fast), color var(--fast);
    flex-shrink: 0;
}
.sidebar-toggle:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.topbar-title { flex: 1; min-width: 0; }
.topbar-title h4 {
    font-size: 16px; font-weight: 700;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 8px;
}
.topbar-title h4 i { color: var(--primary); font-size: 16px; }

.topbar-right {
    display: flex; align-items: center;
    gap: 12px; flex-shrink: 0;
}

.date-display {
    font-size: 12.5px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 5px;
    background: var(--bg-card-2);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    white-space: nowrap;
}
.date-display i { color: var(--primary); }

.btn-logout {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: var(--danger);
    padding: 7px 16px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 700;
    display: flex; align-items: center; gap: 6px;
    border: 1px solid #fca5a5;
    transition: all var(--fast);
    white-space: nowrap;
}
.btn-logout:hover {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    box-shadow: 0 4px 12px rgba(220,38,38,.2);
    transform: translateY(-1px);
}

/* ── Page Content ── */
.page-content {
    padding: 22px 24px;
    flex: 1;
    width: 100%;
    min-width: 0;
}

/* ══════════════════════════════════════════
   CARDS — Premium glass style
   ══════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(226,232,240,.7);
    margin-bottom: 20px;
    width: 100%;
    overflow: hidden;
    transition: box-shadow var(--med), transform var(--med);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    background: linear-gradient(180deg, #fdfdff 0%, var(--bg-card) 100%);
    min-height: 56px;
}

.card-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text);
    display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--primary); font-size: 15px; }

.card-body { padding: 20px; }

/* ── Stat Cards ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(6,1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow-xs);
    border: 1px solid rgba(226,232,240,.6);
    display: flex; align-items: center; gap: 14px;
    transition: transform var(--med), box-shadow var(--med);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Colour variants */
.stat-card.blue::before   { background: var(--grad-main); }
.stat-card.green::before  { background: var(--grad-success); }
.stat-card.orange::before { background: var(--grad-warning); }
.stat-card.red::before    { background: var(--grad-danger); }
.stat-card.teal::before   { background: var(--grad-teal); }
.stat-card.purple::before { background: var(--grad-purple); }

/* Auto-assign top stripe by child order */
.stats-grid .stat-card:nth-child(1)::before { background: var(--grad-main); }
.stats-grid .stat-card:nth-child(2)::before { background: var(--grad-warning); }
.stats-grid .stat-card:nth-child(3)::before { background: var(--grad-success); }
.stats-grid .stat-card:nth-child(4)::before { background: var(--grad-teal); }
.stats-grid .stat-card:nth-child(5)::before { background: var(--grad-purple); }
.stats-grid .stat-card:nth-child(6)::before { background: var(--grad-danger); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-bg); color: var(--primary); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red    { background: var(--danger-bg);  color: var(--danger); }
.stat-icon.teal   { background: var(--info-bg);    color: var(--info); }
.stat-icon.purple { background: var(--purple-bg);  color: var(--purple); }

.stat-info { min-width: 0; }
.stat-info h3 {
    font-size: 24px; font-weight: 800; line-height: 1;
    color: var(--text);
    letter-spacing: -.5px;
}
.stat-info p {
    font-size: 11.5px; color: var(--text-muted);
    margin-top: 4px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ══════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px,1fr));
    gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

label {
    font-size: 12.5px; font-weight: 600;
    color: #374151; letter-spacing: .01em;
}
label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color var(--fast), box-shadow var(--fast);
    appearance: auto;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background: #fff;
}
.form-control:hover:not(:focus) { border-color: #a5b4fc; }
.form-control[readonly],
.form-control:disabled { background: var(--bg-card-2); color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 72px; }

.field-error { font-size: 11px; color: var(--danger); font-weight: 500; }

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    font-family: var(--font);
    border: none; cursor: pointer;
    text-decoration: none;
    transition: all var(--fast);
    white-space: nowrap;
    line-height: 1.4;
    vertical-align: middle;
    position: relative;
    overflow: hidden;
}
.btn:hover   { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active  { transform: translateY(0) scale(.97); }

.btn-primary {
    background: var(--grad-main);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(37,99,235,.5); }

.btn-success {
    background: var(--grad-success);
    color: #fff;
    box-shadow: 0 4px 14px rgba(5,150,105,.3);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(5,150,105,.45); }

.btn-danger {
    background: var(--grad-danger);
    color: #fff;
    box-shadow: 0 4px 14px rgba(220,38,38,.3);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(220,38,38,.45); }

.btn-warning {
    background: var(--grad-warning);
    color: #fff;
    box-shadow: 0 4px 14px rgba(217,119,6,.3);
}
.btn-warning:hover { box-shadow: 0 6px 20px rgba(217,119,6,.45); }

.btn-info {
    background: var(--grad-info);
    color: #fff;
    box-shadow: 0 4px 14px rgba(2,132,199,.3);
}
.btn-info:hover { box-shadow: 0 6px 20px rgba(2,132,199,.45); }

.btn-secondary {
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: #e2e8f0; box-shadow: var(--shadow); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

.btn-sm  { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg  { padding: 11px 24px; font-size: 15px; border-radius: 10px; }
.btn-icon{ padding: 7px 10px; }
.w-100   { width: 100%; }

/* Ripple effect */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.2);
    opacity: 0;
    transition: opacity var(--fast);
    border-radius: inherit;
}
.btn:active::after { opacity: 1; }

/* ══════════════════════════════════════════
   GRIDVIEW — Premium table
   ══════════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.data-table,
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

.data-table thead th {
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    background: linear-gradient(180deg, #f8faff 0%, #f1f5f9 100%);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky; top: 0;
}

.data-table thead th:first-child { border-radius: 0; }

.data-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
    font-size: 13px;
    transition: background var(--fast);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:nth-child(odd)  td { background: #fff; }
.data-table tbody tr:nth-child(even) td { background: #fafbff; }
.data-table tbody tr:hover td { background: #eff6ff !important; }

/* Action buttons */
.action-cell { display: flex; gap: 5px; align-items: center; flex-wrap: nowrap; }

/* Pager */
.data-table tr td[colspan] { border: none; }
.data-table tr td[colspan] table { display: inline-flex; gap: 4px; margin: 10px 16px; }
.data-table tr td[colspan] table td { padding: 0; border: none; background: transparent !important; }
.data-table tr td[colspan] table td a,
.data-table tr td[colspan] table td span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    font-size: 12.5px; font-weight: 700;
    text-decoration: none;
    border: 1.5px solid var(--border);
    color: var(--text);
    transition: all var(--fast);
    background: #fff;
}
.data-table tr td[colspan] table td a:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}
.data-table tr td[colspan] table td span {
    background: var(--grad-main);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(37,99,235,.35);
}

/* ══════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════ */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px; font-weight: 700;
    letter-spacing: .03em;
    white-space: nowrap;
    gap: 4px;
}
.badge-scheduled  { background: #dbeafe; color: #1d4ed8; }
.badge-confirmed  { background: #d1fae5; color: #065f46; }
.badge-completed  { background: #d1fae5; color: #059669; }
.badge-cancelled  { background: #fee2e2; color: var(--danger); }
.badge-noshow     { background: #fef3c7; color: var(--warning); }
.badge-default    { background: #f1f5f9; color: var(--text-muted); }

/* ══════════════════════════════════════════
   SEARCH BAR
   ══════════════════════════════════════════ */
.search-bar {
    display: flex; align-items: center;
    gap: 8px; flex-wrap: wrap; flex: 1;
}

.search-input-wrap { position: relative; flex: 1; min-width: 180px; }
.search-input-wrap i {
    position: absolute; left: 11px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); font-size: 13px;
    pointer-events: none;
}
.search-input-wrap .form-control {
    padding-left: 34px;
    background: #fff;
    border-color: var(--border);
}

/* ══════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════ */
.page-header {
    display: flex; align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.page-header h2 {
    font-size: 20px; font-weight: 800;
    background: var(--grad-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.breadcrumb { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.breadcrumb a { color: var(--primary); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }

/* ══════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════ */
.toast-container {
    position: fixed; top: 76px; right: 20px;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}

.toast {
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 18px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    display: flex; align-items: center; gap: 10px;
    min-width: 260px; max-width: 360px;
    animation: toastIn .3s var(--ease) forwards;
    pointer-events: all;
    font-size: 13px; font-weight: 500;
}
.toast.success { border-left-color: var(--success); }
.toast.success i { color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.error   i { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning i { color: var(--warning); }
.toast i { font-size: 17px; color: var(--primary); flex-shrink: 0; }

@keyframes toastIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);   opacity: 1; }
}

/* ══════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════ */
.alert-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #6ee7b7;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: #065f46;
    font-size: 13px; font-weight: 500;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px;
}
.alert-error {
    background: linear-gradient(135deg, #fff1f2, #fee2e2);
    border: 1px solid #fca5a5;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: #991b1b;
    font-size: 13px; font-weight: 500;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px;
}

/* ══════════════════════════════════════════
   INFO GRID
   ══════════════════════════════════════════ */
.info-grid {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 9px 16px;
    font-size: 13.5px;
}
.info-label { font-weight: 600; color: var(--text-muted); }
.info-value { color: var(--text); word-break: break-word; }

/* ══════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════ */
.empty-state {
    text-align: center; padding: 52px 20px; color: var(--text-muted);
}
.empty-state i {
    font-size: 48px; display: block; margin-bottom: 14px;
    background: var(--grad-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: .35;
}
.empty-state h4 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
.empty-state p  { font-size: 13px; }

/* ══════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════ */
.fw-bold  { font-weight: 700; }
.fw-600   { font-weight: 600; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-right   { text-align: right !important; }
.text-center  { text-align: center !important; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 14px; }
.mt-1 { margin-top: 6px; }  .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 6px; }.mb-2 { margin-bottom: 12px; }.mb-3 { margin-bottom: 20px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Gradient text helper ── */
.gradient-text {
    background: var(--grad-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ══════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════ */
body.login-body {
    background: linear-gradient(135deg, #0f0c29 0%, #1a1040 40%, #24243e 100%);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    position: relative; overflow: hidden;
}

/* Background blobs */
body.login-body::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(37,99,235,.25) 0%, transparent 70%);
    top: -200px; left: -200px;
    border-radius: 50%;
    pointer-events: none;
}
body.login-body::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(124,58,237,.2) 0%, transparent 70%);
    bottom: -150px; right: -150px;
    border-radius: 50%;
    pointer-events: none;
}

.login-wrapper { width: 100%; max-width: 420px; padding: 24px; position: relative; z-index: 1; }

.login-card {
    background: rgba(255,255,255,.97);
    border-radius: 24px;
    padding: 40px 36px;
    box-shadow: 0 30px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon {
    width: 72px; height: 72px;
    background: var(--grad-main);
    border-radius: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 32px; color: #fff;
    margin-bottom: 14px;
    box-shadow: 0 10px 30px rgba(37,99,235,.45);
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%,100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
.login-logo h2 { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.4px; }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.error-message {
    background: linear-gradient(135deg, #fff1f2, #fee2e2);
    border: 1px solid #fca5a5;
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: #991b1b;
    font-size: 13px; font-weight: 500;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}

/* ══════════════════════════════════════════
   STATS GRID RESPONSIVE
   ══════════════════════════════════════════ */
.stats-grid { grid-template-columns: repeat(6,1fr); }
@media (max-width:1400px) { .stats-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 860px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr 1fr; } }

/* ══════════════════════════════════════════
   SIDEBAR COLLAPSED TOOLTIP
   ══════════════════════════════════════════ */
body.sidebar-collapsed .nav-link { position: relative; }
body.sidebar-collapsed .nav-link:hover::after {
    content: attr(title);
    position: absolute;
    left: 76px; top: 50%;
    transform: translateY(-50%);
    background: rgba(15,12,41,.95);
    color: #f1f5f9;
    padding: 5px 11px;
    border-radius: 7px;
    white-space: nowrap;
    font-size: 12px; font-weight: 600;
    z-index: 2000;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    border: 1px solid rgba(255,255,255,.1);
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width:1200px) {
    .stats-grid { grid-template-columns: repeat(3,1fr); }
}
@media (max-width:992px) {
    :root { --sidebar-w: 240px; }
    .topbar { padding: 0 16px; }
    .page-content { padding: 16px; }
    .date-display .date-text { display: none; }
}
@media (max-width:768px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.35); }
    .sidebar-close-btn { display: flex !important; }
    .sidebar-overlay.active { display: block; }
    .main-wrapper { margin-left: 0 !important; }
    .topbar { padding: 0 14px; gap: 8px; }
    .page-content { padding: 12px; }
    .stats-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
    .stat-card { padding: 12px; gap: 10px; }
    .stat-icon { width: 42px; height: 42px; font-size: 17px; }
    .stat-info h3 { font-size: 20px; }
    .logout-text { display: none; }
    .btn-logout { padding: 7px 10px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.full { grid-column: 1; }
    .data-table { min-width: 580px; }
    .data-table thead th, .data-table td { padding: 8px 10px; font-size: 12px; }
}
@media (max-width:480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { flex-direction: column; text-align: center; gap: 8px; }
    .page-content { padding: 10px; }
    .card-header { flex-direction: column; align-items: flex-start; }
}

/* ══════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════ */
@media print {
    .sidebar, .topbar, .no-print,
    .sidebar-overlay, .toast-container { display: none !important; }
    .main-wrapper { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    .page-content { padding: 0; }
}

/* ══════════════════════════════════════════
   PREMIUM INNER PAGE EXTRAS
   ══════════════════════════════════════════ */

/* Card with gradient top accent */
.card-accent-blue   { border-top: 3px solid transparent; border-image: linear-gradient(90deg,#2563eb,#7c3aed) 1; }
.card-accent-green  { border-top: 3px solid transparent; border-image: linear-gradient(90deg,#059669,#10b981) 1; }
.card-accent-orange { border-top: 3px solid transparent; border-image: linear-gradient(90deg,#d97706,#f59e0b) 1; }

/* Premium stat card with glow on hover */
.stat-card:hover .stat-icon.blue   { box-shadow: 0 0 0 8px rgba(37,99,235,.1); }
.stat-card:hover .stat-icon.green  { box-shadow: 0 0 0 8px rgba(5,150,105,.1); }
.stat-card:hover .stat-icon.orange { box-shadow: 0 0 0 8px rgba(217,119,6,.1); }
.stat-card:hover .stat-icon.red    { box-shadow: 0 0 0 8px rgba(220,38,38,.1); }
.stat-card:hover .stat-icon.teal   { box-shadow: 0 0 0 8px rgba(8,145,178,.1); }
.stat-card:hover .stat-icon.purple { box-shadow: 0 0 0 8px rgba(124,58,237,.1); }

/* Premium form control focus ring */
.form-control:focus { background: #fafcff; }

/* Premium table row hover with left accent */
.data-table tbody tr:hover td:first-child {
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

/* Page header gradient title */
.page-header h2 {
    background: linear-gradient(135deg,#2563eb,#7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Premium card hover lift */
.card:hover { transform: translateY(-1px); }

/* Topbar breadcrumb path indicator */
.topbar-title h4::before {
    content: '';
    display: inline-block;
    width: 4px; height: 18px;
    background: linear-gradient(180deg,#2563eb,#7c3aed);
    border-radius: 4px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Premium scrollable sidebar active indicator */
.nav-link.active {
    position: relative;
}

/* Input group premium */
.input-group {
    display: flex;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--border);
    transition: border-color var(--fast), box-shadow var(--fast);
}
.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}
.input-group .form-control {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0;
    flex: 1;
}
.input-group .input-group-btn {
    background: var(--primary-bg);
    border: none;
    border-left: 1.5px solid var(--border);
    padding: 0 14px;
    color: var(--primary);
    font-size: 14px;
    cursor: pointer;
    transition: background var(--fast);
    display: flex; align-items: center;
}
.input-group .input-group-btn:hover { background: var(--primary-light); }

/* Badge with dot */
.badge::before {
    display: none;
}
.badge-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.badge-scheduled .badge-dot  { background: #2563eb; }
.badge-completed .badge-dot  { background: #059669; }
.badge-cancelled .badge-dot  { background: #dc2626; }
.badge-noshow    .badge-dot  { background: #d97706; }
.badge-confirmed .badge-dot  { background: #065f46; }

/* Premium section title */
.section-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.section-title .title-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    background: var(--grad-main);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: #fff;
}

/* Patient avatar gradient */
.patient-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 800; color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
    flex-shrink: 0;
}

/* Doctor avatar gradient */
.doctor-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; color: #fff;
    box-shadow: 0 4px 12px rgba(124,58,237,.3);
    flex-shrink: 0;
}

/* Premium info card row */
.info-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--fast);
}
.info-row:hover { background: var(--bg-card-2); }
.info-row-icon {
    width: 30px; height: 30px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.info-row-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.info-row-value { font-size: 13.5px; font-weight: 600; color: var(--text); }

/* Appointment timeline dot */
.timeline-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(37,99,235,.2);
}

/* Glass card variant */
.card-glass {
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.5);
}

/* Premium divider */
.divider-gradient {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 20px 0;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f4ff 25%, #e8eeff 50%, #f0f4ff 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Pulse badge for live/new items */
.badge-pulse {
    position: relative;
}
.badge-pulse::after {
    content: '';
    position: absolute;
    top: 50%; right: -4px;
    transform: translateY(-50%);
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%,100% { transform: translateY(-50%) scale(1); opacity: 1; }
    50%      { transform: translateY(-50%) scale(1.4); opacity: .6; }
}

/* Floating action button */
.fab {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 54px; height: 54px;
    border-radius: 50%;
    background: var(--grad-main);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    box-shadow: 0 8px 24px rgba(37,99,235,.45);
    text-decoration: none;
    z-index: 500;
    transition: transform .2s, box-shadow .2s;
}
.fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 32px rgba(37,99,235,.55);
}

/* Topbar notification dot */
.notif-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--danger);
    position: absolute;
    top: 8px; right: 8px;
    border: 2px solid #fff;
    animation: pulse 2s infinite;
}
