/* ============================================
   Responsive Breakpoints CSS
   Peter & The Foxes Band Website
   ============================================ */

/* ============================================
   Mobile First Base Styles (< 768px)
   ============================================ */

/* Booking Form - Mobile First */
.booking-container {
  padding: var(--spacing-md);
  max-width: 100%;
}

.booking-container h1 {
  font-size: 24px;
  line-height: 1.3;
  margin-bottom: var(--spacing-sm);
}

.intro-text {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: var(--spacing-lg);
}

/* Form Sections */
.form-section {
  margin-bottom: var(--spacing-lg);
}

.form-section h2 {
  font-size: 20px;
  margin-bottom: var(--spacing-md);
}

/* Form Groups - Touch Optimized */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  font-size: 16px; /* Prevent iOS zoom */
  font-weight: 600;
  display: block;
  margin-bottom: var(--spacing-xs);
}

/* City and Distance Container - Mobile: Stack vertically */
.city-distance-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* Form Inputs - Touch Friendly */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="time"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  font-size: 16px; /* Prevent iOS zoom */
  min-height: 48px; /* Touch target */
  padding: 12px 16px;
  border-radius: 8px;
}

/* Select - maintain extra right padding for dropdown icon */
.form-group select {
  padding-right: 44px; /* Consistent spacing with other field icons */
}

/* Checkboxes and Radio Buttons - Touch Optimized */
.checkbox-group,
.radio-option {
  min-height: 44px; /* Touch target */
  display: flex;
  align-items: center;
  padding: var(--spacing-xs) 0;
}

.checkbox-group input[type="checkbox"],
.radio-option input[type="radio"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  margin-right: var(--spacing-sm);
}

/* Buttons - Full Width on Mobile */
.btn-primary,
.btn-secondary,
.btn-add-song {
  width: 100%;
  min-height: 48px; /* Touch target */
  font-size: 16px;
  padding: 14px 24px;
  border-radius: 8px;
  font-weight: 600;
}

.form-actions {
  margin-top: var(--spacing-lg);
}

/* Band Configuration Options - Stacked */
.band-config-options {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

/* Band configuration options - uses standard checkbox-group layout */

/* Quote Display - Mobile Cards */
.quote-breakdown {
  padding: 0;
}

.quote-breakdown h2 {
  font-size: 22px;
  margin-bottom: var(--spacing-md);
}

.quote-summary {
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--gray-100);
  border-radius: var(--radius-lg);
}

.quote-summary p {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: var(--spacing-xs);
}

/* Pricing Tables → Cards on Mobile */
.line-items-table {
  display: block;
  width: 100%;
}

.line-items-table thead {
  display: none; /* Hide table headers on mobile */
}

.line-items-table tbody,
.line-items-table tfoot {
  display: block;
  width: 100%;
}

.line-items-table tr {
  display: block;
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--bg-white);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
}

.line-items-table td {
  display: block;
  width: 100%;
  text-align: left !important;
  padding: var(--spacing-xs) 0;
  border: none;
}

/* Add labels for mobile cards */
.line-items-table tbody td::before {
  content: attr(data-label);
  font-weight: 600;
  display: block;
  color: var(--text-medium);
  font-size: 13px;
  margin-bottom: 4px;
}

.line-items-table .line-item-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

.line-items-table .line-item-description {
  font-size: 14px;
  color: var(--text-medium);
  margin-bottom: var(--spacing-sm);
}

/* Category Subtotals - Card Style */
.category-subtotal td {
  font-size: 16px;
  font-weight: 700;
  padding: var(--spacing-sm) 0;
}

/* Totals Table - Stacked */
.totals-table {
  display: block;
  width: 100%;
}

