/* ==========================================================================
   Staff area (login + dashboard) — built on the same design tokens as the
   public site (../styles.css). No new colors/fonts introduced.
   ========================================================================== */

.staff-body {
  min-height: 100vh;
  background: var(--ivory-paper);
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-32);
  padding: var(--space-32);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.login-brand .brand-script { font-size: 2.4rem; color: var(--ink-emerald); }
.login-brand .brand-sub { font-size: 0.7rem; letter-spacing: 3px; color: var(--antique-gold); margin-top: 4px; }

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--ivory-paper);
  border: 1px solid var(--antique-gold);
  border-radius: 4px;
  padding: var(--space-32);
  box-shadow: 0 30px 60px -20px rgba(122, 44, 80, 0.2);
}
.login-card .panel-title {
  font-size: var(--size-h3);
  color: var(--ink-emerald);
  margin-bottom: var(--space-24);
}
.login-card .field { margin-bottom: var(--space-16); }
.login-card label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-emerald);
  margin-bottom: 6px;
}
.login-card input {
  font: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(122, 44, 80, 0.25);
  border-radius: 3px;
  background: var(--ivory-paper);
  color: var(--charcoal-ink);
}
.login-card input:focus-visible { outline: 2px solid var(--antique-gold); outline-offset: 1px; }
.login-error {
  min-height: 1.2em;
  color: var(--wine-accent);
  font-size: 0.85rem;
  margin: 0 0 var(--space-16);
}
.login-back {
  font-size: 0.85rem;
  color: var(--ink-emerald);
  opacity: 0.75;
}
.login-back:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Dashboard shell
   -------------------------------------------------------------------------- */

.dashboard-body { background: var(--petal-blush); }

/* Loading state shown while requireStaffAuth() + initial data fetch are in
   flight; body.dash-ready (added once boot() succeeds) swaps visibility. */
.dash-boot-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 100vh;
  color: var(--ink-emerald);
  font-family: var(--font-utility);
  font-size: 0.95rem;
}
.dash-boot-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(122, 44, 80, 0.2);
  border-top-color: var(--ink-emerald);
  border-radius: 50%;
  animation: dash-spin 0.7s linear infinite;
}
@keyframes dash-spin {
  to { transform: rotate(360deg); }
}
.dash-topbar,
.dash-main {
  display: none;
}
body.dash-ready .dash-boot-loading {
  display: none;
}
body.dash-ready .dash-topbar {
  display: flex;
}
body.dash-ready .dash-main {
  display: block;
}
@media (prefers-reduced-motion: reduce) {
  .dash-boot-spinner { animation: none; }
}

.dash-topbar {
  background: var(--ivory-paper);
  border-bottom: 1px solid rgba(205, 164, 92, 0.35);
  padding: var(--space-16) var(--space-32);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  flex-wrap: wrap;
}
.dash-brand { display: flex; flex-direction: column; line-height: 1; }
.dash-brand .brand-script { font-size: 1.6rem; color: var(--ink-emerald); }
.dash-brand .brand-sub { font-size: 0.6rem; letter-spacing: 2px; color: var(--antique-gold); margin-top: 3px; }
.dash-topbar-right { display: flex; align-items: center; gap: var(--space-16); }
.dash-staff-name {
  font-family: var(--font-utility);
  font-size: 0.85rem;
  color: var(--charcoal-ink);
  opacity: 0.75;
  text-transform: capitalize;
}

.dash-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-24) var(--space-32) var(--space-64);
}

/* Summary tiles */
.dash-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-16);
  margin-bottom: var(--space-24);
}
.summary-tile {
  background: var(--ivory-paper);
  border: 1px solid var(--antique-gold);
  border-radius: 4px;
  padding: var(--space-16) var(--space-24);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-num {
  font-family: var(--font-utility);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink-emerald);
}
.summary-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--charcoal-ink);
  opacity: 0.65;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-24);
}

.dash-panel,
.dash-calendar-col {
  background: var(--ivory-paper);
  border: 1px solid rgba(205, 164, 92, 0.35);
  border-radius: 4px;
  padding: var(--space-24);
}
.dash-panel { margin-bottom: var(--space-24); }
.dash-panel:last-child { margin-bottom: 0; }
.dash-panel h2,
.dash-panel-head h2 {
  font-size: 1.05rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink-emerald);
  margin-bottom: var(--space-16);
}
.dash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-16);
  flex-wrap: wrap;
  gap: var(--space-8);
}
.dash-panel-head h2 { margin-bottom: 0; }

/* Today's schedule list */
.today-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.today-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: var(--space-8);
  padding: 10px 0;
  border-bottom: 1px solid rgba(122, 44, 80, 0.1);
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font: inherit;
}
.today-item:hover { background: var(--petal-blush); }
.today-time { font-family: var(--font-utility); font-size: 0.85rem; color: var(--ink-emerald); }
.today-info { display: flex; flex-direction: column; }
.today-info .cust { font-weight: 600; color: var(--charcoal-ink); font-size: 0.92rem; }
.today-info .svc { font-size: 0.8rem; color: var(--charcoal-ink); opacity: 0.65; }

