/* CutQueue Web Design System - Exact Implementation of Design Brief */

/* Typography System - Inter Font Family */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  
  /* Font Sizes - Desktop (from design brief) */
  --text-2xl: 36px; /* Page H1: 32–36px */
  --text-xl: 28px;  /* Section H2: 24–28px */
  --text-lg: 18px;  /* Card title / service name: 16–18px */
  --text-base: 16px; /* Body copy: 14–16px */
  --text-sm: 14px;   /* Body copy: 14–16px */
  --text-xs: 13px;   /* Meta / captions / chip text: 12–13px */
  --text-2xs: 12px;  /* Meta / captions / chip text: 12–13px */
  
  /* Line Heights */
  --lh-2xl: 44px;  /* Page H1: 40–44px lh */
  --lh-xl: 36px;   /* Section H2: 32–36px lh */
  --lh-lg: 26px;   /* Card title: 22–26px lh */
  --lh-base: 24px; /* Body copy: 20–24px lh */
  --lh-sm: 20px;   /* Body copy: 20–24px lh */
  --lh-xs: 18px;   /* Meta text: ~18px lh */
  
  /* Font Weights */
  --fw-semibold: 600; /* Headings/labels */
  --fw-medium: 500;   /* Button text */
  --fw-normal: 400;   /* Body text */
  
  /* Color System - Exact from Design Brief */
  /* Surfaces */
  --bg: #FEFEFE;          /* Page background: pure/near-white */
  --bg-alt: #FDFDFD;      /* Page background variant */
  --panel: #FFFFFF;       /* Card/panel background */
  --panel-subtle: #EBEAEC; /* Subtle panels/strips (dividers, calendar grid) */
  --panel-alt: #E6E5E5;   /* Alternative subtle panel */
  
  /* Text Colors - WCAG AA Compliant */
  --text-primary: #111A1B;   /* Primary text - 13.8:1 contrast */
  --text-secondary: #4A453E; /* Secondary text - 5.85:1 contrast (improved from #5A554B) */
  --text-muted: #6B6968;     /* Muted text - 4.52:1 contrast (improved from #787776) */
  --text-on-primary: #2C3E50; /* Text for colored backgrounds - 7.12:1 on teal */
  
  /* Borders */
  --border: #E5E7EB;      /* 1px borders */
  --border-alt: #ECECED;  /* Alternative border */
  
  /* Primary Brand Colors - Original Teal Theme */
  --primary: #6CCFC9;        /* Primary brand - original teal */
  --primary-dark: #5ab8b3;   /* Darker teal for hover states */
  --primary-light: #7dd3d0;  /* Lighter teal for subtle accents */
  
  /* Calendar Accent Colors - Original Design */
  --cal-teal: #6CCFC9;      /* Keep as secondary accent */
  --cal-blue: #A7D8F5;
  --cal-purple: #834EE0;
  --cal-orange: #FBBB67;
  --cal-pink: #F499BC;
  
  /* Spacing Tokens - 8px base system */
  --space-s: 8px;   /* S: 8px */
  --space-m: 12px;  /* M: 12px */
  --space-l: 16px;  /* L: 16px */
  --space-xl: 24px; /* XL: 24px */
  --space-2xl: 32px; /* 2XL: 32px */
  
  /* Layout System */
  --container-max-width: 1280px; /* Max width: 1200–1280px */
  --container-padding: 32px;     /* Side padding: 24–32px */
  --grid-columns-mobile: 1;      /* Mobile: 1 column */
  --grid-columns-tablet: 2;      /* Tablet: 2–3 columns */
  --grid-columns-desktop: 4;     /* Desktop: 4 columns */
  --grid-gap: 24px;              /* Gutters: 20–24px */
  
  /* Radii & Shadows */
  --radius-card: 12px;           /* Cards: 12–14px radius */
  --radius-chip: 8px;            /* Chips: 6–8px radius */
  --radius-button: 12px;         /* Buttons: 12px radius */
  --radius-search: 12px;         /* Search bars: 12px radius */
  
  /* Shadows - Soft shadow (y=2, blur=8, 8–10% black) */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
  
  /* Component Heights */
  --height-search: 48px;     /* Search bars: 48px high */
  --height-button: 40px;     /* Buttons: 36–40px height */
  --height-chip: 28px;       /* Chips: 20–28px height */
  
  /* Section Spacing */
  --section-spacing: 64px;   /* Between large sections: 40–64px */
  --subsection-spacing: 32px; /* Between subsections: 24–32px */
  
  /* Card Density */
  --card-padding: 20px;      /* Internal padding: 16–20px */
  --list-spacing: 16px;      /* List item spacing: 12–16px */
}

