/* ===== YVAPE Registration System - Responsive Design ===== */

/* ===== CSS Custom Properties (Design System) ===== */
:root {
  /* YVAPE brand palette — cyan + magenta from yvape.org */
  --yvape-primary: #00B5CC;
  --yvape-primary-dark: #008FA3;
  --yvape-primary-rgb: 0, 181, 204;
  --yvape-accent: #E6007E;
  --yvape-accent-dark: #B3005F;
  --yvape-accent-rgb: 230, 0, 126;
  --yvape-success: #34C759;
  --yvape-warning: #FF9500;
  --yvape-error: #FF3B30;
  --yvape-background: #F2F2F7;
  --yvape-surface: #FFFFFF;
  --yvape-text-primary: #1C1C1E;
  --yvape-text-secondary: #8E8E93;
  --yvape-border: #C6C6C8;
  --yvape-border-light: #E5E5EA;
  
  /* Typography scale */
  --yvape-font-size-xs: 0.75rem;    /* 12px */
  --yvape-font-size-sm: 0.875rem;   /* 14px */
  --yvape-font-size-base: 1rem;     /* 16px */
  --yvape-font-size-lg: 1.125rem;   /* 18px */
  --yvape-font-size-xl: 1.25rem;    /* 20px */
  --yvape-font-size-2xl: 1.5rem;    /* 24px */
  --yvape-font-size-3xl: 2rem;      /* 32px */
  
  /* Spacing scale */
  --yvape-space-1: 0.25rem;   /* 4px */
  --yvape-space-2: 0.5rem;    /* 8px */
  --yvape-space-3: 0.75rem;   /* 12px */
  --yvape-space-4: 1rem;      /* 16px */
  --yvape-space-5: 1.25rem;   /* 20px */
  --yvape-space-6: 1.5rem;    /* 24px */
  --yvape-space-8: 2rem;      /* 32px */
  --yvape-space-10: 2.5rem;   /* 40px */
  --yvape-space-12: 3rem;     /* 48px */
  
  /* Border radius */
  --yvape-radius-sm: 0.375rem;  /* 6px */
  --yvape-radius: 0.5rem;       /* 8px */
  --yvape-radius-lg: 0.75rem;   /* 12px */
  --yvape-radius-xl: 1rem;      /* 16px */
  
  /* Shadows */
  --yvape-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --yvape-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --yvape-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Transitions */
  --yvape-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --yvape-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Base Styles ===== */
html {
  font-size: 14px;
  scroll-behavior: smooth;
}

@media (min-width: 576px) {
  html {
    font-size: 15px;
  }
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--yvape-background);
  color: var(--yvape-text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Focus Management for Accessibility ===== */
.btn:focus, 
.btn:active:focus, 
.btn-link.nav-link:focus, 
.form-control:focus, 
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--yvape-primary);
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--yvape-primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--yvape-radius);
  z-index: 1000;
  transition: var(--yvape-transition-fast);
}

.skip-link:focus {
  top: 6px;
}

/* ===== Enhanced Navigation ===== */
.navbar {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid var(--yvape-border-light);
  box-shadow: var(--yvape-shadow-sm);
  padding: var(--yvape-space-3) 0;
}

.navbar-brand {
  font-weight: 600;
  font-size: var(--yvape-font-size-lg);
  color: var(--yvape-primary) !important;
  transition: var(--yvape-transition-fast);
}

.navbar-brand:hover {
  color: var(--yvape-primary-dark) !important;
  transform: translateY(-1px);
}

.nav-link {
  font-weight: 500;
  color: var(--yvape-text-primary) !important;
  padding: var(--yvape-space-2) var(--yvape-space-3) !important;
  border-radius: var(--yvape-radius);
  transition: var(--yvape-transition-fast);
  position: relative;
}

.nav-link:hover {
  color: var(--yvape-primary) !important;
  background-color: rgba(var(--yvape-primary-rgb), 0.1);
}

.nav-link[aria-current="page"] {
  color: var(--yvape-primary) !important;
  background-color: rgba(var(--yvape-primary-rgb), 0.1);
}

