/* base.css - Global styles and design tokens
 *
 * MERGED CORE (ala-suite). Brand tokens + shared chrome are byte-identical
 * across both source apps; kept here at dayplanner's 12px sizing (the look we
 * standardised on). Domain grid colours differ by surface and DO NOT share
 * names: ops day-grid tokens keep their canonical --color-* names (matched to
 * PowerApps WorkHours RGB); the planning grid's palette is namespaced --plan-*
 * so the two never collide. layout.css references rewrite to --plan-* when it
 * ports under .area-plan in Phase 2.
 */

:root {
  --color-primary:        #3860B2;
  --color-primary-dark:   #195975;
  --color-primary-light:  #EBF0FA;
  --color-text:           #1A1A2E;
  --color-text-muted:     #5A6A85;
  --color-border:         #C8D5EC;
  --color-bg:             #F4F6FB;
  --color-surface:        #FFFFFF;
  --color-shadow:         rgba(56, 96, 178, 0.12);

  /* ── Ops day-grid: WorkHours availability bands (PowerApps WorkHours RGB) ── */
  --color-unavailable:    rgb(230, 184, 175);  /* red-ish — no availability */
  --color-avail-online:   rgb(193, 240, 200);  /* light green */
  --color-avail-offsite:  rgb(218, 233, 248);  /* light blue */
  --color-avail-ip:       #FFFFFF;             /* in-person */
  --color-hold:           rgb(255, 255, 0);    /* yellow */

  /* ── Ops day-grid: appointment cards (PowerApps Schedule.pa.yaml htmlAppt.Fill) ── */
  --appt-importance-high: #FFA500;             /* orange — importance high */
  --appt-cover:           rgba(127, 255, 0, 0.6); /* chartreuse — title contains "Cover" */
  --appt-sick:            #7FFF00;             /* chartreuse — title contains "Sick" */
  --appt-online:          rgba(232, 244, 217, 0.6); /* pale green */
  --appt-nsn:             #FFA07A;             /* light salmon — title contains "NSN" */
  --appt-unavailable:     #FCB6B6;             /* light red — VacationCalendar rows (and legacy title=="Unavailable") */
  --appt-dnb:             #F26B6B;             /* red — DNB (Do Not Book) blocks */
  --appt-default:         rgba(255, 255, 255, 0.85);
  --appt-search-match:    #FF4500;             /* OrangeRed border */

  /* ── Planning grid palette (namespaced; consumed by .area-plan view CSS) ──
   * available → booked pairs, plus session-type fills. Same hues the scheduler
   * shipped, renamed off the generic --color-* names to avoid colliding with
   * the ops day-grid tokens above. */
  --plan-unavailable:     #F0C4BC;   /* red-ish — no availability */
  --plan-avail-ip:        #FFFFFF;   /* in-person available */
  --plan-booked-ip:       #94A3B8;   /* in-person booked */
  --plan-avail-online:    #A5F3FC;   /* online available (light cyan) */
  --plan-booked-online:   #4ADE80;   /* online booked (medium green) */
  --plan-meeting:         #93C5FD;   /* meeting (blue) */
  --plan-admin:           #C4B5FD;   /* admin (purple) */
  --plan-not-available:   #D1D5DB;   /* Not Available (cool gray) */
  --plan-hold:            #FEF08A;   /* hold / partial */
  --plan-booked-partial:  #DBEAFE;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: 150ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 12px;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */

.screen { display: none; }
.screen.active { display: flex; flex-direction: column; height: 100%; }

/* ── Loading overlay ─────────────────────────────────────────────────────── */

#loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
#loading-overlay.hidden { display: none; }

.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-message { color: var(--color-text-muted); font-size: 11px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

button { cursor: pointer; font-family: inherit; font-size: 12px; border: none; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: background var(--transition);
}
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}
.btn-secondary:hover { background: var(--color-primary-light); }

.btn-text {
  background: none;
  color: var(--color-text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  text-decoration: none;
}
.btn-text:hover { color: var(--color-text); }

.btn-icon {
  background: none;
  color: var(--color-text-muted);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background var(--transition);
}
.btn-icon:hover { background: var(--color-primary-light); color: var(--color-primary); }
.btn-icon:disabled,
.btn-icon[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  background: none;
  color: var(--color-text-muted);
}

.btn-sm { padding: 5px 12px; font-size: 10px; }
.btn-primary.btn-sm { padding: 6px 14px; }

.btn-danger         { color: #DC2626; }
.btn-danger:hover   { color: #991B1B; }

/* ── Teacher filter chips (planning chrome) ──────────────────────────────── */

.filter-chip {
  background: var(--color-surface);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-chip.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ── Toast ───────────────────────────────────────────────────────────────── */

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 11px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error   { background: #DC2626; }
.toast.toast-success { background: #16A34A; }

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

.hidden { display: none !important; }

/* Visually hide an element while keeping it accessible to screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Login screen ────────────────────────────────────────────────────────── */

#screen-login {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
  min-width: 320px;
}

.login-logo { width: 80px; height: auto; }
.login-title { font-size: 20px; font-weight: 700; color: var(--color-text); }
.login-subtitle { font-size: 11px; color: var(--color-text-muted); text-align: center; }