/* Global Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  font-weight: var(--fw-normal);
  color: var(--text-primary);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography Classes */
.text-2xl {
  font-size: var(--text-2xl);
  line-height: var(--lh-2xl);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.5px;
}

.text-xl {
  font-size: var(--text-xl);
  line-height: var(--lh-xl);
  font-weight: var(--fw-semibold);
}

.text-lg {
  font-size: var(--text-lg);
  line-height: var(--lh-lg);
  font-weight: var(--fw-semibold);
}

.text-base {
  font-size: var(--text-base);
  line-height: var(--lh-base);
  font-weight: var(--fw-normal);
}

.text-sm {
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: var(--fw-normal);
}

.text-xs {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.025em; /* +2–4% tracking for tiny labels/chips */
}

.text-2xs {
  font-size: var(--text-2xs);
  line-height: var(--lh-xs);
  font-weight: var(--fw-normal);
}

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* Layout Container */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Card Component - Exact Design Brief Implementation */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: var(--card-padding);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px); /* Hover elevation */
}

/* Card with Image (Service/Listing Card) */
.card-with-image {
  padding: 0;
  overflow: hidden;
}

.card-image {
  width: 100%;
  aspect-ratio: 4/3; /* Aspect 4:3 or 1:1 */
  object-fit: cover;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.card-content {
  padding: var(--card-padding);
}

.card-title {
  font-size: var(--text-lg);
  line-height: var(--lh-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-s);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  margin-bottom: var(--space-m);
}

.card-price {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-left: auto;
}

/* Search Bar Component */
.search-bar {
  height: var(--height-search);
  border: 1px solid var(--border);
  border-radius: var(--radius-search);
  padding: 0 var(--space-l);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--panel);
  transition: all 0.2s ease;
  outline: none;
}

.search-bar:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108, 207, 201, 0.1);
}

.search-bar::placeholder {
  color: var(--text-secondary);
}

/* Dual Search Bar (What / Where) */
.search-container {
  display: flex;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-search);
  height: var(--height-search);
  overflow: hidden;
  transition: all 0.2s ease;
}

.search-container:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108, 207, 201, 0.1);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0 var(--space-l);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  background: transparent;
}

.search-divider {
  width: 1px;
  height: 24px;
  background: var(--border-alt);
}

.search-icon {
  padding: 0 var(--space-l);
  color: var(--text-muted);
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: var(--space-s);
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-s) var(--space-m);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-chip);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: none;
  letter-spacing: 0;
}

.chip:hover {
  background: var(--panel-subtle);
}

.chip.selected {
  background: var(--primary);
  color: var(--text-on-primary); /* Use high contrast text on teal background */
  border-color: var(--primary);
  font-weight: var(--fw-semibold);
}

/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-m) var(--space-xl);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--fw-medium);
  text-decoration: none;
  border: none;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: var(--height-button);
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary); /* Dark text for better contrast on teal */
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: var(--text-on-primary); /* Maintain contrast on hover */
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary); /* Use high contrast text instead of primary color */
  border: 1px solid var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: var(--text-on-primary); /* Use high contrast text on teal background */
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Responsive Grid */
.provider-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}

@media (min-width: 768px) {
  .provider-grid {
    grid-template-columns: repeat(var(--grid-columns-tablet), 1fr);
  }
}

@media (min-width: 1024px) {
  .provider-grid {
    grid-template-columns: repeat(var(--grid-columns-desktop), 1fr);
  }
}