/* ===== Progress Indicator - Enhanced Responsive Design ===== */
.progress-container {
  margin: var(--yvape-space-6) 0 var(--yvape-space-8);
  padding: 0 var(--yvape-space-4);
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin: 0 auto;
  max-width: 100%;
  overflow-x: auto;
  padding: var(--yvape-space-4) 0;
}

.progress-steps::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(to right, var(--yvape-border-light) 0%, var(--yvape-border-light) 100%);
  z-index: 1;
  transform: translateY(-50%);
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  background-color: var(--yvape-background);
  padding: 0 var(--yvape-space-2);
  min-width: 80px;
  flex-shrink: 0;
}

.step-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--yvape-border-light);
  color: var(--yvape-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--yvape-font-size-sm);
  margin-bottom: var(--yvape-space-2);
  transition: var(--yvape-transition);
  border: 2px solid transparent;
}

.step-label {
  font-size: var(--yvape-font-size-xs);
  color: var(--yvape-text-secondary);
  text-align: center;
  font-weight: 500;
  line-height: 1.3;
  transition: var(--yvape-transition);
}

.step.active .step-number {
  background-color: var(--yvape-primary);
  color: white;
  border-color: var(--yvape-primary);
  box-shadow: 0 0 0 4px rgba(var(--yvape-primary-rgb), 0.2);
}

.step.active .step-label {
  color: var(--yvape-primary);
  font-weight: 600;
}

.step.completed .step-number {
  background-color: var(--yvape-success);
  color: white;
  border-color: var(--yvape-success);
}

.step.completed .step-label {
  color: var(--yvape-success);
  font-weight: 600;
}

/* ===== Card Components - Apple-Inspired Design ===== */
.card {
  border: none;
  border-radius: var(--yvape-radius-lg);
  box-shadow: var(--yvape-shadow);
  background-color: var(--yvape-surface);
  overflow: hidden;
  transition: var(--yvape-transition);
}

.card:hover {
  box-shadow: var(--yvape-shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  background: linear-gradient(135deg, var(--yvape-primary) 0%, var(--yvape-accent) 100%);
  border-bottom: none;
  padding: var(--yvape-space-6);
  color: white;
}

.card-header h2,
.card-header .h4 {
  font-weight: 600;
  font-size: var(--yvape-font-size-xl);
  margin-bottom: var(--yvape-space-2);
}

.card-header p {
  opacity: 0.9;
  font-size: var(--yvape-font-size-sm);
  margin-bottom: 0;
}

.card-body {
  padding: var(--yvape-space-8);
}

/* ===== Form Sections ===== */
.form-section {
  border-bottom: 1px solid var(--yvape-border-light);
  padding-bottom: var(--yvape-space-6);
  margin-bottom: var(--yvape-space-6);
}

.form-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.section-title {
  color: var(--yvape-text-primary);
  font-weight: 600;
  margin-bottom: var(--yvape-space-4);
  font-size: var(--yvape-font-size-lg);
}

/* ===== Enhanced Form Controls ===== */
.form-label {
  font-weight: 500;
  color: var(--yvape-text-primary);
  margin-bottom: var(--yvape-space-2);
  font-size: var(--yvape-font-size-sm);
}

.form-control,
.form-select {
  border: 1.5px solid var(--yvape-border);
  border-radius: var(--yvape-radius);
  padding: var(--yvape-space-3) var(--yvape-space-4);
  font-size: var(--yvape-font-size-base);
  transition: var(--yvape-transition);
  background-color: var(--yvape-surface);
  min-height: 44px; /* Touch-friendly minimum */
}

.form-control:focus,
.form-select:focus {
  border-color: var(--yvape-primary);
  box-shadow: 0 0 0 3px rgba(var(--yvape-primary-rgb), 0.1);
  outline: none;
}

.form-control::placeholder {
  color: var(--yvape-text-secondary);
  opacity: 0.8;
}

/* ===== Enhanced Buttons ===== */
.btn {
  font-weight: 500;
  border-radius: var(--yvape-radius);
  padding: var(--yvape-space-3) var(--yvape-space-6);
  font-size: var(--yvape-font-size-base);
  transition: var(--yvape-transition);
  border: none;
  min-height: 44px; /* Touch-friendly */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--yvape-primary) 0%, var(--yvape-primary-dark) 100%);
  color: white;
  box-shadow: var(--yvape-shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--yvape-primary-dark) 0%, #006c7a 100%);
  transform: translateY(-1px);
  box-shadow: var(--yvape-shadow);
  color: white;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--yvape-shadow-sm);
}