.totals-table tr {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

.totals-table td {
  display: inline;
  padding: 0;
  border: none;
}

.totals-table .total-row,
.totals-table .grand-total-row {
  font-size: 18px;
  font-weight: 700;
  border-top: 2px solid var(--gray-800);
  border-bottom: 2px solid var(--gray-800);
  padding: var(--spacing-md) 0;
  margin-top: var(--spacing-sm);
}

.grand-total {
  color: var(--teal);
  font-size: 22px;
}

/* Financing Table - Stacked */
.financing-table {
  display: block;
  width: 100%;
}

.financing-table tr {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

.financing-table td {
  display: inline;
  padding: 0;
  border: none;
}

.financing-highlight {
  background-color: var(--teal-light);
  padding: var(--spacing-md) var(--spacing-sm) !important;
  margin: var(--spacing-xs) 0;
  border-radius: var(--radius-md);
  border: 2px solid var(--teal);
}

/* Wish Song Grid - uses base styles from components.css */

.wish-song-row input {
  width: 100%;
  font-size: 16px;
  min-height: 44px;
}

/* Error Summary - Mobile Optimized */
.error-summary {
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  border-radius: 8px;
}

.error-summary h3 {
  font-size: 18px;
  margin-bottom: var(--spacing-sm);
}

.error-summary ul {
  font-size: 15px;
  line-height: 1.6;
}

/* Loading States */
.quote-loading {
  text-align: center;
  padding: var(--spacing-xl);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--spacing-md);
  border: 4px solid var(--gray-300);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Smooth Scroll Behavior */
html {
  scroll-behavior: smooth;
}

/* Focus Styles - Accessibility */
input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

/* Skip Links for Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--teal);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* ============================================
   Tablet Breakpoint (768px - 1023px)
   ============================================ */

@media (min-width: 768px) {
  /* Header adjustments */
  .site-header {
    padding: var(--spacing-md) var(--spacing-lg);
  }

  .site-logo {
    height: 50px;
  }

  /* Hamburger menu always visible - desktop navigation removed */

  /* Booking Form - Tablet Layout */
  .booking-container {
    padding: var(--spacing-lg);
    max-width: 1200px;
    margin: 0 auto;
  }

  .booking-container h1 {
    font-size: 32px;
  }

  .intro-text {
    font-size: 18px;
  }

  .form-section h2 {
    font-size: 24px;
  }

  /* Two-Column Form Layout for Logical Groupings */
  .form-section#eventDetailsSection,
  .form-section#performanceConfigSection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
  }

  .form-section#eventDetailsSection h2,
  .form-section#performanceConfigSection h2,
  .form-section#eventDetailsSection .checkboxes-grid,
  .form-section#performanceConfigSection .checkboxes-grid {
    grid-column: 1 / -1;
  }

  /* Wish Song checkbox and grid container span full width */
  .form-section#performanceConfigSection #wishSong.checkbox-group,
  .form-section#performanceConfigSection .checkbox-group:has(#wishSong),
  .form-section#performanceConfigSection .wish-song-grid-container {
    grid-column: 1 / -1;
  }

  /* City and Distance Container - Always side by side */
  .city-distance-container {
    grid-column: 1 / -1; /* Span full width */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
  }

  /* Contact Section - Two Columns */
  .form-section#contactInfoSection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
  }

  .form-section#contactInfoSection h2,
  .form-section#contactInfoSection > p,
  .form-section#contactInfoSection .checkbox-group {
    grid-column: 1 / -1;
  }

  /* Buttons - Auto Width on Tablet */
  .btn-primary,
  .btn-secondary {
    width: auto;
    min-width: 200px;
    padding: 14px 32px;
  }

  .btn-add-song {
    width: auto;
  }

  .form-actions {
    text-align: center;
  }

  /* Two-Column Layout for Radio Groups and Checkbox Grids */
  .radio-group,
  .admin-checkboxes-group,
  .checkboxes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    align-items: start; /* Prevent grid items from stretching vertically */
  }

  /* Wish Song Grid - Two Columns */
  /* Wish song grid - keep vertical stacking */

  /* Quote Display */
  .quote-breakdown {
    padding: 0;
  }

  .quote-breakdown h2 {
    font-size: 28px;
  }

  /* Pricing Tables - Still Cards on Tablet */
  .line-items-table tr {
    padding: var(--spacing-md) var(--spacing-lg);
  }

  /* Totals and Financing - Keep Stacked */
  .totals-table tr,
  .financing-table tr {
    padding: var(--spacing-md) 0;
  }

}

/* ============================================
   Desktop Breakpoint (1024px+)
   ============================================ */

