/* ─── Theme variables ────────────────────────────────────── */

:root {
    --color-bg:           #F4F6FA;
    --color-surface:      #FFFFFF;
    --color-text:         #0f172a;
    --color-text-muted:   #64748B;
    --color-text-faint:   #94A3B8;
    --color-border-row:   rgba(0, 0, 0, 0.05);
    --color-booking-hover: rgba(91, 79, 233, 0.04);
    --fc-col-header-bg:   #F8FAFC;
    --fc-col-border:      #E2E8F0;
    --fc-grid-line:       #CBD5E1;
    --fc-today-bg:        #EEF2FF;
    --fc-today-text:      #5C6BC0;
    --fc-title-color:     #1E293B;
    --fc-time-label:      #94A3B8;
    --fc-day-label:       #64748B;
}

[data-theme="dark"] {
    --color-bg:           #0A0F1E;
    --color-surface:      #131929;
    --color-text:         #E2E8F0;
    --color-text-muted:   #94A3B8;
    --color-text-faint:   #475569;
    --color-border-row:   rgba(255, 255, 255, 0.05);
    --color-booking-hover: rgba(99, 102, 241, 0.08);
    --fc-col-header-bg:   #131929;
    --fc-col-border:      #1E293B;
    --fc-grid-line:       #1E293B;
    --fc-today-bg:        rgba(99, 102, 241, 0.12);
    --fc-today-text:      #818CF8;
    --fc-title-color:     #E2E8F0;
    --fc-time-label:      #475569;
    --fc-day-label:       #64748B;
}

/* ─── FullCalendar: Outlook-style overrides ──────────────── */

.fc {
    font-family: 'Plus Jakarta Sans', 'Helvetica Neue', Arial, sans-serif !important;
}

/* Toolbar spacing from tab strip */
.fc .fc-toolbar {
    margin-top: 16px !important;
    gap: 12px !important;
    padding: 0 12px !important;
}

/* Space between buttons within each toolbar chunk */
.fc .fc-toolbar-chunk {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

/* Remove FullCalendar's built-in negative margin that collapses button groups */
.fc .fc-button-group {
    gap: 4px !important;
}
.fc .fc-button-group .fc-button {
    border-radius: 6px !important;
    margin: 0 !important;
}

/* Toolbar buttons to match MudBlazor style */
.fc .fc-button {
    background: #5C6BC0 !important;
    border-color: #5C6BC0 !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 700 !important;
    font-size: 0.78rem !important;
    border-radius: 6px !important;
    text-transform: none !important;
    box-shadow: none !important;
}

.fc .fc-button:hover {
    background: #3F51B5 !important;
    border-color: #3F51B5 !important;
}

.fc .fc-button-active,
.fc .fc-button:active {
    background: #3949AB !important;
    border-color: #3949AB !important;
}

.fc .fc-toolbar-title {
    font-size: 1rem !important;
    font-weight: 800 !important;
    color: var(--fc-title-color) !important;
}

/* Day headers */
.fc .fc-col-header-cell {
    background: var(--fc-col-header-bg);
    border-color: var(--fc-col-border) !important;
}

.fc .fc-col-header-cell-cushion {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: var(--fc-day-label) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 4px !important;
    text-decoration: none !important;
}

/* Today column highlight */
.fc .fc-day-today {
    background: var(--fc-today-bg) !important;
}

.fc .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion {
    color: var(--fc-today-text) !important;
}

/* Time labels */
.fc .fc-timegrid-slot-label-cushion {
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    color: var(--fc-time-label) !important;
}

/* Grid lines */
.fc .fc-timegrid-slot {
    border-color: var(--fc-grid-line) !important;
}

.fc .fc-timegrid-slot-minor {
    border-color: transparent !important;
}

/* Dark mode: FullCalendar internal backgrounds */
[data-theme="dark"] .fc-view-harness,
[data-theme="dark"] .fc .fc-timegrid-body,
[data-theme="dark"] .fc .fc-scrollgrid,
[data-theme="dark"] .fc td,
[data-theme="dark"] .fc th {
    background-color: var(--fc-col-header-bg) !important;
    border-color: var(--fc-col-border) !important;
}

[data-theme="dark"] .fc .fc-col-header-cell {
    background: #0D1220 !important;
}

/* Event blocks */
.fc-event {
    border-radius: 5px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    border-width: 0 0 0 3px !important;
    border-style: solid !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
    cursor: default !important;
}

/* Now indicator */
.fc .fc-timegrid-now-indicator-line {
    border-color: #EF4444 !important;
    border-width: 2px !important;
}

.fc .fc-timegrid-now-indicator-arrow {
    border-top-color: #EF4444 !important;
}

html, body {
    font-family: 'Plus Jakarta Sans', 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    margin: 0;
    padding: 0;
    transition: background 0.2s ease;
}

/* ─── MudTextField autofill: animation trigger for JS detection ── */
/* Fires only when the browser autofills an input — no cancel rule to avoid */
/* triggering animations on all inputs during page load (causes blinking).  */

@keyframes autofillStart { from {} to {} }

input:-webkit-autofill {
    animation-name: autofillStart;
    animation-duration: 1ms;
}

/* ─── Auth pages ─────────────────────────────────────────── */

.auth-bg {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0e1a 0%, #1e1b4b 45%, #1a3a5c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px !important;
    padding: 40px !important;
    background: #ffffff !important;
}

.auth-logo-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #5B4FE9, #7C6FF7);
    border-radius: 14px;
    font-size: 24px;
    margin-bottom: 16px;
    box-shadow: 0 4px 14px rgba(91, 79, 233, 0.4);
}

