/* Calendar Booking Page Styles */
/* Professional, accessible design for wraparound care booking */

/* ===== CSS Variables ===== */
:root {
  /* Primary palette - warm, trustworthy blues */
  --primary-600: #2563eb;
  --primary-500: #3b82f6;
  --primary-400: #60a5fa;
  --primary-100: #dbeafe;
  --primary-50: #eff6ff;

  /* Secondary - subtle grays */
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;

  /* Status colors */
  --success-600: #16a34a;
  --success-500: #22c55e;
  --success-100: #dcfce7;
  --success-50: #f0fdf4;

  --warning-500: #eab308;
  --warning-100: #fef9c3;
  --warning-50: #fefce8;

  --danger-500: #ef4444;
  --danger-100: #fee2e2;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Border radius */
  --radius-sm: 0.25rem;
  --radius: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition: 200ms ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--gray-800);
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--primary-50) 100%);
  min-height: 100vh;
}

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

/* ===== Page Layout ===== */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ===== Header ===== */
.booking-header {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary-500);
}

.club-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gray-900);
}

.club-subtitle {
  margin: 0 0 1rem;
  color: var(--gray-600);
  font-size: 0.95rem;
}

.club-meta {
  margin-bottom: 0.75rem;
}

.cost-badge {
  display: inline-block;
  background: var(--primary-50);
  color: var(--primary-600);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.cost-badge strong {
  color: var(--primary-600);
}

.club-description {
  font-size: 0.95rem;
  color: var(--gray-700);
}

.club-description .label {
  color: var(--gray-500);
}

/* ===== Main Content Layout ===== */
.main-content {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

/* ===== Calendar Card ===== */
.calendar-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* Calendar Navigation */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gray-300);
  background: white;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--gray-600);
  transition: all var(--transition-fast);
}

.nav-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  color: var(--gray-800);
}

.nav-btn:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

.month-year-selectors {
  display: flex;
  gap: 0.5rem;
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  appearance: none;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--gray-800);
  cursor: pointer;
  transition: all var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.select-wrapper select:hover {
  border-color: var(--gray-400);
}

.select-wrapper select:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-color: var(--primary-500);
}

/* Calendar Grid */
.calendar-grid {
  margin-bottom: 1rem;
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 0.5rem;
}

.day-header {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-500);
  padding: 0.5rem 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* Calendar Day Cell */
.calendar-day {
  position: relative;
  aspect-ratio: 1;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: var(--gray-50);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  color: inherit;
}

/* Empty day cells */
.calendar-day.empty {
  background: transparent;
  cursor: default;
  pointer-events: none;
}

/* Available dates */
.calendar-day.available {
  background: white;
  border-color: var(--gray-200);
}

.calendar-day.available:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.calendar-day.available:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px var(--primary-100);
}

/* Selected dates */
.calendar-day.selected {
  background: var(--warning-50);
  border-color: var(--warning-500);
}

.calendar-day.selected:hover {
  background: var(--warning-100);
}

.calendar-day.selected:focus {
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.3);
}

/* Already booked dates */
.calendar-day.booked {
  background: var(--success-50);
  border-color: var(--success-500);
}

.calendar-day.booked .day-status {
  color: var(--success-600);
  font-weight: 600;
}

/* Unavailable dates */
.calendar-day.unavailable {
  background: var(--gray-100);
  border-color: var(--gray-200);
  cursor: not-allowed;
  opacity: 0.6;
}

.calendar-day.unavailable:focus {
  outline: none;
}

/* Day content */
.day-number {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.calendar-day.unavailable .day-number {
  color: var(--gray-400);
}

.day-status {
  font-size: 0.65rem;
  color: var(--gray-500);
  text-align: center;
  line-height: 1.2;
}

.calendar-day.selected .day-status {
  color: var(--gray-700);
  font-weight: 500;
}

/* Selection indicator */
.calendar-day.selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: var(--warning-500);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: bold;
}

/* Booked indicator */
.calendar-day.booked::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  background: var(--success-500);
  border-radius: 50%;
}

/* Calendar Legend */
.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--gray-600);
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
  border: 2px solid;
}

.legend-swatch.available {
  background: white;
  border-color: var(--gray-300);
}

.legend-swatch.selected {
  background: var(--warning-50);
  border-color: var(--warning-500);
}

.legend-swatch.booked {
  background: var(--success-50);
  border-color: var(--success-500);
}

.legend-swatch.unavailable {
  background: var(--gray-100);
  border-color: var(--gray-300);
  opacity: 0.6;
}

/* ===== Selection Summary ===== */
.summary-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 1.5rem;
}

.summary-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
}

.summary-instruction {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--gray-500);
  line-height: 1.4;
}