@media (min-width: 1024px) {
  /* Header adjustments */
  .site-header {
    padding: var(--spacing-md) var(--spacing-xl);
  }

  .site-logo {
    height: 90px;
  }

  .header-container {
    gap: var(--spacing-xl);
  }

  /* Navigation spacing */
  .nav-list {
    gap: var(--spacing-xl);
  }

  .nav-link {
    font-size: 18px;
  }

  /* Booking Form - Desktop Layout */
  .booking-container {
    padding: var(--spacing-xl);
    max-width: 1200px;
  }

  .booking-container h1 {
    font-size: 36px;
  }

  .intro-text {
    font-size: 18px;
    margin-bottom: var(--spacing-xl);
  }

  .form-section h2 {
    font-size: 26px;
    margin-bottom: var(--spacing-lg);
  }

  /* Form Inputs - Comfortable Desktop Spacing */
  .form-group input[type="text"],
  .form-group input[type="email"],
  .form-group input[type="date"],
  .form-group input[type="time"],
  .form-group input[type="number"],
  .form-group select {
    min-height: 44px;
    padding: 10px 16px;
  }

  /* Select - maintain extra right padding for dropdown icon */
  .form-group select {
    padding-right: 44px; /* Consistent spacing with other field icons */
  }

  /* Buttons - Optimal Desktop Size */
  .btn-primary,
  .btn-secondary {
    min-width: 240px;
    padding: 14px 40px;
    font-size: 18px;
  }

  /* Pricing Tables - Restore Full Table Layout */
  .line-items-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
  }

  .line-items-table thead {
    display: table-header-group;
  }

  .line-items-table tbody {
    display: table-row-group;
  }

  .line-items-table tfoot {
    display: table-footer-group;
  }

  .line-items-table tr {
    display: table-row;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
  }

  .line-items-table td {
    display: table-cell;
    width: auto;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid #eee;
  }

  .line-items-table th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    background-color: #f8f9fa;
    border-bottom: 2px solid #333;
  }

  /* Remove mobile card labels */
  .line-items-table tbody td::before {
    content: none;
    display: none;
  }

  /* Restore table alignment */
  .line-items-table .text-right {
    text-align: right !important;
  }

  .line-items-table .text-center {
    text-align: center !important;
  }

  .line-items-table .text-left {
    text-align: left !important;
  }

  /* Line item styling */
  .line-items-table .line-item-name {
    font-size: 15px;
    margin-bottom: 4px;
  }

  .line-items-table .line-item-description {
    font-size: 13px;
    margin-bottom: 0;
  }

  /* Category subtotals */
  .category-subtotal {
    border-top: 2px solid #333;
    background-color: #f8f9fa;
  }

  .category-subtotal td {
    font-size: 15px;
    padding: var(--spacing-md) !important;
  }

  /* Totals Table - Restore Table Layout */
  .totals-table {
    display: table;
    width: 100%;
    max-width: 500px;
    margin: var(--spacing-lg) 0 0 auto;
  }

  .totals-table tr {
    display: table-row;
    border-bottom: 1px solid #eee;
    padding: 0;
  }

  .totals-table td {
    display: table-cell;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-bottom: 1px solid #eee;
  }

  .totals-table td:first-child {
    text-align: left;
  }

  .totals-table td:last-child {
    text-align: right;
  }

  .totals-table .total-row td,
  .totals-table .grand-total-row td {
    padding: var(--spacing-md);
  }

  /* Financing Table - Restore Table Layout */
  .financing-table {
    display: table;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
  }

  .financing-table tr {
    display: table-row;
    padding: 0;
    border-bottom: 1px solid #eee;
  }

  .financing-table td {
    display: table-cell;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-bottom: 1px solid #eee;
  }

  .financing-table td:first-child {
    text-align: left;
  }

  .financing-table td:last-child {
    text-align: right;
  }

  .financing-highlight td {
    padding: var(--spacing-md) !important;
  }

  .financing-note td {
    font-size: 14px;
    color: #666;
    font-style: italic;
    padding: var(--spacing-xs) var(--spacing-md) var(--spacing-md) var(--spacing-md);
    border-bottom: none;
  }

  /* Wish Song Grid - Four Columns on Desktop */
  /* Wish song grid - keep vertical stacking */

  /* Quote Display - Desktop Enhancements */
  .quote-breakdown {
    padding: 0;
  }

  .quote-breakdown h2 {
    font-size: 32px;
  }

  .quote-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
  }

  .quote-summary p {
    font-size: 16px;
  }

  /* Loading Spinner - Larger on Desktop */
  .loading-spinner {
    width: 64px;
    height: 64px;
    border-width: 5px;
  }

}

/* ============================================
   Large Desktop (1440px+)
   ============================================ */

@media (min-width: 1440px) {
  .header-container,
  .footer-container {
    max-width: 1400px;
  }
}

/* ============================================
   Mobile Small (< 375px)
   ============================================ */

@media (max-width: 374px) {
  .site-logo {
    height: 35px;
  }

  .site-header {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .nav-link,
  .mobile-nav-link {
    font-size: 16px;
  }

  .footer-cta h3 {
    font-size: 20px;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .site-header,
  .site-footer,
  .mobile-menu,
  .hamburger-btn,
  .social-links {
    display: none;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }
}

/* ============================================
   Reduced Motion Preference
   ============================================ */

@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;
  }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */

@media (prefers-contrast: high) {
  .nav-link:hover,
  .mobile-nav-link:hover {
    outline: 2px solid currentColor;
  }

  .btn-footer-cta {
    border: 2px solid var(--white);
  }
}