.btn-outline-secondary {
  border: 1.5px solid var(--yvape-border);
  color: var(--yvape-text-primary);
  background-color: var(--yvape-surface);
}

.btn-outline-secondary:hover {
  background-color: var(--yvape-text-primary);
  border-color: var(--yvape-text-primary);
  color: white;
  transform: translateY(-1px);
}

.btn-lg {
  padding: var(--yvape-space-4) var(--yvape-space-8);
  font-size: var(--yvape-font-size-lg);
  min-height: 52px;
}

/* ===== School Search Results ===== */
.school-results {
  position: relative;
  z-index: 1000;
  margin-top: var(--yvape-space-2);
}

.school-item {
  cursor: pointer;
  transition: var(--yvape-transition);
  border: none !important;
  border-radius: var(--yvape-radius) !important;
  margin-bottom: var(--yvape-space-1);
}

.school-item:hover {
  background-color: rgba(var(--yvape-primary-rgb), 0.05);
  transform: translateX(4px);
}

.selected-school {
  margin-top: var(--yvape-space-4);
  background-color: #e6f4ea;
  border: 1px solid #b7e1c4;
  border-radius: var(--yvape-radius);
  padding: var(--yvape-space-3) var(--yvape-space-4);
}

/* ===== Alert Components ===== */
.alert {
  border: none;
  border-radius: var(--yvape-radius-lg);
  padding: var(--yvape-space-4) var(--yvape-space-5);
  font-size: var(--yvape-font-size-sm);
}

.alert-success {
  background-color: rgba(52, 199, 89, 0.1);
  color: #1b5e20;
  border-left: 4px solid var(--yvape-success);
}

.alert-info {
  background-color: rgba(var(--yvape-primary-rgb), 0.1);
  color: #00566b;
  border-left: 4px solid var(--yvape-primary);
}

.alert-danger {
  background-color: rgba(255, 59, 48, 0.1);
  color: #c62828;
  border-left: 4px solid var(--yvape-error);
}

