/* =============================================
   Triad Math Tutor — accounts, booking, tutor dashboard
   Builds on style.css variables and components.
============================================= */

[hidden] { display: none !important; }

.page-hero-compact { padding: 44px 0 38px; }
.page-hero-compact h1 { font-size: clamp(28px, 4vw, 40px); margin-bottom: 6px; }

.app-main { background: var(--bg-light); padding: 40px 0 72px; min-height: 60vh; }

.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-bottom: 24px;
}
.panel h2 { font-size: 22px; margin-bottom: 14px; }
.panel h3 { font-size: 18px; margin-bottom: 10px; }
.panel-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.panel-medium { max-width: 760px; margin-left: auto; margin-right: auto; }
.muted { color: var(--text-muted); font-size: 14px; }
.small { font-size: 14px; }

/* ── alerts ── */
.alert {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 15px;
  border: 1px solid;
}
.alert ul { list-style: disc; padding-left: 18px; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-success { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.alert-info    { background: var(--bg-section); border-color: var(--primary-light); color: var(--secondary); }
.alert-warn    { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ── forms (extends .form-group from style.css) ── */
.form-group .hint { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.form-group input[type="checkbox"], .form-group input[type="radio"] { width: auto; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--text-heading); cursor: pointer; }
.check-row input { margin-top: 5px; flex-shrink: 0; width: 18px; height: 18px; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-danger { background: var(--white); color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; color: #991b1b; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.inline-form { display: inline; }
.form-links { margin-top: 18px; font-size: 14px; text-align: center; }

/* ── choice cards (grade level, format) ── */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.choice {
  position: relative;
  display: block;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.choice:hover { border-color: var(--primary); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); background: var(--bg-section); }
.choice:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice-title { display: block; font-weight: 600; color: var(--text-heading); font-size: 15px; }
.choice-price { display: block; color: var(--primary); font-weight: 700; font-size: 15px; margin-top: 2px; }
.choice-note  { display: block; color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.choice.is-disabled { opacity: 0.45; cursor: not-allowed; }

/* ── packages ── */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.pkg { text-align: center; padding: 22px 16px; }
.pkg-hours { font-size: 20px; font-weight: 700; color: var(--text-heading); }
.pkg-price { font-size: 32px; font-weight: 800; color: var(--primary); margin: 6px 0 2px; }
.pkg-save { display: inline-block; background: #dcfce7; color: #166534; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 20px; }
.pkg form { margin-top: 14px; }

/* ── dashboard ── */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-tile { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; }
.stat-k { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.stat-v { font-size: 28px; font-weight: 800; color: var(--text-heading); line-height: 1.2; margin: 4px 0; }
.stat-s { font-size: 14px; }
.stat-s a { font-weight: 600; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-heading); }
.table tr:last-child td { border-bottom: none; }
.table td .muted { display: block; }
.table .actions { justify-content: flex-end; }
.table select { padding: 6px 8px; border: 1.5px solid var(--border); border-radius: var(--radius); font-family: inherit; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-accepted  { background: #dcfce7; color: #166534; }
.badge-completed { background: var(--primary-light); color: var(--primary-dark); }
.badge-refunded  { background: #f1f5f9; color: #475569; }
.badge-late      { background: #fee2e2; color: #991b1b; }
.badge-free      { background: #ede9fe; color: #5b21b6; }

/* ── booking form ── */
.cost-box { background: var(--bg-section); border: 1px solid var(--primary-light); border-radius: var(--radius); padding: 16px 18px; margin: 8px 0 22px; }
.cost-line { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.cost-total { font-weight: 700; color: var(--text-heading); font-size: 17px; border-top: 1px solid var(--primary-light); margin-top: 8px; padding-top: 8px; }
.terms-box { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; font-size: 14px; }
.terms-box ul { list-style: disc; padding-left: 20px; }
.terms-box li { margin-bottom: 6px; }

.terms-page h2 { font-size: 22px; margin: 28px 0 10px; }
.terms-page h2:first-child { margin-top: 0; }
.terms-page ul { list-style: disc; padding-left: 22px; margin-bottom: 1em; }
.terms-page li { margin-bottom: 6px; }

@media (max-width: 600px) {
  .panel { padding: 20px; }
  .table thead { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .table td { display: block; border: none; padding: 4px 0; }
  .table .actions { justify-content: flex-start; }
}

/* style.css styles every .form-group label as a small uppercase heading --
   undo that for the clickable cards and checkbox rows inside a group. */
.form-group label.choice,
.form-group label.check-row {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  font-size: 15px;
  margin-bottom: 0;
}

.site-footer-compact { padding: 26px 0; }
.site-footer-compact .footer-bottom { margin-top: 0; padding-top: 0; border-top: none; }

/* ── booking steps ── */
.step-title { display: flex; align-items: center; gap: 10px; font-size: 20px; margin: 30px 0 14px; }
.step-title:first-of-type { margin-top: 0; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--white); font-size: 14px; font-weight: 700; flex-shrink: 0; }

/* ── availability calendar ── */
.cal { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head { background: var(--bg-light); border-bottom: 1px solid var(--border); }
.cal-head div { text-align: center; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 8px 0; }
.cal-day {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 62px; padding: 6px 8px; border: none; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--white); font: inherit; text-align: left; color: var(--text-muted); cursor: default;
}
.cal-row .cal-day:last-child { border-right: none; }
.cal-num { font-size: 14px; font-weight: 600; }
.cal-count { font-size: 11px; font-weight: 700; color: #166534; background: #dcfce7; border-radius: 10px; padding: 1px 7px; }
.cal-day.is-outside { background: var(--bg-light); color: transparent; }
.cal-day:disabled:not(.is-outside) { background: repeating-linear-gradient(135deg, var(--white), var(--white) 6px, var(--bg-light) 6px, var(--bg-light) 12px); }
.cal-day.is-open { color: var(--text-heading); cursor: pointer; transition: background var(--transition); }
.cal-day.is-open:hover { background: var(--bg-section); }
.cal-day.is-open:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-day.is-selected, .cal-day.is-selected:hover { background: var(--primary); color: var(--white); }
.cal-day.is-selected .cal-count { background: rgba(255,255,255,0.25); color: var(--white); }

.times-wrap { margin-bottom: 8px; }
.times-wrap h3 { font-size: 17px; margin-bottom: 10px; }
.time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.time-chip { position: relative; display: block; cursor: pointer; }
.time-chip input { position: absolute; opacity: 0; pointer-events: none; }
.time-chip span { display: block; text-align: center; padding: 10px 8px; border: 1.5px solid var(--border); border-radius: var(--radius); font-weight: 600; color: var(--text-heading); background: var(--white); transition: border-color var(--transition), background var(--transition); }
.time-chip small { font-weight: 400; color: var(--text-muted); }
.time-chip:hover span { border-color: var(--primary); }
.time-chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--white); }
.time-chip input:checked + span small { color: rgba(255,255,255,0.8); }
.time-chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.pay-options { display: grid; gap: 10px; }

/* ── tutor weekly hours editor ── */
.week-editor { border: 1px solid var(--border); border-radius: var(--radius); }
.week-day { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: start; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.week-day:last-child { border-bottom: none; }
.week-day.is-on { background: var(--bg-section); }
.day-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; padding-top: 8px; }
.day-toggle input { appearance: none; -webkit-appearance: none; position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--border); cursor: pointer; transition: background var(--transition); flex-shrink: 0; margin: 0; }
.day-toggle input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--white); box-shadow: var(--shadow-sm); transition: transform var(--transition); }
.day-toggle input:checked { background: var(--primary); }
.day-toggle input:checked::after { transform: translateX(16px); }
.day-toggle input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.day-name { font-weight: 700; color: var(--text-heading); }
.day-off-label { display: block; color: var(--text-muted); font-size: 14px; padding-top: 8px; }
.week-day .ranges, .week-day .range-add { display: none; }
.week-day.is-on .ranges { display: grid; gap: 8px; }
.week-day.is-on .range-add { display: inline-block; }
.week-day.is-on .day-off-label { display: none; }
.range-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-row select { padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius); font: inherit; font-size: 15px; background: var(--white); color: var(--text-heading); }
.range-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.range-to { color: var(--text-muted); font-size: 14px; }
.range-remove { border: none; background: none; color: var(--text-muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.range-remove:hover { color: #b91c1c; background: #fef2f2; }
.range-add { margin-top: 8px; border: none; background: none; color: var(--primary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 0; }
.range-add:hover { text-decoration: underline; }

@media (max-width: 600px) {
  .cal-day { min-height: 48px; padding: 4px; }
  .cal-count { font-size: 10px; padding: 0 4px; }
  .week-day { grid-template-columns: 1fr; gap: 6px; }
  .day-toggle, .day-off-label { padding-top: 0; }
}

/* Let the 7 calendar columns shrink on narrow screens instead of pushing
   the page wider than the viewport. */
.cal-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-day { min-width: 0; overflow: hidden; }
@media (max-width: 600px) {
  .cal-num { font-size: 13px; white-space: nowrap; }
  .cal-count { font-size: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; background: #16a34a; }
  .cal-day.is-selected .cal-count { background: var(--white); }
  .time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── booking progress (Pick a time → Your info → Card) ── */
.progress-steps { display: flex; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; counter-reset: step; }
.progress-steps li { flex: 1; counter-increment: step; font-size: 13px; font-weight: 600; color: var(--text-muted); padding-top: 10px; border-top: 4px solid var(--border); }
.progress-steps li::before { content: counter(step) ". "; }
.progress-steps li.is-current { color: var(--primary); border-top-color: var(--primary); }
.progress-steps li.is-done { color: var(--text-heading); border-top-color: #16a34a; }
.progress-steps li.is-done a { color: inherit; }

/* ── "what do sessions cost after the trial?" (free trial signup) ── */
.rates-later { margin: -8px 0 24px; font-size: 14px; color: var(--text); }
.rates-later summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.rates-later p { margin: 8px 0 4px; }
.rates-later ul { list-style: disc; padding-left: 20px; }

/* ── busy button spinner (forms with data-busy) ── */
.spinner { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; border: 2px solid rgba(255,255,255,0.45); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn-outline-primary .spinner { border-color: rgba(37,99,235,0.3); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ── Back / Next row on booking steps ── */
.form-nav { display: flex; gap: 12px; align-items: stretch; }
.form-nav .btn-primary { flex: 1; }
@media (max-width: 600px) { .form-nav { flex-direction: column-reverse; } }
