/* ==========================================================================
   Booking Page Styles
   Styles specific to the booking page. Relies on style.css for shared
   components (cards, buttons, forms, containers, etc.).
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Booking Container
   -------------------------------------------------------------------------- */
.booking-container {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* --------------------------------------------------------------------------
   2. Progress Indicator
   -------------------------------------------------------------------------- */
.booking-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: var(--space-xl) 0 var(--space-2xl);
  position: relative;
}

.booking-progress-track {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.booking-progress-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 60%;
  position: relative;
  z-index: 1;
}

.booking-progress-step {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-border);
  transition: background var(--transition-base), border-color var(--transition-base);
  flex-shrink: 0;
}

.booking-progress-step.completed {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.booking-progress-step.current {
  background: var(--color-primary);
  border-color: var(--color-primary);
  animation: pulse 2s infinite;
}

.booking-progress-label {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: var(--space-sm);
  font-family: var(--font-body);
}

/* Pulse keyframes for the current progress step */
@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(0, 102, 204, 0);
  }
}

/* --------------------------------------------------------------------------
   3. Step Container
   -------------------------------------------------------------------------- */
.booking-steps-wrapper {
  position: relative;
}

.booking-step {
  display: none;
  width: 100%;
}

.booking-step.active {
  display: block;
}

@media (prefers-reduced-motion: no-preference) {
  .booking-step.active {
    animation: stepFadeIn 250ms ease;
  }
}

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

/* --------------------------------------------------------------------------
   4. Selection Chips
   -------------------------------------------------------------------------- */
.booking-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.booking-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.375rem 0.875rem;
  background: rgba(0, 102, 204, 0.08);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-body);
}

[data-theme="dark"] .booking-chip {
  background: rgba(77, 159, 255, 0.12);
}

.booking-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: var(--color-primary);
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
}

.booking-chip-remove:hover {
  background: rgba(0, 102, 204, 0.15);
}

/* --------------------------------------------------------------------------
   5. Meeting Type Cards Grid (Step 1)
   -------------------------------------------------------------------------- */
.booking-types-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.booking-type-card {
  all: unset;
  box-sizing: border-box; /* all:unset reverts box-sizing to content-box, so padding would overflow the grid track */
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.booking-type-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
  border-color: var(--color-primary);
}

.booking-type-card:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.booking-type-card[aria-checked="true"] {
  border-color: var(--color-primary);
  background: rgba(0, 102, 204, 0.04);
  box-shadow: 0 0 0 2px var(--color-primary);
}

[data-theme="dark"] .booking-type-card[aria-checked="true"] {
  background: rgba(77, 159, 255, 0.08);
}

.booking-type-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  color: #fff;
}

.booking-type-icon svg {
  width: 24px;
  height: 24px;
}

.booking-type-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--color-text);
  display: block;
  margin-bottom: var(--space-xs);
}

.booking-type-duration {
  display: inline-block;
  padding: 0.2rem 0.625rem;
  background: var(--color-primary);
  color: var(--color-bg-alt);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: var(--space-sm);
  vertical-align: middle;
}

.booking-type-desc {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-top: var(--space-sm);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   6. Calendar (Step 2)
   -------------------------------------------------------------------------- */
.booking-calendar {
  width: 100%;
  margin-top: var(--space-lg);
}

.booking-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.booking-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-card);
  cursor: pointer;
  color: var(--color-text);
  transition: border-color var(--transition-fast);
}

.booking-calendar-nav:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.booking-calendar-nav:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.booking-calendar-nav:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.booking-calendar-nav svg {
  width: 20px;
  height: 20px;
}

.booking-calendar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--color-text);
}

.booking-calendar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: var(--space-sm) 0;
}

.booking-calendar-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text);
  cursor: pointer;
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.booking-calendar-day:hover {
  background: rgba(0, 102, 204, 0.1);
}

[data-theme="dark"] .booking-calendar-day:hover {
  background: rgba(77, 159, 255, 0.15);
}

.booking-calendar-day:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.booking-calendar-day.available {
  font-weight: 500;
}

.booking-calendar-day.unavailable,
.booking-calendar-day:disabled {
  color: var(--color-text-muted);
  opacity: 0.4;
  cursor: default;
}

.booking-calendar-day.today::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-accent);
}