.selected-dates-list {
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border: 1px dashed var(--gray-300);
}

.no-selection {
  margin: 0;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.9rem;
  padding: 2rem 0;
}

/* Selected date tags */
.selected-date-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--warning-100);
  border: 1px solid var(--warning-500);
  color: var(--gray-800);
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  margin: 0.25rem;
  transition: all var(--transition-fast);
}

.selected-date-tag:hover {
  background: var(--warning-50);
}

.selected-date-tag .remove-date {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: transparent;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  transition: all var(--transition-fast);
}

.selected-date-tag .remove-date:hover {
  background: var(--danger-100);
  color: var(--danger-500);
}

.selected-date-tag .remove-date:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 1px;
}

/* Group dates by month */
.date-group {
  margin-bottom: 0.75rem;
}

.date-group:last-child {
  margin-bottom: 0;
}

.date-group-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.375rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--gray-200);
}

/* Summary Actions */
.summary-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn-clear,
.btn-continue {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-clear {
  background: white;
  border: 1px solid var(--gray-300);
  color: var(--gray-600);
}

.btn-clear:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
  color: var(--gray-800);
}

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

.btn-continue {
  background: var(--primary-500);
  border: none;
  color: white;
}

.btn-continue:hover:not(:disabled) {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-continue:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

.btn-continue:focus,
.btn-clear:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* Summary Hint */
.summary-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0;
  padding: 0.75rem;
  background: var(--primary-50);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--gray-600);
  line-height: 1.4;
}

.summary-hint svg {
  flex-shrink: 0;
  color: var(--primary-500);
  margin-top: 0.1rem;
}

/* ===== Keyboard Help ===== */
.keyboard-help {
  margin-top: 1.5rem;
}

.keyboard-help details {
  background: white;
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-sm);
}

.keyboard-help summary {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.keyboard-help summary:hover {
  color: var(--gray-800);
}

.keyboard-help ul {
  list-style: none;
  margin: 0;
  padding: 0 1rem 1rem;
}

.keyboard-help li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  font-size: 0.85rem;
  color: var(--gray-600);
}

.keyboard-help kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  padding: 0.125rem 0.5rem;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-700);
}

/* ===== Responsive Design ===== */
@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .summary-card {
    position: static;
  }

  .selection-summary {
    order: -1;
  }

  .selected-dates-list {
    max-height: 150px;
  }
}

@media (max-width: 600px) {
  .page-wrapper {
    padding: 1rem;
  }

  .booking-header {
    padding: 1rem 1.25rem;
  }

  .club-title {
    font-size: 1.4rem;
  }

  .club-subtitle {
    font-size: 0.875rem;
  }

  .calendar-card {
    padding: 1rem;
  }

  .calendar-nav {
    gap: 0.5rem;
  }

  .month-year-selectors {
    flex-direction: column;
    gap: 0.375rem;
  }

  .select-wrapper select {
    font-size: 0.9rem;
    padding: 0.375rem 1.75rem 0.375rem 0.5rem;
  }

  .nav-btn {
    width: 36px;
    height: 36px;
  }

  .calendar-day {
    min-height: 55px;
    padding: 0.125rem;
  }

  .day-number {
    font-size: 0.95rem;
  }

  .day-status {
    font-size: 0.55rem;
  }

  .calendar-day.selected::after {
    width: 14px;
    height: 14px;
    font-size: 0.55rem;
    top: 2px;
    right: 2px;
  }

  .calendar-legend {
    gap: 0.5rem;
  }

  .legend-item {
    font-size: 0.7rem;
  }

  .legend-swatch {
    width: 12px;
    height: 12px;
  }

  .summary-card h2 {
    font-size: 1.1rem;
  }

  .btn-continue {
    padding: 0.875rem 1rem;
    font-size: 1rem;
  }
}

@media (max-width: 400px) {
  .day-header {
    font-size: 0.65rem;
    padding: 0.375rem 0;
  }

  .calendar-day {
    min-height: 48px;
  }

  .day-number {
    font-size: 0.85rem;
  }

  .day-status {
    font-size: 0.5rem;
  }
}

/* ===== Focus Visible for Better Keyboard UX ===== */
@supports selector(:focus-visible) {
  .calendar-day:focus {
    outline: none;
    box-shadow: none;
  }

  .calendar-day:focus-visible {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
  }

  .calendar-day.selected:focus-visible {
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.3);
  }
}

/* ===== Print Styles ===== */
@media print {
  body {
    background: white;
  }

  .keyboard-help,
  .summary-actions {
    display: none;
  }

  .calendar-card,
  .summary-card,
  .booking-header {
    box-shadow: none;
    border: 1px solid var(--gray-200);
  }
}