/* ===== Responsive Breakpoints ===== */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  .progress-container {
    padding: 0 var(--yvape-space-6);
  }
  
  .card-body {
    padding: var(--yvape-space-10);
  }
  
  .step-label {
    font-size: var(--yvape-font-size-sm);
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .progress-steps::before {
    left: 8%;
    right: 8%;
  }
  
  .step {
    min-width: 100px;
  }
  
  .step-number {
    width: 48px;
    height: 48px;
    font-size: var(--yvape-font-size-base);
  }
  
  .step-label {
    font-size: var(--yvape-font-size-sm);
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .progress-steps {
    max-width: 800px;
  }
  
  .step {
    min-width: 120px;
  }
  
  .card-body {
    padding: var(--yvape-space-12);
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .progress-steps {
    max-width: 900px;
  }
}

/* ===== Mobile-First Responsive Adjustments ===== */

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
  .container-fluid {
    padding-left: var(--yvape-space-3);
    padding-right: var(--yvape-space-3);
  }
  
  .card {
    margin-left: calc(-1 * var(--yvape-space-3));
    margin-right: calc(-1 * var(--yvape-space-3));
    border-radius: 0;
  }
  
  .card-header {
    padding: var(--yvape-space-4);
  }
  
  .card-body {
    padding: var(--yvape-space-4);
  }
  
  .progress-container {
    margin: var(--yvape-space-4) 0 var(--yvape-space-6);
    padding: 0;
  }
  
  .progress-steps {
    padding: var(--yvape-space-2) 0;
    gap: var(--yvape-space-2);
  }
  
  .progress-steps::before {
    display: none;
  }
  
  .step {
    min-width: 60px;
    padding: 0 var(--yvape-space-1);
  }
  
  .step-number {
    width: 36px;
    height: 36px;
    font-size: var(--yvape-font-size-xs);
  }
  
  .step-label {
    font-size: var(--yvape-font-size-xs);
    display: none; /* Hide labels on very small screens */
  }
  
  .btn {
    width: 100%;
    margin-bottom: var(--yvape-space-2);
  }
  
  .d-flex.justify-content-between .btn {
    width: auto;
    flex: 1;
  }
  
  .d-flex.justify-content-between .btn:first-child {
    margin-right: var(--yvape-space-2);
  }
  
  .section-title {
    font-size: var(--yvape-font-size-base);
  }
  
  .form-section {
    padding-bottom: var(--yvape-space-4);
    margin-bottom: var(--yvape-space-4);
  }
}

/* ===== Print Styles ===== */
@media print {
  .btn, 
  .alert-primary, 
  .progress-container,
  .navbar,
  footer {
    display: none !important;
  }
  
  .card {
    border: 1px solid #000;
    box-shadow: none;
    page-break-inside: avoid;
  }
  
  .card-header {
    background-color: transparent !important;
    color: black !important;
    border-bottom: 2px solid #000;
  }
  
  body {
    background-color: white !important;
    color: black !important;
  }
}

/* ===== High Contrast Mode Support ===== */
@media (prefers-contrast: high) {
  :root {
    --yvape-primary: #006680;
    --yvape-primary-rgb: 0, 102, 128;
    --yvape-accent: #99004F;
    --yvape-accent-rgb: 153, 0, 79;
    --yvape-success: #008000;
    --yvape-error: #FF0000;
    --yvape-text-primary: #000000;
    --yvape-text-secondary: #666666;
    --yvape-border: #000000;
  }
  
  .form-control,
  .form-select {
    border-width: 2px;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}

/* ===== Reduced Motion Support ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .step-number,
  .btn,
  .form-control,
  .card {
    transition: none;
  }
}

/* Print Styles */
@media print {
  .btn, .alert-primary, .progress-container {
    display: none !important;
  }
  
  .card {
    border: none;
    box-shadow: none;
  }
  
  .card-header {
    background-color: transparent !important;
    color: black !important;
    border-bottom: 2px solid #000;
  }
}

/* Enhanced Validation Styles */

/* Form validation states */
.form-control.is-valid,
.form-select.is-valid {
  border-color: #198754;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.94-.94 1.38 1.38 3.22-3.22.94.94-4.16 4.16z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #dc3545;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4m0-2.4L5.8 7'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-check-input.is-valid {
  border-color: #198754;
}

.form-check-input.is-invalid {
  border-color: #dc3545;
}

/* Validation feedback */
.valid-feedback {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: #198754;
}

.invalid-feedback {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: #dc3545;
}

/* Form group error state */
.form-group.has-error .form-label {
  color: #dc3545;
}

.form-group.has-error .form-control {
  border-color: #dc3545;
}

/* Real-time validation animations */
.form-control {
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-image 0.15s ease-in-out;
}

.form-control:focus {
  border-color: var(--yvape-primary);
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(var(--yvape-primary-rgb), 0.25);
}

.form-control.is-valid:focus {
  border-color: #198754;
  box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}

.form-control.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Loading states for form submission */
.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Validation summary styling */
#validationSummary {
  margin-bottom: 1rem;
}

#validationSummary ul {
  margin-bottom: 0;
  padding-left: 1.5rem;
}

#validationSummary li {
  margin-bottom: 0.25rem;
}

/* Age display styling */
#ageDisplay {
  font-weight: 500;
  margin-top: 0.25rem;
}

#ageDisplay.text-success {
  color: #198754 !important;
}

#ageDisplay.text-danger {
  color: #dc3545 !important;
}

#ageDisplay.text-warning {
  color: #ffc107 !important;
}

/* Checkbox and radio validation */
.form-check-input.is-invalid ~ .form-check-label {
  color: #dc3545;
}

.form-check-input.is-valid ~ .form-check-label {
  color: #198754;
}

/* Enhanced focus states for accessibility */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

