/**
 * Core UI Styles - Base styling for hybrid booking system
 * Version: 1.0.0
 *
 * CSS Custom Properties for theming across tenants
 * Default values can be overridden by tenant-specific stylesheets
 */

:root {
  /* Brand colors - can be overridden per tenant */
  --brand-primary: #0066cc;
  --brand-secondary: #004499;
  --brand-accent: #ff6600;
  --brand-background: #ffffff;
  --brand-text: #333333;
  --brand-light: #f8f9fa;
  --brand-border: #dee2e6;

  /* Semantic colors */
  --color-success: #28a745;
  --color-warning: #ffc107;
  --color-error: #dc3545;
  --color-info: #17a2b8;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-sm: 14px;
  --font-size-xs: 12px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 700;

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-xxl: 3rem;

  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--brand-text);
  background-color: var(--brand-background);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-md) 0;
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  margin: 0 0 var(--space-md) 0;
}

/* Container and layout */
.booking-container {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-lg);
}

.booking-form {
  background: var(--brand-background);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-xl);
}

/* Step indicators */
.step-indicators {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-xl);
  gap: var(--space-sm);
}

.step-indicator {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  background: var(--brand-light);
  color: var(--brand-text);
  border: 2px solid var(--brand-border);
  transition: all var(--transition-normal);
}

.step-indicator.active {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.step-indicator.completed {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
}

/* Form sections */
.form-section {
  margin-bottom: var(--space-xl);
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-lg);
  color: var(--brand-primary);
}

/* Form controls */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-sm);
  color: var(--brand-text);
}

.form-control {
  width: 100%;
  padding: var(--space-md);
  border: 2px solid var(--brand-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  transition: border-color var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-control.error {
  border-color: var(--color-error);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: var(--space-sm);
}

.btn-primary {
  background: var(--brand-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--brand-secondary);
}

.btn-secondary {
  background: var(--brand-light);
  color: var(--brand-text);
  border: 2px solid var(--brand-border);
}

.btn-secondary:hover {
  background: var(--brand-border);
}

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

.btn-block {
  width: 100%;
}

/* Service and addon selection */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: var(--space-lg);
}

.service-card, .addon-card {
  border: 2px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--brand-background);
}

.service-card:hover, .addon-card:hover {
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.service-card.selected, .addon-card.selected {
  border-color: var(--brand-primary);
  background: rgba(0, 102, 204, 0.05);
}

.service-title, .addon-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-sm);
}

.service-price, .addon-price {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--brand-primary);
}

/* Date and time selection */
.date-time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.time-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.time-slot {
  padding: var(--space-md);
  border: 2px solid var(--brand-border);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--brand-background);
}

.time-slot:hover {
  border-color: var(--brand-primary);
}

.time-slot.selected {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.time-slot:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Estimate display */
.estimate-container {
  background: var(--brand-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.estimate-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-md);
}

.estimate-breakdown {
  margin-bottom: var(--space-md);
}

.estimate-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.estimate-total {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--brand-primary);
  border-top: 2px solid var(--brand-border);
  padding-top: var(--space-md);
  display: flex;
  justify-content: space-between;
}

/* Navigation */
.form-navigation {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 2px solid var(--brand-border);
}

/* Messages and toast */
.toast {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  color: white;
  font-weight: var(--font-weight-medium);
  box-shadow: var(--shadow-lg);
  transform: translateX(400px);
  transition: transform var(--transition-normal);
  z-index: 1000;
}

.toast.show {
  transform: translateX(0);
}

.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-error); }
.toast.warning { background: var(--color-warning); }
.toast.info { background: var(--color-info); }