/* Status badges (shared) */
.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.status-confirmed { background: rgba(122, 44, 80, 0.12); color: var(--ink-emerald); }
.status-pending { background: rgba(205, 164, 92, 0.25); color: #7a5c1e; }
.status-cancelled { background: rgba(214, 51, 108, 0.12); color: var(--wine-accent); }
.status-completed { background: rgba(0, 0, 0, 0.08); color: var(--charcoal-ink); }

/* Search & filter */
.filter-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--space-16); }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filter-form input,
.filter-form select {
  font: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border: 1px solid rgba(122, 44, 80, 0.25);
  border-radius: 3px;
  background: var(--ivory-paper);
  color: var(--charcoal-ink);
  width: 100%;
}
.search-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border: 1px solid rgba(205, 164, 92, 0.3);
  border-radius: 3px;
  cursor: pointer;
  background: var(--ivory-paper);
  text-align: left;
  font: inherit;
  width: 100%;
}
.search-result-item:hover { border-color: var(--antique-gold); }
.search-result-item .cust { font-weight: 600; font-size: 0.9rem; color: var(--charcoal-ink); }
.search-result-item .meta { font-size: 0.78rem; color: var(--charcoal-ink); opacity: 0.65; }

/* FullCalendar container theming (colors only, structure comes from the library) */
#calendar { font-family: var(--font-body); }
#calendar .fc-toolbar-title { font-family: var(--font-display); color: var(--ink-emerald); }
#calendar .fc-button-primary {
  background: var(--ink-emerald);
  border-color: var(--ink-emerald);
  text-transform: capitalize;
}
#calendar .fc-button-primary:hover { background: var(--wine-accent); border-color: var(--wine-accent); }
#calendar .fc-button-primary:disabled { background: var(--antique-gold); border-color: var(--antique-gold); }
#calendar .fc-daygrid-day.fc-day-today,
#calendar .fc-timegrid-col.fc-day-today { background: var(--petal-blush); }
#calendar .fc-event { border: none; cursor: pointer; }
.fc-event.status-confirmed .fc-event-main { background: var(--ink-emerald); color: var(--ivory-paper); }
.fc-event.status-pending .fc-event-main { background: var(--antique-gold); color: var(--charcoal-ink); }
.fc-event.status-cancelled .fc-event-main { background: transparent; color: var(--wine-accent); text-decoration: line-through; opacity: 0.7; }
.fc-event.status-completed .fc-event-main { background: rgba(43, 30, 34, 0.55); color: var(--ivory-paper); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(43, 30, 34, 0.55);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-32) var(--space-16);
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--ivory-paper);
  border-radius: 6px;
  max-width: 560px;
  width: 100%;
  padding: var(--space-24);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-16); }
.modal-head h2 { font-family: var(--font-body); font-size: 1.15rem; color: var(--ink-emerald); }
.modal-close { font-size: 1.6rem; line-height: 1; color: var(--charcoal-ink); padding: 4px 8px; }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-16); }
.modal-error { color: var(--wine-accent); font-size: 0.85rem; min-height: 1.2em; margin: 0 0 var(--space-16); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: var(--space-16); }

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 160px; overflow-y: auto; }
.slot-btn {
  padding: 8px 6px;
  min-height: 40px;
  border: 1px solid rgba(205, 164, 92, 0.5);
  border-radius: 3px;
  background: var(--ivory-paper);
  color: var(--ink-emerald);
  font-family: var(--font-utility);
  font-size: 0.82rem;
}
.slot-btn:hover { border-color: var(--antique-gold); }
.slot-btn.selected { background: var(--ink-emerald); color: var(--ivory-paper); border-color: var(--ink-emerald); }
.loading-text { color: var(--charcoal-ink); opacity: 0.6; font-size: 0.88rem; }

/* Toast notifications — success/error feedback for actions (save, cancel,
   complete) that close the modal immediately, so staff get confirmation
   the action actually happened instead of the modal just silently closing. */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}
.toast {
  padding: 12px 16px;
  border-radius: 6px;
  font-family: var(--font-utility);
  font-size: 0.85rem;
  color: var(--ivory-paper);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: toast-in 0.2s ease;
}
.toast-success { background: var(--ink-emerald); }
.toast-error { background: var(--wine-accent); }
.toast.toast-leaving { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-6px); }
}

#calendar {
  transition: opacity 0.15s ease;
}
#calendar.dash-calendar-loading {
  opacity: 0.45;
  pointer-events: none;
}

@media (min-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr 360px; }
}

@media (max-width: 640px) {
  .dash-summary { grid-template-columns: repeat(2, 1fr); }
  .modal-row { grid-template-columns: 1fr; }
  .filter-row { grid-template-columns: 1fr; }
  .dash-main { padding-left: 16px; padding-right: 16px; }
  .dash-topbar { padding-left: 16px; padding-right: 16px; }
}