/* Responsive validation adjustments */
@media (max-width: 576px) {
  .invalid-feedback,
  .valid-feedback {
    font-size: 0.8rem;
  }
  
  .form-control.is-valid,
  .form-control.is-invalid,
  .form-select.is-valid,
  .form-select.is-invalid {
    padding-right: calc(1.2em + 0.6rem);
    background-size: calc(0.6em + 0.3rem) calc(0.6em + 0.3rem);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .form-control.is-valid {
    border-color: #000;
    background-color: #e6ffe6;
  }
  
  .form-control.is-invalid {
    border-color: #000;
    background-color: #ffe6e6;
  }
  
  .invalid-feedback {
    color: #000;
    font-weight: bold;
  }
  
  .valid-feedback {
    color: #000;
    font-weight: bold;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .form-control,
  .btn {
    transition: none;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
  }
}
/* Error Page Styles */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem;
}

.error-content {
    text-align: center;
    max-width: 600px;
}

.error-icon {
    margin-bottom: 2rem;
}

.error-title {
    font-size: 2.5rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.2rem;
    color: #6c757d;
    margin-bottom: 2rem;
}

.error-actions {
    margin-bottom: 2rem;
}

.error-actions .btn {
    margin: 0 0.5rem;
    padding: 0.75rem 1.5rem;
}

.error-suggestions {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.error-suggestions h5 {
    color: #495057;
    margin-bottom: 1rem;
}

.error-suggestions p {
    margin-bottom: 1rem;
}

.error-suggestions ul {
    margin-bottom: 0;
}

.error-suggestions li {
    margin-bottom: 0.5rem;
}

.error-details {
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

/* Error page responsive design */
@media (max-width: 768px) {
    .error-title {
        font-size: 2rem;
    }
    
    .error-message {
        font-size: 1rem;
    }
    
    .error-actions .btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
    }
}

/* ===== Enhanced Form Validation Styles ===== */

/* Form validation states */
.form-control.is-valid,
.form-select.is-valid {
  border-color: var(--yvape-success);
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2334C759' d='m2.3 6.73.94-.94 1.38 1.38 3.22-3.22.94.94-4.16 4.16z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--yvape-error);
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23FF3B30'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 2.4 2.4m0-2.4L5.8 7'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-check-input.is-valid {
  border-color: var(--yvape-success);
}

.form-check-input.is-invalid {
  border-color: var(--yvape-error);
}

/* Enhanced form check styling */
.form-check-input {
  width: 1.25em;
  height: 1.25em;
  margin-top: 0.125em;
  border: 1.5px solid var(--yvape-border);
  border-radius: var(--yvape-radius-sm);
  transition: var(--yvape-transition);
}

.form-check-input:checked {
  background-color: var(--yvape-primary);
  border-color: var(--yvape-primary);
}

.form-check-input:focus {
  border-color: var(--yvape-primary);
  box-shadow: 0 0 0 3px rgba(var(--yvape-primary-rgb), 0.1);
}

.form-check-label {
  font-size: var(--yvape-font-size-sm);
  color: var(--yvape-text-primary);
  margin-left: var(--yvape-space-2);
  line-height: 1.5;
}

/* Validation feedback */
.valid-feedback {
  display: block;
  width: 100%;
  margin-top: var(--yvape-space-1);
  font-size: var(--yvape-font-size-sm);
  color: var(--yvape-success);
  font-weight: 500;
}

.invalid-feedback {
  display: block;
  width: 100%;
  margin-top: var(--yvape-space-1);
  font-size: var(--yvape-font-size-sm);
  color: var(--yvape-error);
  font-weight: 500;
}

.text-danger {
  color: var(--yvape-error) !important;
  font-size: var(--yvape-font-size-sm);
  font-weight: 500;
  margin-top: var(--yvape-space-1);
  display: block;
}

/* Form group error state */
.form-group.has-error .form-label {
  color: var(--yvape-error);
}

.form-group.has-error .form-control {
  border-color: var(--yvape-error);
}

/* Real-time validation animations */
.form-control.is-valid:focus {
  border-color: var(--yvape-success);
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

.form-control.is-invalid:focus {
  border-color: var(--yvape-error);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.1);
}

/* ===== Appointment Slots - Enhanced Styling ===== */
.appointment-slots {
  max-height: 400px;
  overflow-y: auto;
  border: 1.5px solid var(--yvape-border-light);
  border-radius: var(--yvape-radius-lg);
  padding: var(--yvape-space-4);
  background-color: var(--yvape-background);
  margin-top: var(--yvape-space-4);
}

.appointment-slot {
  padding: var(--yvape-space-4);
  border: 1.5px solid var(--yvape-border-light);
  border-radius: var(--yvape-radius);
  margin-bottom: var(--yvape-space-3);
  transition: var(--yvape-transition);
  background-color: var(--yvape-surface);
  cursor: pointer;
}

.appointment-slot:hover {
  background-color: rgba(var(--yvape-primary-rgb), 0.05);
  border-color: var(--yvape-primary);
  transform: translateY(-1px);
  box-shadow: var(--yvape-shadow-sm);
}

.appointment-slot.selected {
  border-color: var(--yvape-primary);
  background-color: rgba(var(--yvape-primary-rgb), 0.1);
  box-shadow: 0 0 0 3px rgba(var(--yvape-primary-rgb), 0.1);
}

.appointment-slot input[type="radio"]:checked + label {
  color: var(--yvape-primary);
  font-weight: 600;
}

.appointment-slot .form-check-input:checked {
  background-color: var(--yvape-primary);
  border-color: var(--yvape-primary);
}

.appointment-details {
  margin-left: var(--yvape-space-6);
  color: var(--yvape-text-secondary);
  font-size: var(--yvape-font-size-sm);
}

/* ===== Summary Sections ===== */
.summary-section {
  border-bottom: 1px solid var(--yvape-border-light);
  padding-bottom: var(--yvape-space-6);
  margin-bottom: var(--yvape-space-6);
}

.summary-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.summary-section h6 {
  color: var(--yvape-text-primary);
  font-weight: 600;
  margin-bottom: var(--yvape-space-3);
  font-size: var(--yvape-font-size-base);
}

.summary-section p {
  color: var(--yvape-text-secondary);
  margin-bottom: var(--yvape-space-2);
  font-size: var(--yvape-font-size-sm);
}

/* ===== Loading States ===== */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Validation Summary Styling ===== */
#validationSummary {
  margin-bottom: var(--yvape-space-4);
}

#validationSummary ul {
  margin-bottom: 0;
  padding-left: var(--yvape-space-6);
}

