/* ============================================================================
   EDUCATIONAL CENTER BOOKING - STYLES
   Mobile-first. Palette: deep teal primary, warm amber accent.
   ============================================================================ */

:root {
  --color-primary: #0e6b64;
  --color-primary-dark: #0a4f4a;
  --color-primary-light: #e6f3f2;
  --color-accent: #d97a2b;
  --color-accent-light: #fdf1e6;
  --color-bg: #fafaf8;
  --color-surface: #ffffff;
  --color-text: #1f2933;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-danger: #dc2626;
  --color-danger-bg: #fef2f2;
  --color-success: #15803d;
  --color-success-bg: #f0fdf4;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.06), 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 8px 24px rgba(17, 24, 39, 0.08);
  --font-heading: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --header-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; margin: 0; }

a { color: var(--color-primary); }

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

/* ---------------------------------------------------------------------------
   HEADER / PROGRESS
--------------------------------------------------------------------------- */
.app-header {
  padding: 14px 16px 10px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-bottom: 10px;
}

.progress-track {
  display: flex;
  align-items: center;
  overflow-x: auto;
  gap: 0;
  scrollbar-width: none;
}
.progress-track::-webkit-scrollbar { display: none; }

.progress-step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.progress-step__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-border);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  transition: background 0.25s ease;
}

.progress-step.is-active .progress-step__dot { background: var(--color-primary); }
.progress-step.is-active { color: var(--color-primary-dark); }
.progress-step.is-done .progress-step__dot { background: var(--color-accent); }
.progress-step.is-done { color: var(--color-text); }

.progress-sep {
  width: 16px;
  height: 2px;
  background: var(--color-border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   MAIN CONTENT
--------------------------------------------------------------------------- */
.app-main {
  flex: 1;
  padding: 20px 16px 100px;
}

.view { animation: fadeSlideIn 0.28s ease; }
.view[hidden] { display: none; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-heading {
  font-size: 22px;
  margin-bottom: 4px;
  color: var(--color-primary-dark);
}
.view-subheading {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

/* ---------------------------------------------------------------------------
   WELCOME VIEW
--------------------------------------------------------------------------- */
.welcome-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 8vh;
  min-height: calc(100vh - var(--header-h));
}

.welcome-badge {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.welcome-view h1 {
  font-size: 28px;
  color: var(--color-primary-dark);
  margin-bottom: 12px;
  line-height: 1.25;
}

.welcome-view p {
  color: var(--color-text-muted);
  font-size: 15px;
  max-width: 420px;
  margin-bottom: 32px;
}

/* ---------------------------------------------------------------------------
   CARDS
--------------------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

/* Selectable option card (grade, subject, teacher, slot) */
.option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  min-height: 56px;
}

.option-card:active { transform: scale(0.99); }

.option-card.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.option-card__check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #c7ccd1;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: all 0.15s ease;
}

.option-card__check.is-radio { border-radius: 50%; }
.option-card__check.is-checkbox { border-radius: 6px; }

.option-card.is-selected .option-card__check {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.option-card__check svg { display: none; width: 14px; height: 14px; }
.option-card.is-selected .option-card__check svg { display: block; }

.option-card__body { flex: 1; min-width: 0; }
.option-card__title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.option-card__subtitle { font-size: 13px; color: var(--color-text-muted); }

.option-card__badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--color-accent-light);
  color: var(--color-accent);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}
.option-card__badge.is-low { background: #fef2f2; color: var(--color-danger); }

/* subject group header for teacher/slot views */
.subject-group { margin-bottom: 28px; }
.subject-group__title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.subject-group__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ---------------------------------------------------------------------------
   FORMS
--------------------------------------------------------------------------- */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-text);
}
.form-label .optional-tag {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 12px;
}

.form-input, .form-select {
  width: 100%;
  padding: 14px 14px;
  font-size: 16px; /* prevents iOS zoom on focus */
  border: 2px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease;
  min-height: 52px;
}

.form-input:focus, .form-select:focus {
  border-color: var(--color-primary);
  outline: none;
}

.form-input.has-error, .form-select.has-error {
  border-color: var(--color-danger);
}

.form-error {
  color: var(--color-danger);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}
.form-error.is-visible { display: block; }

.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 6px; }

.radio-row {
  display: flex;
  gap: 10px;
}
.radio-pill {
  flex: 1;
  text-align: center;
  padding: 14px;
  border: 2px solid var(--color-border);
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.radio-pill.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

fieldset { border: none; padding: 0; margin: 0; }
legend { padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 600; }

/* ---------------------------------------------------------------------------
   BUTTONS
--------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  padding: 15px 24px;
  min-height: 52px;
  width: 100%;
  transition: filter 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }

.btn-secondary { background: var(--color-surface); color: var(--color-primary-dark); border: 2px solid var(--color-border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--color-primary); }

.btn-text { background: transparent; color: var(--color-primary); padding: 10px 12px; width: auto; }

.btn-danger { background: var(--color-danger); color: #fff; }

.btn-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading .btn-label { opacity: 0.85; }

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

/* ---------------------------------------------------------------------------
   FOOTER NAV (sticky on mobile)
--------------------------------------------------------------------------- */
.step-footer {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--color-bg) 70%, transparent);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  z-index: 15;
}
.step-footer .btn-secondary { flex: 0 0 auto; width: auto; padding-left: 18px; padding-right: 18px; }
.step-footer .btn-primary { flex: 1; }

/* ---------------------------------------------------------------------------
   LOADING / EMPTY / ERROR STATES
--------------------------------------------------------------------------- */
.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-muted);
}
.spinner-lg {
  width: 34px; height: 34px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 14px;
}

.banner {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.banner-error { background: var(--color-danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.banner-success { background: var(--color-success-bg); color: #166534; border: 1px solid #bbf7d0; }
.banner-info { background: var(--color-primary-light); color: var(--color-primary-dark); border: 1px solid #bfe4e1; }

/* ---------------------------------------------------------------------------
   SUMMARY (Review step)
--------------------------------------------------------------------------- */
.summary-section { margin-bottom: 22px; }
.summary-section__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.summary-row:last-child { border-bottom: none; }
.summary-row__label { color: var(--color-text-muted); }
.summary-row__value { font-weight: 600; text-align: right; }

.lesson-summary-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--color-surface);
}
.lesson-summary-card__subject { font-weight: 700; color: var(--color-primary-dark); margin-bottom: 4px; }
.lesson-summary-card__meta { font-size: 13px; color: var(--color-text-muted); }

/* ---------------------------------------------------------------------------
   SUCCESS VIEW
--------------------------------------------------------------------------- */
.success-view { text-align: center; padding-top: 6vh; }
.success-check {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: var(--color-success-bg);
  color: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 36px;
}
.reservation-code-box {
  background: var(--color-primary-dark);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 20px 0;
}
.reservation-code-box__label { font-size: 12px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.06em; }
.reservation-code-box__value { font-size: 22px; font-weight: 800; letter-spacing: 0.03em; margin-top: 4px; }

/* ---------------------------------------------------------------------------
   RESPONSIVE — tablet & desktop
--------------------------------------------------------------------------- */
@media (min-width: 640px) {
  .app-main { padding: 32px 32px 40px; }
  .app-header { padding: 18px 32px 14px; }
  .step-footer { padding: 18px 32px; position: static; background: none; margin-top: 12px; }
  .radio-row { max-width: 320px; }
  .view-heading { font-size: 26px; }
}

@media (min-width: 900px) {
  .app-shell {
    max-width: 860px;
    box-shadow: var(--shadow-md);
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
  }
  body { background: #f0efe9; }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