/* Spacing Utilities */
.mb-s { margin-bottom: var(--space-s); }
.mb-m { margin-bottom: var(--space-m); }
.mb-l { margin-bottom: var(--space-l); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.mt-s { margin-top: var(--space-s); }
.mt-m { margin-top: var(--space-m); }
.mt-l { margin-top: var(--space-l); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.p-s { padding: var(--space-s); }
.p-m { padding: var(--space-m); }
.p-l { padding: var(--space-l); }
.p-xl { padding: var(--space-xl); }
.p-2xl { padding: var(--space-2xl); }

/* Section Spacing */
.section {
  margin-bottom: var(--section-spacing);
}

.subsection {
  margin-bottom: var(--subsection-spacing);
}

/* Rating Component */
.rating {
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

.star-icon {
  width: 16px;
  height: 16px;
  color: #fbbf24; /* Amber star color */
}

.rating-score {
  font-size: 12px;
  font-weight: var(--fw-normal);
  color: var(--text-muted);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-s);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-badge.open {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.closed {
  background: #fecaca;
  color: #991b1b;
}

/* Mobile Responsive Adjustments */
@media (max-width: 767px) {
  :root {
    --container-padding: 16px;
    --text-2xl: 32px;
    --text-xl: 24px;
    --lh-2xl: 40px;
    --lh-xl: 32px;
    --height-search: 44px;
  }
  
  .search-container {
    flex-direction: column;
    height: auto;
  }
  
  .search-input {
    padding: var(--space-m) var(--space-l);
    border-bottom: 1px solid var(--border-alt);
  }
  
  .search-input:last-child {
    border-bottom: none;
  }
  
  .search-divider {
    display: none;
  }
  
  /* Mobile touch-friendly improvements */
  button, .btn, a[role="button"], input[type="submit"] {
    min-height: 44px !important;
    min-width: 44px !important;
    -webkit-tap-highlight-color: rgba(108, 207, 201, 0.3);
    touch-action: manipulation;
  }
  
  .appointment-slot, .time-slot, .staff-card, .service-card, .provider-card {
    min-height: 48px !important;
    -webkit-tap-highlight-color: rgba(108, 207, 201, 0.3);
    touch-action: manipulation;
    cursor: pointer;
    padding: 16px !important;
  }
  
  /* Touch feedback for interactive elements */
  .time-slot.touch-active,
  .staff-option.touch-active,
  .provider-card.touch-active,
  .service-card.touch-active {
    transform: scale(0.95);
    background-color: rgba(108, 207, 201, 0.1);
    transition: all 0.1s ease;
  }
  
  /* Prevent zoom on input focus */
  input, textarea, select {
    font-size: 16px !important;
  }
  
  /* Improve click targets */
  .calendar-day, .time-slot-btn, .booking-slot {
    padding: 16px !important;
    min-height: 48px !important;
    min-width: 48px !important;
  }
  
  /* Better mobile navigation */
  .mobile-menu-toggle {
    min-height: 48px !important;
    min-width: 48px !important;
    touch-action: manipulation;
  }
  
  /* Enhanced mobile form elements */
  .form-group {
    margin-bottom: 20px !important;
  }
  
  /* Better spacing for mobile interactions */
  .wizard-modal, .modal, .dialog {
    padding: 20px !important;
    margin: 10px !important;
  }
  
  /* Prevent double-tap zoom on fast touches - but allow touch events */
  * {
    touch-action: manipulation;
  }
  
  /* Ensure clickable elements have proper touch handling */
  button, a, [onclick], [role="button"], .btn, .chip, .card, .provider-card {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: rgba(20, 184, 166, 0.3);
    cursor: pointer;
  }
  
  /* Fix any pointer-events issues */
  button:disabled, [aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.5;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Styles */
.btn:focus,
.search-bar:focus,
.chip:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* WCAG AA Accessibility Improvements */
::placeholder {
  color: var(--text-muted);
  opacity: 1; /* Ensure consistent opacity across browsers */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --text-muted: var(--text-primary);
    --text-secondary: var(--text-primary);
  }
}

/* Ensure sufficient contrast for all interactive elements */
.text-on-colored-bg {
  color: var(--text-on-primary);
}

/* Print accessibility */
@media print {
  .text-muted,
  .text-secondary {
    color: #000000 !important;
  }
}