#validationSummary li {
  margin-bottom: var(--yvape-space-1);
  font-size: var(--yvape-font-size-sm);
}

/* ===== Age Display Styling ===== */
#ageDisplay {
  font-weight: 500;
  margin-top: var(--yvape-space-1);
  font-size: var(--yvape-font-size-sm);
}

#ageDisplay.text-success {
  color: var(--yvape-success) !important;
}

#ageDisplay.text-danger {
  color: var(--yvape-error) !important;
}

#ageDisplay.text-warning {
  color: var(--yvape-warning) !important;
}

/* ===== Checkbox and Radio Validation ===== */
.form-check-input.is-invalid ~ .form-check-label {
  color: var(--yvape-error);
}

.form-check-input.is-valid ~ .form-check-label {
  color: var(--yvape-success);
}

/* ===== Error Page Styles ===== */
.error-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: var(--yvape-space-8);
}

.error-content {
  text-align: center;
  max-width: 600px;
}

.error-icon {
  margin-bottom: var(--yvape-space-8);
  font-size: var(--yvape-font-size-3xl);
  color: var(--yvape-text-secondary);
}

.error-title {
  font-size: var(--yvape-font-size-3xl);
  font-weight: 600;
  color: var(--yvape-text-primary);
  margin-bottom: var(--yvape-space-4);
}

.error-message {
  font-size: var(--yvape-font-size-lg);
  color: var(--yvape-text-secondary);
  margin-bottom: var(--yvape-space-8);
  line-height: 1.6;
}

.error-actions {
  margin-bottom: var(--yvape-space-8);
}

.error-actions .btn {
  margin: 0 var(--yvape-space-2);
  padding: var(--yvape-space-3) var(--yvape-space-6);
}

.error-suggestions {
  background-color: var(--yvape-surface);
  border-radius: var(--yvape-radius-lg);
  padding: var(--yvape-space-6);
  margin-bottom: var(--yvape-space-8);
  text-align: left;
  border: 1px solid var(--yvape-border-light);
}

