/**
 * APA Scheduling System — Styles
 * Brand-consistent, mobile-responsive, vanilla CSS.
 *
 * Colors from APA brand palette:
 *   Primary Blue  #1a77a7
 *   Accent Red    #ed0908 / #cc343b
 *   Light Blue    #84c4db
 *   Off-Black     #353535
 *   Off-White     #f3f1f0
 *   Grey          #979797
 *
 * © All Precision Analytics
 */

/* ──────────────────────────────────────────────
   RESET & BASE
   ────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #353535;
  background: #f3f1f0;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: #1a77a7;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ──────────────────────────────────────────────
   HEADER
   ────────────────────────────────────────────── */

.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e9ecef;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #353535;
  font-size: 15px;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.85;
}

.brand img {
  border-radius: 4px;
}

.header-back {
  font-size: 13px;
  color: #979797;
}

/* ──────────────────────────────────────────────
   MAIN / APP
   ────────────────────────────────────────────── */

#app {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
  position: relative;
}

/* ──────────────────────────────────────────────
   PROGRESS BAR
   ────────────────────────────────────────────── */

.progress-bar {
  margin-bottom: 32px;
}

.progress-track {
  height: 3px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #1a77a7;
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: #979797;
}

.progress-steps span {
  transition: color 0.3s;
}

.progress-steps span.active {
  color: #1a77a7;
  font-weight: 600;
}

.progress-steps span.done {
  color: #353535;
}

/* ──────────────────────────────────────────────
   STEPS
   ────────────────────────────────────────────── */

.step {
  animation: fadeIn 0.3s ease;
}

.step.hidden {
  display: none;
}

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

.step-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #353535;
}

.step-subtitle {
  font-size: 15px;
  color: #666;
  margin-bottom: 24px;
}

/* ──────────────────────────────────────────────
   BACK BUTTON
   ────────────────────────────────────────────── */

.btn-back {
  background: none;
  border: none;
  color: #1a77a7;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 16px;
  display: inline-block;
}

.btn-back:hover {
  color: #145f85;
}

/* ──────────────────────────────────────────────
   MEETING TYPE CARDS
   ────────────────────────────────────────────── */

.card-grid {
  display: grid;
  gap: 16px;
}

.type-card {
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 24px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.type-card:hover {
  border-color: #1a77a7;
  box-shadow: 0 2px 12px rgba(26, 119, 167, 0.12);
}

.type-card-label {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.type-card-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.type-card-desc {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

.type-card-meta {
  font-size: 12px;
  color: #979797;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ──────────────────────────────────────────────
   AUTH FORM
   ────────────────────────────────────────────── */

.auth-form {
  max-width: 400px;
}

.auth-message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
}

.auth-message.error {
  background: #fef2f2;
  color: #cc343b;
  border: 1px solid #fecaca;
}

.auth-message.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ──────────────────────────────────────────────
   MEETING FORMAT SELECTOR
   ────────────────────────────────────────────── */

.format-options {
  display: flex;
  gap: 20px;
}

.format-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #353535;
}

.format-radio input[type="radio"] {
  accent-color: #1a77a7;
  margin: 0;
}

/* ──────────────────────────────────────────────
   FORMS
   ────────────────────────────────────────────── */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: #353535;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  color: #353535;
  background: #fff;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #1a77a7;
  box-shadow: 0 0 0 3px rgba(26, 119, 167, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #aaa;
}

.required {
  color: #cc343b;
}

.optional {
  color: #979797;
  font-weight: 400;
}

/* ──────────────────────────────────────────────
   DURATION OPTIONS
   ────────────────────────────────────────────── */

.duration-options {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.duration-btn {
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 20px 32px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 140px;
}

.duration-btn:hover {
  border-color: #1a77a7;
  box-shadow: 0 2px 12px rgba(26, 119, 167, 0.12);
}

.duration-btn-time {
  font-size: 28px;
  font-weight: 700;
  color: #1a77a7;
  display: block;
}

.duration-btn-label {
  font-size: 13px;
  color: #979797;
  margin-top: 4px;
}

/* ──────────────────────────────────────────────
   TIMEZONE NOTICE
   ────────────────────────────────────────────── */

.timezone-notice {
  background: #f0f7fb;
  border: 1px solid #d3e8f2;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 13px;
  color: #1a77a7;
  margin-bottom: 20px;
}

/* ──────────────────────────────────────────────
   CALENDAR DATE STRIP
   ────────────────────────────────────────────── */

.calendar-container {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  overflow: hidden;
}

.calendar-dates {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e9ecef;
  padding: 0;
}

.cal-nav {
  background: none;
  border: none;
  font-size: 24px;
  color: #979797;
  cursor: pointer;
  padding: 12px 14px;
  flex-shrink: 0;
  transition: color 0.2s;
}

.cal-nav:hover {
  color: #1a77a7;
}

.cal-nav:disabled {
  color: #ddd;
  cursor: default;
}

.cal-dates-scroll {
  display: flex;
  flex: 1;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.cal-dates-scroll::-webkit-scrollbar {
  display: none;
}

.cal-date-btn {
  flex-shrink: 0;
  scroll-snap-align: start;
  background: none;
  border: none;
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  border-radius: 6px;
  margin: 4px 2px;
  transition: background 0.2s, color 0.2s;
  min-width: 72px;
}

.cal-date-btn:hover {
  background: #f0f7fb;
}

.cal-date-btn.active {
  background: #1a77a7;
  color: #fff;
}

.cal-date-btn.no-slots {
  opacity: 0.35;
  cursor: default;
}

.cal-date-dow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: inherit;
}

.cal-date-day {
  display: block;
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
  color: inherit;
}

.cal-date-month {
  display: block;
  font-size: 11px;
  color: inherit;
  opacity: 0.7;
}

/* ──────────────────────────────────────────────
   TIME SLOTS
   ────────────────────────────────────────────── */

.time-slots {
  padding: 20px;
  max-height: 360px;
  overflow-y: auto;
}

.slots-placeholder {
  text-align: center;
  color: #979797;
  padding: 40px 0;
  font-size: 14px;
}

.slot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.slot-btn {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #353535;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.slot-btn:hover {
  border-color: #1a77a7;
  background: #f0f7fb;
}

.slot-btn.selected {
  background: #1a77a7;
  border-color: #1a77a7;
  color: #fff;
}

/* ──────────────────────────────────────────────
   CONFIRM SUMMARY
   ────────────────────────────────────────────── */

.confirm-summary {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 24px;
}

.confirm-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid #f3f1f0;
  font-size: 14px;
}

.confirm-row:last-child {
  border-bottom: none;
}

.confirm-label {
  font-weight: 600;
  width: 140px;
  flex-shrink: 0;
  color: #353535;
}

.confirm-value {
  color: #555;
}

/* ──────────────────────────────────────────────
   SUCCESS
   ────────────────────────────────────────────── */

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

#step-success .step-title,
#step-success .step-subtitle {
  text-align: center;
}

#step-success .confirm-summary {
  margin-top: 24px;
}

