/* ============================================================
   Aadya Eye Care — Design tokens
   ============================================================ */
:root {
    --teal-deep:    #0B3D3A;
    --teal-mid:     #2E7D6B;
    --paper:        #F7F5F0;
    --paper-raised: #FFFFFF;
    --ink:          #1A1A1A;
    --ink-soft:     #5C6660;
    --gold:         #C89B3C;
    --gold-soft:    #E9D9B0;
    --red:          #B85C4A;
    --red-soft:     #F3E0DB;
    --line:         #DEDAD0;

    --font-display: 'Fraunces', serif;
    --font-body:    'Inter', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --shadow-card: 0 1px 2px rgba(11,61,58,0.04), 0 8px 24px rgba(11,61,58,0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
    outline: 2px solid var(--teal-mid);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   Top navigation
   ============================================================ */
.topbar {
    background: var(--teal-deep);
    color: #FFF;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-mark { color: var(--gold); display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; letter-spacing: 0.2px; }
.brand-sub { font-size: 0.72rem; color: rgba(255,255,255,0.6); letter-spacing: 0.6px; text-transform: uppercase; }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    color: rgba(255,255,255,0.78);
    transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255,255,255,0.08); color: #FFF; }
.nav a.active { background: var(--gold); color: var(--teal-deep); font-weight: 600; }

/* ============================================================
   Page shell
   ============================================================ */
.page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}
.footer {
    text-align: center;
    padding: 24px;
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.page-head { margin-bottom: 28px; }
.page-head h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--teal-deep);
}
.page-head p { color: var(--ink-soft); margin: 0; font-size: 0.95rem; }

/* ============================================================
   Cards & layout grid
   ============================================================ */
.card {
    background: var(--paper-raised);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 28px;
    border: 1px solid var(--line);
}
.card + .card { margin-top: 20px; }
.card h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin: 0 0 18px;
    color: var(--teal-deep);
    font-weight: 600;
}

.grid-2col { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 20px; align-items: start; }
@media (max-width: 880px) { .grid-2col { grid-template-columns: 1fr; } }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

input[type="text"], input[type="tel"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 11px 14px;
    font-size: 0.95rem;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--teal-mid);
    background: #FFF;
    outline: none;
}
input::placeholder { color: #A8A39A; }

.hint { font-size: 0.78rem; color: var(--ink-soft); margin-top: 4px; }
.hint.error { color: var(--red); font-weight: 500; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
    font-family: var(--font-body);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--teal-deep); color: #FFF; }
.btn-primary:hover { background: #0E4A46; }
.btn-primary:disabled { background: #BFC4C2; cursor: not-allowed; }
.btn-gold { background: var(--gold); color: var(--teal-deep); }
.btn-gold:hover { box-shadow: 0 4px 14px rgba(200,155,60,0.35); }
.btn-ghost { background: transparent; color: var(--teal-deep); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--teal-mid); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #EDD0C9; }

/* ============================================================
   Patient match banner
   ============================================================ */
.match-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.88rem;
}
.match-banner.found { background: #E7F2EE; border: 1px solid #BFE0D5; color: var(--teal-deep); }
.match-banner.new { background: var(--gold-soft); border: 1px solid #E0C580; color: #6B5316; }
.match-banner .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.match-banner.found .dot { background: var(--teal-mid); }
.match-banner.new .dot { background: var(--gold); }

/* ============================================================
   Slot picker — "lens" grid (signature element)
   ============================================================ */
.slot-section h3 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 18px 0 10px;
}
.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
}
.slot {
    position: relative;
    padding: 12px 8px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--line);
    background: var(--paper-raised);
    font-family: var(--font-mono);
    font-size: 0.83rem;
    color: var(--teal-deep);
    text-align: center;
    cursor: pointer;
    transition: all 0.12s;
    overflow: hidden;
}
.slot::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: calc(var(--radius-md) - 4px);
    border: 1px solid transparent;
    transition: border-color 0.12s;
}
.slot:hover:not(.is-booked) { border-color: var(--teal-mid); transform: translateY(-1px); }
.slot:hover:not(.is-booked)::before { border-color: rgba(46,125,107,0.25); }
.slot.is-selected { background: var(--gold); border-color: var(--gold); color: var(--teal-deep); font-weight: 600; }
.slot.is-selected::before { border-color: rgba(255,255,255,0.5); }
.slot.is-booked {
    background: #EFEDE7;
    border-color: #EFEDE7;
    color: #B5AFA4;
    cursor: not-allowed;
    text-decoration: line-through;
}
.slot-empty {
    grid-column: 1 / -1;
    padding: 24px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 0.88rem;
    background: var(--paper);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line);
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
    text-align: left;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ink-soft);
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}
tbody td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(11,61,58,0.025); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
}
.badge-booked { background: #E7F2EE; color: var(--teal-mid); }
.badge-completed { background: #E2EDE2; color: #3E7B3E; }
.badge-cancelled { background: var(--red-soft); color: var(--red); }

.mono { font-family: var(--font-mono); font-size: 0.85rem; }
.muted { color: var(--ink-soft); }
.row-actions { display: flex; gap: 6px; }

/* ============================================================
   Date filter bar
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.filter-bar input[type="date"] { width: auto; }

/* ============================================================
   Toast
   ============================================================ */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--teal-deep);
    color: #FFF;
    padding: 13px 22px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 100;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }

/* ============================================================
   Modal (used for follow-up date entry)
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(11,61,58,0.35);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 80;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--paper-raised);
    border-radius: var(--radius-lg);
    padding: 26px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 24px 48px rgba(0,0,0,0.18);
}
.modal-box h3 { margin: 0 0 6px; font-family: var(--font-display); color: var(--teal-deep); font-size: 1.15rem; }
.modal-box p { margin: 0 0 16px; color: var(--ink-soft); font-size: 0.86rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ============================================================
   Empty states
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--ink-soft);
}
.empty-state svg { color: var(--line); margin-bottom: 12px; }
.empty-state p { margin: 0; font-size: 0.92rem; }

/* ============================================================
   Settings page specifics
   ============================================================ */
.hours-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.hours-row input[type="text"] { width: auto; }
.hours-row .to { color: var(--ink-soft); font-size: 0.85rem; }
.day-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    font-size: 0.82rem;
    cursor: pointer;
    user-select: none;
}
.day-toggle input { display: none; }
.day-toggle.off { background: var(--red-soft); border-color: #E0BBB1; color: var(--red); }
