/**
 * Improved Booking Form Instant - CSS
 * Based on refined UX patterns with trust building and progressive disclosure
 * 
 * @package TravelerChildTheme
 * @subpackage BookingStyles
 * @since 2.0.0
 */

/* --- CSS Custom Properties --- */
:root {
  --primary-blue: #324fbe;
  --primary-blue-hover: #2a42a1;
  --success-green: #10b981;
  --success-green-dark: #059669;
  --border-color: #E5E7EB;
  --text-muted: #6b7280;
  --text-dark: #1f2937;
  --bg-light: #f8f9fa;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --multiday-bg: #f3f4f6;
  --multiday-border: #d1d5db;
}

/* --- Main Container --- */
.booking-widget-instant {
  max-width: 440px;
  margin: 2rem auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Trust Building Banner --- */
.trust-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.trust-icon {
  font-size: 1.125rem;
  line-height: 1;
}

.trust-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  text-align: center;
}

/* Mobile summary removed - no longer needed */

/* --- Main Widget Card --- */
.widget-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.widget-section {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.widget-section:last-child {
  border-bottom: none;
}

/* --- Progress Bar --- */
.progress-container {
  width: 100%;
  height: 4px;
  background-color: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--primary-blue), var(--primary-blue-hover));
  border-radius: 2px;
  transition: all 0.7s ease-out;
  transform: translateX(-100%);
}

.progress-fill.has-progress {
  transform: translateX(0);
}

.progress-fill.complete {
  background: linear-gradient(to right, var(--success-green), var(--success-green-dark));
}

.progress-message {
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.progress-message.complete {
  color: var(--success-green);
  font-weight: 500;
}

/* --- Section Headers --- */
.section-header {
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dark);
}

.completion-check {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
}

.completion-check.show {
  opacity: 1;
  transform: scale(1);
}

/* --- Date Picker --- */
.date-picker-container {
  position: relative;
}

.date-input {
  cursor: pointer;
  transition: all 0.2s ease;
}

.date-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 0.25rem rgba(50, 79, 190, 0.25);
}

.date-input.has-value {
  border-color: var(--primary-blue);
  background-color: rgba(50, 79, 190, 0.05);
  font-weight: 500;
}