#step-success .btn-secondary {
  display: block;
  text-align: center;
  margin-top: 20px;
}

/* ──────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────── */

.btn-primary {
  display: inline-block;
  background: #1a77a7;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #145f85;
}

.btn-primary:disabled {
  background: #a0c4d8;
  cursor: not-allowed;
}

.btn-confirm {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

.btn-secondary {
  display: inline-block;
  background: #fff;
  color: #1a77a7;
  border: 2px solid #1a77a7;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #f0f7fb;
  text-decoration: none;
}

.btn-danger {
  display: inline-block;
  background: #cc343b;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  text-align: center;
}

.btn-danger:hover {
  background: #a82830;
}

/* ──────────────────────────────────────────────
   BOOKING STATUS MESSAGES
   ────────────────────────────────────────────── */

.booking-status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
}

.booking-status.error {
  background: #fef2f2;
  color: #cc343b;
  border: 1px solid #fecaca;
}

.booking-status.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ──────────────────────────────────────────────
   LOADING OVERLAY
   ────────────────────────────────────────────── */

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(243, 241, 240, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e9ecef;
  border-top-color: #1a77a7;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 12px;
}

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

.loading-overlay p {
  font-size: 14px;
  color: #666;
  transition: opacity 0.3s ease;
  min-height: 1.4em;
}

/* ──────────────────────────────────────────────
   FOOTER
   ────────────────────────────────────────────── */

.site-footer {
  text-align: center;
  padding: 20px 24px;
  font-size: 13px;
  color: #979797;
  border-top: 1px solid #e9ecef;
  background: #fff;
}

.site-footer a {
  color: #979797;
}

.site-footer a:hover {
  color: #1a77a7;
}

/* ──────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────── */

@media (max-width: 600px) {
  #app {
    padding: 20px 16px 48px;
  }

  .step-title {
    font-size: 20px;
  }

  .header-inner {
    padding: 10px 16px;
  }

  .duration-options {
    flex-direction: column;
  }

  .duration-btn {
    min-width: unset;
  }

  .type-card-meta {
    flex-direction: column;
    gap: 4px;
  }

  .slot-list {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .confirm-row {
    flex-direction: column;
    gap: 2px;
  }

  .confirm-label {
    width: auto;
  }

  .cal-date-btn {
    min-width: 60px;
    padding: 10px 8px;
  }
}

/* Utility */
.hidden {
  display: none !important;
}