.auth-brand-title {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 800 !important;
    font-size: 1.5rem !important;
    color: #0f0e1a !important;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: #64748B !important;
    font-size: 0.9rem !important;
    margin-top: 2px;
}

/* ─── Page headers ───────────────────────────────────────── */

.page-header {
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.page-header-title {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 800 !important;
    font-size: 1.65rem !important;
    color: var(--color-text) !important;
    letter-spacing: -0.02em !important;
}

.page-header-sub {
    color: var(--color-text-muted) !important;
    font-size: 0.875rem !important;
    margin-top: 2px;
}

/* ─── Stat cards ─────────────────────────────────────────── */

.stat-card {
    border-radius: 12px;
    overflow: hidden;
}

.stat-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.stat-icon-wrap--violet { background: rgba(91, 79, 233, 0.1); color: #5B4FE9; }
.stat-icon-wrap--sky    { background: rgba(14, 165, 233, 0.1); color: #0EA5E9; }
.stat-icon-wrap--green  { background: rgba(16, 185, 129, 0.1); color: #10B981; }

.stat-number {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: 800 !important;
    font-size: 2rem !important;
    line-height: 1 !important;
    color: var(--color-text) !important;
}

.stat-label {
    font-size: 0.8rem !important;
    color: var(--color-text-muted) !important;
    margin-top: 4px;
}

/* ─── Key card ───────────────────────────────────────────── */

.key-display {
    font-family: 'Courier New', 'Lucida Console', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: #6366F1;
    background: rgba(99, 102, 241, 0.08);
    border: 1.5px dashed rgba(99, 102, 241, 0.3);
    padding: 14px 24px;
    border-radius: 10px;
    display: inline-block;
    margin: 12px 0;
}

/* ─── Top navigation links (AppBar) ─────────────────────── */

.top-nav-link {
    display: inline-flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none !important;
    padding: 6px 13px;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
    line-height: 1;
}

.top-nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.top-nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

/* ─── Upcoming bookings list ─────────────────────────────── */

.booking-row {
    padding: 10px 8px;
    border-radius: 8px;
    border-bottom: 1px solid var(--color-border-row);
    transition: background 0.15s ease;
}

.booking-row:last-child { border-bottom: none; }

.booking-row:hover { background: var(--color-booking-hover); }

.booking-time {
    font-weight: 700;
    color: var(--color-text);
    font-size: 0.95rem;
}

.booking-phone {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 1px;
}

/* ─── Utility ────────────────────────────────────────────── */

.letter-spacing-2 { letter-spacing: 0.15em; }

.font-nunito { font-family: 'Plus Jakarta Sans', sans-serif !important; }

/* ─── Blazor error UI ────────────────────────────────────── */

#blazor-error-ui {
    background: #ffc107;
    bottom: 0;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, .2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ─── FullCalendar: custom event tile with menu button ──── */

.fc-event-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 4px;
    overflow: hidden;
}

.fc-event-title-text {
    font-size: 0.72rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.fc-event-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.7;
    flex-shrink: 0;
    color: inherit;
    pointer-events: auto;
}

.fc-event-menu-btn:hover {
    opacity: 1;
}

/* ── Client Page ─────────────────────────────────────────── */

.client-page {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    min-height: 100vh;
    background: #fafafa;
}

.client-header {
    background: linear-gradient(135deg, #5C6BC0, #26A69A);
    color: white;
    padding: 20px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.client-header-label {
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.client-header-tutor {
    font-size: 20px;
    font-weight: 700;
    margin-top: 2px;
}

.client-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.client-header-name {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
}

.client-lang-switcher {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 2px;
}

.client-lang-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.client-lang-btn.active {
    background: rgba(255,255,255,0.25);
    color: white;
}

.client-content {
    max-width: 960px;
    margin: 16px auto;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-content-left,
.client-content-right {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 768px) {
    .client-header {
        padding: 20px 32px;
    }

    .client-header-tutor {
        font-size: 24px;
    }

    .client-content {
        flex-direction: row;
        padding: 0 16px;
        margin: 20px auto;
        gap: 16px;
    }

    .client-content-left,
    .client-content-right {
        flex: 1;
    }
}

.client-section-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.client-section-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #5C6BC0;
    font-weight: 600;
    margin-bottom: 12px;
}

.client-date {
    font-weight: 700;
    font-size: 15px;
    color: #1a1a1a;
}

.client-time {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-top: 1px;
}

/* Next Booking */
.client-next-booking-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Calendar */
.client-calendar-container {
    margin-bottom: 12px;
}

.client-calendar-container .fc {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.client-calendar-container .fc-daygrid-day-number {
    font-weight: 500;
    color: #333;
}

.client-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #E8EAF6;
    border-radius: 50%;
    margin-right: 4px;
}

/* Slot List */
.client-slot-list {
    margin-top: 12px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.client-slot-list-header {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.client-slot-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
}

.client-slot-time {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Bookings */
.client-bookings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.client-booking-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: background 0.15s;
}

.client-booking-item--past {
    opacity: 0.6;
}

.client-booking-highlight {
    background: #EEF2FF;
    border-color: #818CF8;
}

.client-booking-status {
    font-size: 13px;
    margin-top: 3px;
    font-weight: 600;
}

.client-booking-status--confirmed {
    color: #059669;
}

.client-booking-status--past {
    color: #666;
}

.client-booking-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.client-past-toggle {
    text-align: center;
    margin-top: 12px;
}

/* Verify */
.client-verify {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #fafafa;
}

/* Error */
.client-error {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
}