.error-suggestions h5 {
  color: var(--yvape-text-primary);
  margin-bottom: var(--yvape-space-4);
  font-weight: 600;
}

.error-suggestions p {
  margin-bottom: var(--yvape-space-3);
  color: var(--yvape-text-secondary);
}

.error-suggestions ul {
  margin-bottom: 0;
  padding-left: var(--yvape-space-5);
}

.error-suggestions li {
  margin-bottom: var(--yvape-space-2);
  color: var(--yvape-text-secondary);
}

.error-details {
  padding-top: var(--yvape-space-4);
  border-top: 1px solid var(--yvape-border-light);
  font-size: var(--yvape-font-size-sm);
  color: var(--yvape-text-secondary);
}

/* ===== Form Text and Help Text ===== */
.form-text {
  font-size: var(--yvape-font-size-xs);
  color: var(--yvape-text-secondary);
  margin-top: var(--yvape-space-1);
  line-height: 1.4;
}

/* ===== List Group Enhancements ===== */
.list-group-item {
  border: 1px solid var(--yvape-border-light);
  border-radius: var(--yvape-radius) !important;
  margin-bottom: var(--yvape-space-1);
  transition: var(--yvape-transition);
}

.list-group-item:hover {
  background-color: rgba(var(--yvape-primary-rgb), 0.05);
  border-color: var(--yvape-primary);
}

.list-group-item-action:focus {
  background-color: rgba(var(--yvape-primary-rgb), 0.1);
  border-color: var(--yvape-primary);
  box-shadow: 0 0 0 3px rgba(var(--yvape-primary-rgb), 0.1);
}

/* ===== Mobile-Specific Responsive Adjustments ===== */
@media (max-width: 575.98px) {
  .error-title {
    font-size: var(--yvape-font-size-2xl);
  }
  
  .error-message {
    font-size: var(--yvape-font-size-base);
  }
  
  .error-actions .btn {
    display: block;
    width: 100%;
    margin: var(--yvape-space-2) 0;
  }
  
  .appointment-slots {
    max-height: 250px;
    padding: var(--yvape-space-3);
  }
  
  .appointment-slot {
    padding: var(--yvape-space-3);
  }
  
  .appointment-details {
    margin-left: var(--yvape-space-4);
  }
  
  .invalid-feedback,
  .valid-feedback,
  .text-danger {
    font-size: var(--yvape-font-size-xs);
  }
  
  .form-control.is-valid,
  .form-control.is-invalid,
  .form-select.is-valid,
  .form-select.is-invalid {
    padding-right: calc(1.2em + 0.6rem);
    background-size: calc(0.6em + 0.3rem) calc(0.6em + 0.3rem);
  }
  
  .form-check-input {
    width: 1.1em;
    height: 1.1em;
  }
}

/* ===== Dark Mode Support (Future Enhancement) ===== */
@media (prefers-color-scheme: dark) {
  /* This can be implemented later if needed */
  /* Currently maintaining light theme for consistency */
}

/* ===== Focus Visible for Better Keyboard Navigation ===== */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
  outline: 2px solid var(--yvape-primary);
  outline-offset: 2px;
}

/* ===== Utility Classes for Responsive Design ===== */
.text-responsive {
  font-size: var(--yvape-font-size-sm);
}

@media (min-width: 768px) {
  .text-responsive {
    font-size: var(--yvape-font-size-base);
  }
}

.spacing-responsive {
  margin-bottom: var(--yvape-space-4);
}

@media (min-width: 768px) {
  .spacing-responsive {
    margin-bottom: var(--yvape-space-6);
  }
}

/* ===== Animation Performance Optimizations ===== */
.step-number,
.btn,
.form-control,
.card,
.appointment-slot {
  will-change: transform;
}

/* Remove will-change after animations complete */
.step-number:not(:hover):not(:focus),
.btn:not(:hover):not(:focus),
.form-control:not(:focus),
.card:not(:hover),
.appointment-slot:not(:hover) {
  will-change: auto;
}
/* ===== Screen Reader Only Content ===== */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sr-only-focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: inherit !important;
  margin: inherit !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* ===== Enhanced Focus Indicators for WCAG 2.1 AA ===== */
