/* ══════════════════════════════════════════════════════════════════════════════
   QueueFree - Shared App Styles
   Design tokens from landing page
   ══════════════════════════════════════════════════════════════════════════════ */

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

:root {
  --ink: #0a0a0a;
  --chalk: #fafaf9;
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-light: #dcfce7;
  --accent-lighter: #f0fdf4;
  --muted: #78716c;
  --muted-light: #a8a29e;
  --border: #e7e5e4;
  --surface: #f5f5f4;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --info: #3b82f6;
  --info-light: #eff6ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --transition: 0.15s ease;
}

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--chalk);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent-hover); color: white; }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #dc2626; color: white; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
}
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Form Elements ────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ── Stat Cards ───────────────────────────────────────────────────────────── */

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ── Badge ────────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 100px;
  text-transform: capitalize;
}

.badge-confirmed { background: var(--accent-light); color: var(--accent); }
.badge-cancelled { background: var(--danger-light); color: var(--danger); }
.badge-completed { background: var(--info-light); color: var(--info); }
.badge-no_show { background: var(--warning-light); color: var(--warning); }

/* ── Auth Pages ───────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 0.25rem;
}

.auth-logo span { color: var(--accent); }

.auth-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

/* ── Dashboard Layout ─────────────────────────────────────────────────────── */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
}

.sidebar-logo span { color: var(--accent); }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
}

.sidebar-link:hover {
  background: var(--surface);
  color: var(--ink);
}

.sidebar-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-link .icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-footer .booking-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  word-break: break-all;
}

.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 2rem;
  max-width: 1000px;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-header p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* ── Stats Grid ───────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

/* ── Calendar ─────────────────────────────────────────────────────────────── */

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calendar-nav .date-display {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 160px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.calendar-grid .day-header {
  background: var(--surface);
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.calendar-grid .day-cell {
  background: white;
  padding: 0.5rem;
  min-height: 80px;
  cursor: pointer;
  transition: background var(--transition);
}

.calendar-grid .day-cell:hover { background: var(--accent-lighter); }
.calendar-grid .day-cell.other-month { opacity: 0.4; }
.calendar-grid .day-cell.today { background: var(--accent-light); }
.calendar-grid .day-cell.selected { background: var(--accent-light); outline: 2px solid var(--accent); outline-offset: -2px; }

.day-cell .day-number {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.day-cell .appt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
}

.day-cell .appt-count {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
}

/* ── Appointment List ─────────────────────────────────────────────────────── */

.appt-list { display: flex; flex-direction: column; gap: 0.75rem; }

.appt-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: box-shadow var(--transition);
}

.appt-card:hover { box-shadow: var(--shadow); }

.appt-time {
  min-width: 70px;
  text-align: center;
}

.appt-time .time {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.appt-time .duration {
  font-size: 0.75rem;
  color: var(--muted);
}

.appt-color-bar {
  width: 4px;
  height: 100%;
  min-height: 48px;
  border-radius: 4px;
  align-self: stretch;
}

.appt-details { flex: 1; }
.appt-details .customer-name { font-weight: 600; font-size: 0.95rem; }
.appt-details .service-name { font-size: 0.85rem; color: var(--muted); }
.appt-details .customer-contact { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.appt-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

/* ── Services List ────────────────────────────────────────────────────────── */

.services-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.service-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.service-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.service-info { flex: 1; }
.service-info .service-name { font-weight: 600; }
.service-info .service-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  gap: 1rem;
  margin-top: 0.15rem;
}

/* ── Empty State ──────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 0.35rem; color: var(--ink); }
.empty-state p { font-size: 0.9rem; margin-bottom: 1rem; }

/* ── Modal ────────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ── Booking Page ─────────────────────────────────────────────────────────── */

.booking-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.booking-header {
  text-align: center;
  margin-bottom: 2rem;
}

.booking-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.booking-header p {
  color: var(--muted);
  margin-top: 0.25rem;
}

.booking-steps {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.step.active { color: var(--accent); font-weight: 600; }
.step.done { color: var(--accent); }

.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface);
  color: var(--muted);
  border: 1.5px solid var(--border);
}

.step.active .step-number { background: var(--accent); color: white; border-color: var(--accent); }
.step.done .step-number { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

.step-connector {
  width: 24px;
  height: 1.5px;
  background: var(--border);
}

.booking-section { display: none; }
.booking-section.active { display: block; }

.service-option {
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.service-option:hover { border-color: var(--accent); background: var(--accent-lighter); }
.service-option.selected { border-color: var(--accent); background: var(--accent-light); }

.service-option .svc-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.service-option .svc-details { flex: 1; }
.service-option .svc-name { font-weight: 600; font-size: 0.95rem; }
.service-option .svc-meta { font-size: 0.8rem; color: var(--muted); }

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 1rem;
}

.date-picker-grid .dp-header {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem;
  text-transform: uppercase;
}

.date-picker-grid .dp-day {
  text-align: center;
  padding: 0.5rem 0.25rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  color: var(--ink);
}

.date-picker-grid .dp-day:hover:not(.disabled) { background: var(--accent-lighter); }
.date-picker-grid .dp-day.selected { background: var(--accent); color: white; font-weight: 700; }
.date-picker-grid .dp-day.today { font-weight: 700; }
.date-picker-grid .dp-day.disabled { color: var(--muted-light); cursor: default; }
.date-picker-grid .dp-day.other-month { color: var(--muted-light); }

.time-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

.time-slot {
  padding: 0.65rem;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  background: white;
  color: var(--ink);
}

.time-slot:hover { border-color: var(--accent); background: var(--accent-lighter); }
.time-slot.selected { border-color: var(--accent); background: var(--accent); color: white; font-weight: 700; }

/* ── Confirmation ─────────────────────────────────────────────────────────── */

.confirm-page {
  max-width: 500px;
  margin: 0 auto;
  padding: 3rem 1rem;
  text-align: center;
}

.confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 1.25rem;
}

.confirm-details {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.confirm-details .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.confirm-details .detail-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.confirm-details .detail-label { color: var(--muted); }
.confirm-details .detail-value { font-weight: 600; }

.booking-ref-display {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
}

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

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--muted);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 0.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

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

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--ink);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--accent); }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    height: auto;
    border-right: none;
    border-top: 1px solid var(--border);
    flex-direction: row;
    z-index: 100;
  }

  .sidebar-logo, .sidebar-footer { display: none; }

  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    padding: 0.5rem;
    width: 100%;
    gap: 0;
  }

  .sidebar-link {
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.7rem;
    padding: 0.4rem 0.5rem;
  }

  .main-content {
    margin-left: 0;
    padding: 1.25rem;
    padding-bottom: 5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .time-slots-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .calendar-grid .day-cell { min-height: 50px; padding: 0.35rem; }
  .day-cell .day-number { font-size: 0.75rem; }
}