/* --- React-Style Calendar Customization --- */
.react-style-calendar {
  border: none !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
  overflow: hidden !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  /* Floating calendar positioning */
  top: calc(100% + 8px) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

.react-style-calendar .drp-calendar {
  padding: 20px !important;
  background: white !important;
}

/* Hide all buttons and ranges */
.react-style-calendar .drp-buttons,
.react-style-calendar .ranges {
  display: none !important;
}

/* Calendar header styling */
.react-style-calendar .calendar-table {
  background: white !important;
  border: none !important;
  border-spacing: 4px !important;
}

/* Header container with relative positioning for nav buttons */
.react-style-calendar .drp-calendar .calendar-table {
  position: relative !important;
}

.react-style-calendar .month {
  color: #111827 !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  padding: 12px 0 16px 0 !important;
  text-align: center !important;
  position: relative !important;
}

/* Navigation buttons - 32x32 pill style */
.react-style-calendar .prev,
.react-style-calendar .next {
  position: absolute !important;
  top: 8px !important;
  color: #6B7280 !important;
  border: 1px solid #E5E7EB !important;
  background: white !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
}

.react-style-calendar .prev {
  left: 12px !important;
}

.react-style-calendar .next {
  right: 12px !important;
}

.react-style-calendar .prev:hover,
.react-style-calendar .next:hover {
  background-color: #2961FF !important;
  border-color: #2961FF !important;
  color: white !important;
}

/* Week days header */
.react-style-calendar .calendar-table thead tr th {
  color: #6B7280 !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  padding: 8px !important;
  border: none !important;
  text-align: center !important;
  background: white !important;
  width: 40px !important;
  height: 32px !important;
}

/* Date cells - 40px with proper spacing */
.react-style-calendar .calendar-table tbody td {
  border: none !important;
  padding: 2px !important;
  background: white !important;
  width: 40px !important;
  height: 40px !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.react-style-calendar .calendar-table tbody td.available {
  color: #111827 !important;
  background: white !important;
}

/* Date buttons - 36px centered in 40px cells */
.react-style-calendar .calendar-table tbody td.available span {
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  border-radius: 4px !important;
  border: none !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  color: #111827 !important;
  background: transparent !important;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
}

/* Hover state for dates - light background */
.react-style-calendar .calendar-table tbody td.available:not(.disabled):hover span {
  background-color: #F2F4F7 !important;
  border-radius: 4px !important;
  color: #111827 !important;
}

/* Selected date - primary blue pill */
.react-style-calendar .calendar-table tbody td.active span,
.react-style-calendar .calendar-table tbody td.start-date span,
.react-style-calendar .calendar-table tbody td.end-date span,
.react-style-calendar .calendar-table tbody td.in-range span {
  background-color: #2961FF !important;
  border-radius: 6px !important;
  color: white !important;
  font-weight: 500 !important;
}

/* Today's date - primary outline and bold */
.react-style-calendar .calendar-table tbody td.today span {
  border: 1px solid #2961FF !important;
  color: #2961FF !important;
  font-weight: 600 !important;
  background: transparent !important;
}

/* Today's date when selected */
.react-style-calendar .calendar-table tbody td.today.active span,
.react-style-calendar .calendar-table tbody td.today.start-date span,
.react-style-calendar .calendar-table tbody td.today.end-date span {
  background-color: #2961FF !important;
  border: 1px solid #2961FF !important;
  color: white !important;
  font-weight: 600 !important;
}

/* Disabled dates - soft grey, no interaction */
.react-style-calendar .calendar-table tbody td.off,
.react-style-calendar .calendar-table tbody td.disabled {
  pointer-events: none !important;
}

.react-style-calendar .calendar-table tbody td.off span,
.react-style-calendar .calendar-table tbody td.disabled span {
  color: #C0C4C9 !important;
  cursor: default !important;
  background: transparent !important;
  pointer-events: none !important;
}

.react-style-calendar .calendar-table tbody td.off:hover span,
.react-style-calendar .calendar-table tbody td.disabled:hover span {
  background: transparent !important;
  color: #C0C4C9 !important;
}

/* Remove default daterangepicker styles that interfere */
.react-style-calendar .drp-calendar.left {
  border-right: none !important;
}

.react-style-calendar .drp-calendar.right {
  border-left: none !important;
}

/* Ensure single calendar layout */
.react-style-calendar .drp-calendar {
  width: auto !important;
  max-width: none !important;
  min-width: 320px !important;
}

/* Focus trap and accessibility improvements */
.react-style-calendar .calendar-table tbody td.available span:focus {
  outline: 2px solid #2961FF !important;
  outline-offset: 2px !important;
  border-radius: 4px !important;
}

/* Additional spacing and layout refinements */
.react-style-calendar .drp-calendar table.calendar-table {
  margin: 0 auto !important;
  table-layout: fixed !important;
}

/* Smooth animations for state changes */
.react-style-calendar .calendar-table tbody td span {
  transition: all 0.15s ease-in-out !important;
}

/* Ensure proper calendar positioning */
.react-style-calendar {
  z-index: 1000 !important;
  position: absolute !important;
}

/* Month/Year dropdowns styling - merged into single header */
.react-style-calendar .monthselect,
.react-style-calendar .yearselect {
  font-size: 16px !important;
  font-weight: 500 !important;
  color: #111827 !important;
  border: none !important;
  background: transparent !important;
  margin: 0 2px !important;
  cursor: pointer !important;
  outline: none !important;
}

/* Focus state for dropdowns */
.react-style-calendar .monthselect:focus,
.react-style-calendar .yearselect:focus {
  outline: 2px solid #2961FF !important;
  outline-offset: 2px !important;
  border-radius: 4px !important;
}

/* --- Collapsible Sections --- */
.collapsible-section {
  border-bottom: 1px solid var(--border-color);
}

.section-toggle {
  width: 100%;
  padding: 1.5rem;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.section-toggle:hover {
  background-color: #f9fafb;
}

.section-details {
  text-align: left;
  flex-grow: 1;
}

.section-summary {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  transition: color 0.2s ease;
}

.section-summary.complete {
  color: var(--text-dark);
}

.toggle-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.section-toggle[aria-expanded="true"] .toggle-chevron {
  transform: rotate(180deg);
}

/* --- Section Content --- */
.section-content {
  padding: 0 1.5rem 1.5rem;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Counter Rows --- */
.counter-list {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}

.counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.counter-row:last-child {
  border-bottom: none;
}

.counter-info {
  flex: 1;
}

.counter-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 0.125rem;
}

.counter-sublabel {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.counter-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.counter-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.counter-btn:hover:not(:disabled) {
  border-color: var(--primary-blue);
  background-color: rgba(50, 79, 190, 0.1);
  transform: scale(1.05);
}

.counter-btn:active:not(:disabled) {
  transform: scale(0.95);
}

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

.counter-display {
  min-width: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-dark);
}

/* --- Pickup Selectors --- */
.pickup-selectors {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 0.25rem rgba(50, 79, 190, 0.25);
}

/* --- Booking Actions --- */
.booking-actions {
  padding: 1.5rem;
  background-color: var(--bg-light);
}

.total-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.total-label {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-dark);
}

.total-amount {
  text-align: right;
}

/* Price breakdown removed - no longer needed */

.total-price {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* --- CTA Buttons --- */
.btn-primary-cta {
  width: 100%;
  height: 48px;
  background-color: var(--primary-blue);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary-cta:hover {
  background-color: var(--primary-blue-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-primary-cta:active {
  transform: translateY(0);
}

.btn-secondary-cta {
  width: 100%;
  height: 48px;
  background-color: transparent;
  color: var(--text-dark);
  border: 1px solid #d1d5db;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary-cta:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

/* --- CTA Pulse Animation --- */
@keyframes ctaPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.btn-primary-cta.pulse {
  animation: ctaPulse 1.2s ease-out 1;
}

/* --- Inquiry Form --- */
.inquiry-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.inquiry-subtitle {
  color: var(--text-muted);
  margin-bottom: 0;
}

.inquiry-form .form-floating {
  margin-bottom: 1rem;
}

.inquiry-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* --- View Transitions --- */
.view-pane {
  transition: opacity 200ms ease-in-out, visibility 200ms ease-in-out;
}

.view-pane.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* --- Sticky Mobile CTA --- */
.sticky-mobile-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
}

.sticky-mobile-cta.show {
  transform: translateY(0);
}

.sticky-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 440px;
  margin: 0 auto;
}

.sticky-pricing {
  text-align: left;
}

.sticky-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.sticky-amount {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-dark);
}

.sticky-book-btn {
  padding: 0.75rem 2rem;
  background-color: var(--primary-blue);
  color: white;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sticky-book-btn:hover {
  background-color: var(--primary-blue-hover);
  transform: scale(1.02);
}

@media (min-width: 768px) {
  .sticky-mobile-cta {
    display: none !important;
  }
}

/* --- Loading States --- */
/* Simplified loading - no animations needed, just text change */
.btn-primary-cta:disabled,
.sticky-book-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* --- Form Enhancements --- */
.form-control:focus,
.form-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 0.25rem rgba(50, 79, 190, 0.25);
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  color: var(--primary-blue);
}

/* --- Responsive Design --- */
@media (max-width: 576px) {
  .booking-widget-instant {
    margin: 1rem auto;
    max-width: none;
  }
  
  .widget-section {
    padding: 1rem;
  }
  
  .section-toggle {
    padding: 1rem;
  }
  
  .section-content {
    padding: 0 1rem 1rem;
  }
  
  .counter-row {
    padding: 0.75rem;
  }
  
  .counter-btn {
    width: 28px;
    height: 28px;
  }
  
  .counter-display {
    min-width: 28px;
    font-size: 0.9rem;
  }
}

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

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .widget-card {
    border: 2px solid #000000 !important;
  }
  
  .section-toggle:focus {
    outline: 3px solid #000000 !important;
  }
  
  .btn-primary-cta:focus,
  .btn-secondary-cta:focus {
    outline: 3px solid #000000 !important;
  }
}

/* --- Multiday Tour Styles --- */
.multiday-activities-container {
  margin-top: 1rem;
}

.multiday-activity-section {
  background: white;
  border: 1px solid var(--multiday-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.multiday-activity-section:hover {
  box-shadow: var(--shadow-lg);
}

.multiday-toggle {
  background: var(--multiday-bg);
  border: none;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.multiday-toggle:hover {
  background: #e5e7eb;
}

.multiday-toggle h5 {
  color: var(--text-dark);
  font-size: 1.125rem;
  font-weight: 600;
}

.custom-date-selected {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.multiday-content {
  border-top: 1px solid var(--multiday-border);
}

.activity-date-picker {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: white;
  color: var(--text-dark);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 0.5rem;
}

.activity-date-picker:hover {
  border-color: var(--primary-blue);
  background: var(--bg-light);
}

.activity-guests {
  margin-top: 1rem;
}

.activity-counter {
  cursor: pointer;
}

/* Price breakdown CSS removed - no longer needed */

/* Activity-specific form fields */
.activity-pickup-location,
.activity-pickup-time {
  width: 100%;
}

/* Multiday progress bar adjustment */
.booking-widget-instant.multiday .progress-message {
  font-size: 0.875rem;
}

/* Responsive adjustments for multiday */
@media (max-width: 767px) {
  .multiday-toggle h5 {
    font-size: 1rem;
  }
  
  .custom-date-selected {
    font-size: 0.75rem;
  }
}

/* Activity calendar styling */
.activity-calendar {
  z-index: 1050;
}

.activity-calendar.flatpickr-calendar {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/* Fix for activity calendars positioning */
.multiday-activity-section .date-selection-container {
  position: relative;
}

/* Ensure flatpickr hidden inputs don't interfere */
.activity-flatpickr-input {
  position: absolute;
  width: 0;
  height: 0;
  visibility: hidden;
} 