*:focus {
  outline: 2px solid var(--yvape-primary);
  outline-offset: 2px;
}

/* Remove default focus outline for mouse users, keep for keyboard users */
*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--yvape-primary);
  outline-offset: 2px;
}

/* ===== High Contrast Focus Indicators ===== */
@media (prefers-contrast: high) {
  *:focus,
  *:focus-visible {
    outline: 3px solid #000000;
    outline-offset: 2px;
  }
}

/* ===== Accessible Color Contrast ===== */
/* Ensure all text meets WCAG 2.1 AA contrast requirements */
.text-muted {
  color: #6c757d !important; /* 4.5:1 contrast ratio on white background */
}

.form-text {
  color: #6c757d !important; /* 4.5:1 contrast ratio */
}

/* ===== Live Region Styling ===== */
[aria-live] {
  /* Ensure live regions are not visually distracting */
  font-weight: normal;
}

[aria-live="assertive"] {
  font-weight: 600; /* Make assertive announcements slightly more prominent */
}

/* ===== Enhanced Form Accessibility ===== */
fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

legend {
  font-size: inherit;
  font-weight: 600;
  padding: 0;
  margin-bottom: var(--yvape-space-4);
  width: 100%;
}

/* ===== Required Field Indicators ===== */
/* Required-asterisks (rendered with aria-label="required") must always
   sit inline next to whatever they're marking, regardless of whether
   the parent is a .form-label or a section subhead. Overrides the
   general .text-danger { display: block } rule above. */
.text-danger[aria-label="required"] {
  font-size: 1.2em;
  margin-left: var(--yvape-space-1);
  margin-top: 0;
  display: inline;
}

/* ===== Error Message Styling ===== */
[role="alert"] {
  font-weight: 500;
}

.invalid-feedback[role="alert"] {
  display: block;
  font-weight: 500;
}

/* ===== Combobox and Listbox Styling ===== */
[role="combobox"] {
  position: relative;
}

[role="listbox"] {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--yvape-border);
  border-radius: var(--yvape-radius);
  background: var(--yvape-surface);
}

[role="option"] {
  padding: var(--yvape-space-3);
  cursor: pointer;
  border-bottom: 1px solid var(--yvape-border-light);
}

[role="option"]:last-child {
  border-bottom: none;
}

[role="option"]:hover,
[role="option"]:focus {
  background-color: rgba(var(--yvape-primary-rgb), 0.1);
  outline: none;
}

[role="option"][aria-selected="true"] {
  background-color: var(--yvape-primary);
  color: white;
}

/* ===== Progress Indicator Accessibility ===== */
[role="progressbar"] {
  /* Ensure progress is announced to screen readers */
}

/* ===== Button Accessibility Enhancements ===== */
.btn[aria-describedby] {
  /* Buttons with descriptions get subtle visual indicator */
  position: relative;
}

/* ===== Mobile Accessibility Improvements ===== */
@media (max-width: 575.98px) {
  /* Larger touch targets for mobile */
  .btn,
  .form-control,
  .form-select,
  .form-check-input {
    min-height: 44px;
    min-width: 44px;
  }
  
  .form-check-input {
    width: 1.5em;
    height: 1.5em;
  }
  
  /* Larger focus indicators on mobile */
  *:focus,
  *:focus-visible {
    outline-width: 3px;
    outline-offset: 3px;
  }
}

/* ===== Reduced Motion Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  /* Remove all animations for users who prefer reduced motion */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  /* Keep focus transitions for accessibility */
  *:focus,
  *:focus-visible {
    transition: outline 0.15s ease-in-out;
  }
}

/* ===== Print Accessibility ===== */
@media print {
  /* Ensure focus indicators are visible in print */
  *:focus {
    outline: 2px solid #000 !important;
  }
  
  /* Make sure required indicators are visible */
  .text-danger[aria-label="required"] {
    color: #000 !important;
    font-weight: bold !important;
  }
  
  /* Ensure form structure is clear in print */
  fieldset {
    border: 1px solid #000 !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  legend {
    font-weight: bold !important;
    border-bottom: 1px solid #000 !important;
    padding-bottom: 0.5rem !important;
  }
}