.booking-calendar-day.selected {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

.booking-calendar-day.selected.today::after {
  background: #fff;
}

.booking-calendar-day:disabled:hover {
  background: transparent;
}

/* --------------------------------------------------------------------------
   7. Timezone Selector
   -------------------------------------------------------------------------- */
.booking-timezone {
  margin-bottom: var(--space-md);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.booking-timezone select {
  display: inline-block;
  width: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  background: var(--color-bg-card);
  color: var(--color-text);
  font-family: var(--font-body);
}

/* --------------------------------------------------------------------------
   9. Time Slots (Step 3)
   -------------------------------------------------------------------------- */
.booking-slots-group {
  margin-bottom: var(--space-xl);
}

.booking-slots-group h3 {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.booking-slots-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.booking-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-primary);
  background: transparent;
  color: var(--color-primary);
  border-radius: var(--radius-full);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 48px;
  min-width: 80px;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.booking-slot:hover {
  background: var(--color-primary);
  color: #fff;
}

.booking-slot:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.booking-slot[aria-pressed="true"] {
  background: var(--color-primary);
  color: #fff;
}

.booking-slot:disabled {
  opacity: 0.4;
  cursor: default;
  border-color: var(--color-border);
  color: var(--color-text-muted);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   10. Confirmation (Step 5)
   -------------------------------------------------------------------------- */
.booking-confirmed {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.booking-confirmed-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  color: var(--color-primary);
}

.booking-confirmed-icon svg {
  width: 100%;
  height: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .booking-confirmed-icon {
    transform: scale(0.8);
    opacity: 0;
    animation: confirmScale 500ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  }
}

@keyframes confirmScale {
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.booking-summary {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: left;
  margin: var(--space-xl) auto;
  max-width: 500px;
}

.booking-summary dt {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-md);
}

.booking-summary dt:first-child {
  margin-top: 0;
}

.booking-summary dd {
  font-size: 1rem;
  color: var(--color-text);
  margin-top: var(--space-xs);
  margin-left: 0;
}

.booking-summary a {
  color: var(--color-primary);
  text-decoration: underline;
}

.booking-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   11. Loading Skeleton
   -------------------------------------------------------------------------- */
.booking-skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-border-light) 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  height: 48px;
}

@media (prefers-reduced-motion: no-preference) {
  .booking-skeleton {
    animation: shimmer 1.5s infinite;
  }
}

/* Note: The shimmer keyframes are defined in style.css and shared across the site. */

.booking-skeleton-row {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.booking-skeleton-row .booking-skeleton {
  flex: 1;
}

/* --------------------------------------------------------------------------
   12. Navigation Buttons
   -------------------------------------------------------------------------- */
.booking-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

/* --------------------------------------------------------------------------
   13. Error and Empty States
   -------------------------------------------------------------------------- */
.booking-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.booking-error {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-accent);
  font-weight: 600;
}

.booking-error-banner {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #991b1b;
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
  font-size: 0.95rem;
  line-height: 1.5;
}

[data-theme="dark"] .booking-error-banner {
  background: #451a1a;
  border-color: #7f1d1d;
  color: #fca5a5;
}

.booking-error-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-muted, #666);
}

.booking-error-state p {
  margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   14. Responsive (below 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .booking-types-grid {
    grid-template-columns: 1fr;
  }

  .booking-calendar-day {
    width: 40px;
    height: 40px;
    font-size: 0.85rem;
  }

  .booking-calendar-grid {
    gap: 4px;
  }

  .booking-actions {
    flex-direction: column;
  }

  .booking-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .booking-progress-track,
  .booking-progress-steps {
    width: 80%;
  }

  .booking-slot {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }
}

/* --------------------------------------------------------------------------
   15. Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .booking-step.active {
    animation: none;
  }

  .booking-skeleton {
    animation: none;
  }

  .booking-confirmed-icon {
    animation: none;
    transform: none;
    opacity: 1;
  }

  .booking-type-card {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   RTL overrides (Arabic booking page)
   -------------------------------------------------------------------------- */
[dir="rtl"] .booking-type-card {
  text-align: right;
}

[dir="rtl"] .booking-type-duration {
  margin-left: 0;
  margin-right: var(--space-sm);
}

[dir="rtl"] .booking-summary {
  text-align: right;
}

/* Chevrons are drawn for LTR: "Back" and "Previous month" must point right in RTL */
[dir="rtl"] .booking-nav .btn svg,
[dir="rtl"] .booking-calendar-nav svg {
  transform: scaleX(-1);
}