.error-message {
  color: var(--color-error);
  font-size: var(--font-size-sm);
  margin-top: var(--space-xs);
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Quantity controls */
.quantity-control {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.quantity-btn {
  width: 32px;
  height: 32px;
  border: 2px solid var(--brand-border);
  background: var(--brand-background);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: var(--font-weight-bold);
}

.quantity-btn:hover {
  border-color: var(--brand-primary);
}

.quantity-display {
  min-width: 40px;
  text-align: center;
  font-weight: var(--font-weight-medium);
}

/* Choice selection (for RG specialty drinks) */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.choice-item {
  padding: var(--space-md);
  border: 2px solid var(--brand-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  background: var(--brand-background);
}

.choice-item:hover {
  border-color: var(--brand-primary);
}

.choice-item.selected {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 768px) {
  /* Container and spacing improvements */
  .booking-container {
    padding: var(--space-sm) var(--space-md);
    margin: 0;
  }

  .booking-form {
    padding: var(--space-lg);
    margin: var(--space-sm) 0;
    border-radius: var(--radius-md);
  }

  /* Typography improvements for mobile */
  h1 {
    font-size: 1.75rem;
    line-height: 1.3;
    margin-bottom: var(--space-md);
  }
  h2 {
    font-size: 1.4rem;
    line-height: 1.3;
  }
  h3 {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  /* Enhanced form controls for mobile */
  .form-control {
    padding: 14px 16px;
    font-size: 16px; /* Prevents iOS zoom */
    border-width: 1px; /* Thinner borders on mobile */
    margin-bottom: var(--space-sm);
    min-height: 44px; /* iOS touch target minimum */
  }

  .form-label {
    font-size: 14px;
    margin-bottom: 6px;
    font-weight: var(--font-weight-medium);
  }

  .form-group {
    margin-bottom: var(--space-md);
  }

  /* Button improvements */
  .btn {
    min-height: 44px; /* iOS touch target minimum */
    padding: 12px var(--space-lg);
    font-size: 16px;
    font-weight: var(--font-weight-medium);
    margin-bottom: var(--space-sm);
    width: 100%; /* Full width buttons on mobile */
  }

  /* Grid improvements */
  .date-time-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  /* Fix cramped event details layout */
  .datetime-group, .form-row {
    grid-template-columns: 1fr !important;
    gap: var(--space-md);
  }

  /* Event detail fields mobile spacing */
  .form-group {
    margin-bottom: var(--space-lg);
  }

  /* Ensure event time and guests get full width */
  .event-time-input, .guest-count-input, .event-date-input {
    width: 100%;
    margin-bottom: var(--space-md);
  }

  .time-slots {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-sm);
  }

  .time-slot {
    min-height: 44px; /* Touch target minimum */
    font-size: 14px;
    padding: var(--space-sm);
  }

  /* Navigation improvements */
  .form-navigation {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .form-navigation .btn {
    width: 100%;
    margin: 0;
  }

  /* Step indicators responsive */
  .step-indicators {
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
  }

  .step-indicator {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  /* Service and addon cards */
  .service-card, .addon-card {
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    cursor: pointer;
    min-height: 44px; /* Touch target minimum */
  }

  /* Force single-column grids on mobile to prevent horizontal overflow */
  .service-grid,
  .choice-grid,
  .choices-container.grid-layout {
    grid-template-columns: 1fr !important;
  }

  /* Quantity controls */
  .quantity-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 16px;
    border-width: 1px;
  }

  .quantity-display {
    min-width: 44px;
    text-align: center;
    font-size: 16px;
    padding: var(--space-xs);
  }

  /* Toast and error messages */
  .toast {
    position: fixed;
    top: var(--space-md);
    left: var(--space-sm);
    right: var(--space-sm);
    max-width: none;
    margin: 0;
    z-index: 1000;
  }

  /* Error message positioning */
  .error-message {
    margin-top: var(--space-xs);
    margin-bottom: var(--space-sm);
    font-size: 14px;
    line-height: 1.4;
  }

  /* Estimate container mobile optimization */
  .estimate-container {
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
  }

  .estimate-line {
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
  }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  .booking-container {
    padding: var(--space-xs) var(--space-sm);
  }

  .booking-form {
    padding: var(--space-md);
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }

  .time-slots {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  }

  .form-control {
    padding: 12px 14px;
  }

  .btn {
    padding: 10px var(--space-md);
  }
}

/* Utility classes */
.hidden { display: none !important; }
.visible { display: block !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0 !important; }
.mt-lg { margin-top: var(--space-lg) !important; }
.p-0 { padding: 0 !important; }

/* Debug helper (remove in production) */
.debug-info {
  position: fixed;
  bottom: var(--space-lg);
  left: var(--space-lg);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-xs);
  max-width: 300px;
  z-index: 999;
}

/* Enhanced Addon System Styles */
.enhanced-addon {
  border: 1px solid var(--brand-border, #dee2e6);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  background: white;
}

.addon-header {
  margin-bottom: var(--space-md);
}

.addon-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.required-badge {
  background: var(--color-required, #ffc107);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.addon-description {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

.addon-price-summary {
  font-weight: var(--font-weight-medium);
  color: var(--brand-primary);
}

.choice-selection-addon,
.single-choice-addon,
.simple-addon {
  margin-top: var(--space-md);
}

.selection-info {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.choices-container.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-md);
}

.choices-container.list-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.choice-option {
  border: 2px solid var(--brand-border, #dee2e6);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.choice-option:hover {
  border-color: var(--brand-primary);
  background: var(--addon-hover, #f8f9fa);
}

.choice-option.selected {
  border-color: var(--brand-primary);
  background: var(--addon-selected, #e3f2fd);
}

.choice-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--addon-disabled, #f5f5f5);
}

.choice-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.choice-name {
  font-weight: var(--font-weight-medium);
}

.choice-description {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.choice-price {
  font-weight: var(--font-weight-medium);
  color: var(--brand-primary);
}

.choice-option input[type="checkbox"],
.choice-option input[type="radio"] {
  margin-left: auto;
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  justify-content: center;
}

.quantity-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--brand-border);
  background: white;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quantity-btn:hover:not(:disabled) {
  background: var(--brand-primary);
  color: white;
}

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

.quantity-display {
  min-width: 40px;
  text-align: center;
  font-weight: var(--font-weight-medium);
}

.addon-help-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-md);
  padding: var(--space-sm);
  background: var(--addon-hover, #f8f9fa);
  border-radius: var(--radius-sm);
}

.addon-validation-error {
  color: var(--color-invalid, #dc3545);
  font-size: var(--font-size-sm);
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: rgba(220, 53, 69, 0.1);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--color-invalid);
}