/**
 * Forms Component Styles
 * Form validation, character counting, and input styles
 * Extracted from list-spot-3step.css
 */

/* Form shells: bare control styles apply only inside these (not site-wide search/map inputs). */

/* ============================================================================
   FORM VALIDATION STATES
   ============================================================================ */

.field-success {
  border-color: var(--state-success, var(--success-green)) !important;
  background-color: var(--state-success-bg) !important;
  box-shadow: 0 0 0 3px var(--state-success-border) !important;
}

.field-error {
  border-color: var(--state-error, var(--error-red)) !important;
  background-color: var(--state-error-bg) !important;
  box-shadow: 0 0 0 3px var(--state-error-border) !important;
}

.ss-field-error-message,
.error-message {
  color: var(--state-error, var(--error-red, #dc2626));
  font-size: 0.875rem;
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* ============================================================================
   CHARACTER COUNTING VALIDATION
   ============================================================================ */

/* Character count validation classes */
.character-count-valid { color: var(--state-success, var(--success-green)); }
.character-count-warning { color: var(--warning-orange); }
.character-count-error { color: var(--state-error, var(--error-red)); }

/* Character counter elements */
#title-count,
#description-count {
  font-size: 0.75rem;
  margin-top: 0.0625rem !important;
  transition: color var(--transition-base, 0.2s ease);
}

/* Light mode character counter colors */
#title-count.text-gray-500,
#description-count.text-gray-500 {
  color: var(--text-supporting, var(--color-gray-500)) !important;
}

#title-count.text-orange-500,
#description-count.text-orange-500 {
  color: var(--state-warning, #f59e0b) !important;
}

#title-count.text-red-500,
#description-count.text-red-500 {
  color: var(--state-error, #ef4444) !important;
}

#title-count.text-green-600,
#description-count.text-green-600 {
  color: var(--state-success, var(--color-success-green, #047857)) !important;
}

/* ============================================================================
   FORM INPUT STYLES (scoped)
   ============================================================================ */

:is(
  .form-group,
  .wizard-step,
  #listspot-wizard-form,
  #checkout-form,
  #guest-booking-form,
  #guest-message-form,
  #guest-arrival-form,
  #guest-form,
  #verificationForm,
  #auth-modal,
  #auth-modal-content,
  #forgot-password-popup,
  #forgot-password-form
) :is(
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="search"],
  textarea,
  select
),
.input-enhanced,
#autocomplete,
#postalCodeEdit,
#countryEdit,
#phone_number {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-ui, var(--border-default));
  border-radius: var(--radius-control, var(--border-radius-base));
  font-size: 16px;
  line-height: var(--line-height-body, 1.5);
  transition:
    border-color var(--transition-base, 0.2s ease),
    box-shadow var(--transition-base, 0.2s ease);
  background: var(--surface-raised, #fff);
  color: var(--text-body, var(--text-primary));
}

:is(
  .form-group,
  .wizard-step,
  #listspot-wizard-form,
  #checkout-form,
  #guest-booking-form,
  #guest-message-form,
  #guest-arrival-form,
  #guest-form,
  #verificationForm,
  #auth-modal,
  #auth-modal-content,
  #forgot-password-popup,
  #forgot-password-form
) label,
.form-label {
  font-size: var(--type-label-size, 0.8125rem);
  font-weight: var(--font-weight-semibold, 600);
  line-height: var(--line-height-snug, 1.35);
}

:is(
  .form-group,
  .wizard-step,
  #listspot-wizard-form,
  #checkout-form,
  #guest-booking-form,
  #guest-message-form,
  #guest-arrival-form,
  #guest-form,
  #verificationForm,
  #auth-modal,
  #auth-modal-content,
  #forgot-password-popup,
  #forgot-password-form
) :is(
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="search"],
  textarea,
  select
):focus,
.input-enhanced:focus,
#autocomplete:focus,
#postalCodeEdit:focus {
  outline: none;
  border-color: var(--accent-primary, var(--primary-blue));
  box-shadow: var(--focus-ring);
}

html.dark :is(
  .form-group,
  .wizard-step,
  #listspot-wizard-form,
  #checkout-form,
  #guest-booking-form,
  #guest-message-form,
  #guest-arrival-form,
  #guest-form,
  #verificationForm,
  #auth-modal,
  #auth-modal-content,
  #forgot-password-popup,
  #forgot-password-form
) :is(
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="search"],
  textarea,
  select
),
html.dark .input-enhanced,
html.dark #autocomplete,
html.dark #postalCodeEdit,
html.dark #countryEdit,
html.dark #phone_number {
  background: var(--color-dark-surface);
  color: var(--color-dark-text);
  border-color: var(--color-dark-border);
}

html.dark :is(
  .form-group,
  .wizard-step,
  #listspot-wizard-form,
  #checkout-form,
  #guest-booking-form,
  #guest-message-form,
  #guest-arrival-form,
  #guest-form,
  #verificationForm,
  #auth-modal,
  #auth-modal-content,
  #forgot-password-popup,
  #forgot-password-form
) :is(
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="search"],
  textarea,
  select
):focus,
html.dark .input-enhanced:focus,
html.dark #autocomplete:focus,
html.dark #postalCodeEdit:focus {
  border-color: var(--accent-primary, var(--primary-blue));
  box-shadow: var(--focus-ring-strong, var(--focus-ring));
}

:is(
  .form-group,
  .wizard-step,
  #listspot-wizard-form,
  #checkout-form,
  #guest-booking-form,
  #guest-message-form,
  #guest-arrival-form,
  #guest-form,
  #verificationForm,
  #auth-modal,
  #auth-modal-content,
  #forgot-password-popup,
  #forgot-password-form
) :is(
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="search"],
  textarea
)::placeholder {
  color: var(--text-hint, #64748b);
  opacity: 1;
}

html.dark :is(
  .form-group,
  .wizard-step,
  #listspot-wizard-form,
  #checkout-form,
  #guest-booking-form,
  #guest-message-form,
  #guest-arrival-form,
  #guest-form,
  #verificationForm,
  #auth-modal,
  #auth-modal-content,
  #forgot-password-popup,
  #forgot-password-form
) :is(
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="tel"],
  input[type="password"],
  input[type="search"],
  textarea
)::placeholder,
html.dark #autocomplete::placeholder {
  color: var(--text-hint, var(--color-slate-400));
  opacity: 1;
}

/* Postal code input specific styling */
#postalCodeEdit {
  text-transform: uppercase;
}

#postalCodeEdit::placeholder {
  font-family: inherit;
  font-weight: normal;
  text-transform: uppercase;
}

/* Country field styling - fixed as Canada */
#countryEdit {
  background-color: var(--surface-subtle, var(--color-gray-100)) !important;
  color: var(--text-supporting, var(--color-gray-700)) !important;
  cursor: not-allowed;
  font-weight: 500;
}

#countryEdit::placeholder {
  color: var(--text-hint, #64748b) !important;
}

.dark #countryEdit {
  background-color: var(--surface-subtle, var(--color-gray-700)) !important;
  color: var(--text-supporting, var(--color-dark-text-muted)) !important;
}

.dark #countryEdit::placeholder {
  color: var(--text-hint, var(--color-dark-text-secondary, #a8a29e)) !important;
}

#postalCodeEdit:focus {
  border-color: var(--accent-primary, var(--primary-blue));
  box-shadow: var(--focus-ring);
}

/* Postal code formatting indicator */
#postalCodeEdit.formatting {
  background-color: var(--color-primary-blue-light);
  border-color: var(--accent-primary-hover, #1d4ed8);
  animation: postalFormatPulse 0.3s ease-in-out;
}

@keyframes postalFormatPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(5, 16, 32, 0.4);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 0 0 4px rgba(1, 1, 2, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* Dark mode postal code styling */
.dark #postalCodeEdit {
  background: var(--color-gray-800);
  color: var(--color-gray-50);
  border-color: var(--color-gray-600);
}

.dark #postalCodeEdit:focus {
  border-color: var(--accent-primary-hover, #1d4ed8);
  box-shadow: var(--focus-ring-strong, 0 0 0 3px rgb(59 130 246 / 20%));
}

.dark #postalCodeEdit.formatting {
  background-color: var(--nav-active-bg-dark, #1e3a8a);
  border-color: var(--accent-primary-hover, #1d4ed8);
}

/* ============================================================================
   PROVINCE FIELD STYLES (Updated for input field)
   ============================================================================ */

/* Province field is now a standard readonly input - no special styling needed */

/* Autocomplete input */
#autocomplete {
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-base);
  position: relative;
  transition:
    border-color var(--transition-smooth, 0.2s ease),
    box-shadow var(--transition-smooth, 0.2s ease);
}

/* ============================================================================
   GOOGLE PLACES AUTOCOMPLETE STYLING
   ============================================================================ */

/* Google Places Autocomplete suggestions styling from list-spot-3step.css */
.pac-container {
  background-color: var(--surface-raised, #fff);
  border-radius: var(--border-radius-base);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-ui-subtle, var(--border-light));
  margin-top: 4px;
  z-index: var(--z-dropdown) !important;
}

.pac-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-ui-subtle, var(--border-light));
  cursor: pointer;
  font-size: var(--font-size-sm);
}

.pac-item:hover {
  background-color: var(--surface-page, var(--bg-base));
}

.pac-item:last-child {
  border-bottom: none;
}

/* Dark mode support for autocomplete dropdown */
.dark .pac-container {
  background-color: var(--surface-subtle, var(--color-gray-700));
  border-color: var(--border-ui, var(--color-gray-600));
  box-shadow: var(--shadow-lg);
}

.dark .pac-item {
  color: var(--text-heading, var(--color-gray-50));
  border-bottom-color: var(--border-ui, var(--color-gray-600));
}

.dark .pac-item:hover {
  background-color: var(--surface-muted, var(--color-gray-600));
}

.dark .pac-item-query,
.dark .pac-item .pac-matched,
.dark .pac-item span {
  color: var(--text-heading, var(--color-gray-50)) !important;
}

/* Google Places secondary line (city/province) */
.dark .pac-item > span:not(.pac-icon):not(.pac-item-query) {
  color: var(--text-muted, var(--color-gray-300)) !important;
}

/* WebKit autofill does not always emit input/change; animationstart nudges predictions. */
@keyframes places-autocomplete-autofill-nudge {
  0% { transform: translateZ(0); }
  100% { transform: translateZ(0); }
}

.places-autocomplete-input:-webkit-autofill,
[data-places-autocomplete]:-webkit-autofill {
  animation: places-autocomplete-autofill-nudge 1ms;
}

/* ============================================================================
   FORM VALIDATION MESSAGES
   ============================================================================ */

.step-error-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--error-red);
  color: white;
  padding: 1rem;
  border-radius: var(--border-radius-base);
  text-align: center;
  z-index: 10;
}

.wizard-step .step-error-message {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin: 1rem 0;
}

/* ============================================================================
   FORM ACCESSIBILITY
   ============================================================================ */

/* Focus visible styles */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

/* ============================================================================
   FORM RESPONSIVE STYLES
   ============================================================================ */

@media (width <= 768px) {
  :is(
    .form-group,
    .wizard-step,
    #listspot-wizard-form,
    #checkout-form,
    #guest-booking-form,
    #guest-message-form,
    #guest-arrival-form,
    #guest-form,
    #verificationForm,
    #auth-modal,
    #auth-modal-content,
    #forgot-password-popup,
    #forgot-password-form
  ) :is(input:not(.with-phone-prefix):not(.guest-with-phone-prefix), textarea, select),
  .input-enhanced,
  #autocomplete {
    padding: 0.75rem !important;
    font-size: 1rem !important;
    min-height: 48px !important;
  }
}

/* Dark mode character counter colors (ListSpot) */
.dark #title-count.text-gray-400,
.dark #description-count.text-gray-400 {
  color: #9ca3af !important;
}

.dark #title-count.text-orange-400,
.dark #description-count.text-orange-400 {
  color: #fb923c !important;
}

.dark #title-count.text-red-400,
.dark #description-count.text-red-400 {
  color: #f87171 !important;
}

.dark #title-count.text-green-400,
.dark #description-count.text-green-400 {
  color: #4ade80 !important;
}

/* ============================================================================
   FORM ANIMATIONS AND TRANSITIONS
   ============================================================================ */

/**
 * Form Field Animations
 * Smooth entrance animations for form elements
 */
.field-group {
  animation: fade-in-up 0.6s ease-out;
}

/* Note: fade-in-up animation defined in custom.css to avoid duplication */

/* ============================================================================
   REQUIRED LABEL STYLING
   ============================================================================ */

/* Custom styling for "Required" labels with lighter blue shades from custom.css */
.bg-blue-100.text-white {
  background-color: #dbeafe !important; /* Even lighter blue background */
  color: #FFFFFF !important; /* Slightly lighter blue text */
}

.dark .bg-blue-100.text-white {
  background-color: rgb(59 130 246 / 15%) !important; /* Very light blue background in dark mode */
  color: #FFFFFF !important; /* Light blue text in dark mode */
}

/* Apply to any element with both required label classes */
.required-label,
[class*="bg-blue-100"][class*="text-white"] {
  background-color: var(--color-required-bg-light) !important;
  color: var(--color-required-text-light) !important;
}

.dark .required-label,
.dark [class*="bg-blue-100"][class*="text-white"] {
  background-color: var(--color-required-bg-dark) !important;
  color: var(--color-required-text-dark) !important;
}

/* ============================================================================
   ENHANCED PHONE INPUT SYSTEM
   ============================================================================ */

/* Enhanced phone input system from custom.css */
.phone-input-wrapper {
  position: relative;
}

#country-dropdown {
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--color-gray-200);
  backdrop-filter: blur(10px);
}

.country-option:hover {
  background-color: var(--color-gray-100) !important;
}

/* Structured phone number input */
#phone_number {
  font-family: var(--font-family-mono);
  letter-spacing: 0.5px;
  font-size: 16px;
}

#phone_number::placeholder {
  color: var(--text-hint, #64748b);
  font-family: var(--font-family-mono);
  letter-spacing: 0.5px;
}

/* Focus indicators for accessibility */
#country-selector-btn:focus {
  outline: 2px solid var(--color-primary-blue);
  outline-offset: 2px;
}

#country-search:focus {
  box-shadow: 0 0 0 2px var(--color-primary-blue);
}

/* Phone input responsive */
@media (width <= 640px) {
  #country-dropdown {
    width: calc(100% + 2rem);
    left: -1rem;
    max-width: calc(100% + 2rem);
  }

  .phone-input-wrapper {
    flex-direction: column;
  }

  .phone-input-wrapper > div:first-child {
    border-radius: var(--border-radius-base) var(--border-radius-base) 0 0;
    border-bottom: 0;
  }

  .phone-input-wrapper input[type="tel"] {
    border-radius: 0 0 var(--border-radius-base) var(--border-radius-base);
    border-top: 0;
  }

  /* Ensure address autocomplete input is not affected by phone styles */
  #autocomplete {
    border: 1px solid #d1d5db !important;
    border-radius: 0.5rem !important;
  }
}

/* ============================================================================
   ENHANCED INPUT STYLES
   ============================================================================ */

/* Enhanced input styles from custom.css */
.input-enhanced {
  background: white;
  border: 2px solid var(--color-gray-200);
  border-radius: var(--border-radius-base);
  padding: 0.75rem 1rem;
  font-size: var(--font-size-base);
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background-color var(--transition-base);
  width: 100%;
}

.input-enhanced:focus {
  border-color: var(--color-primary-blue);
  box-shadow: 0 0 0 3px rgb(59 130 246 / 10%);
  background: var(--color-gray-50);
}

.input-enhanced::placeholder {
  color: var(--text-hint, #64748b);
}

/* ============================================================================
   FORM ENHANCEMENTS
   ============================================================================ */

/* Form group styling from custom.css */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: 0.5rem;
  display: block;
}

html.dark .form-label {
  color: var(--color-dark-text-muted);
}

/* ============================================================================
   FORM SECTION LAYOUTS
   ============================================================================ */

/* Form section pair layout is controlled via Tailwind utilities in templates. */

/* Enforce two-column layout on desktop regardless of utility collisions */
@media (min-width: 1024px) {
  .form-section-pair {
    display: flex !important;
    flex-direction: row !important;
    gap: 2rem !important; /* larger gap so cards don't look cramped */
  }
  /* Slightly reduce each card width to account for the gap and make them a touch thinner */
  .form-section-pair > div {
    width: calc(50% - 1rem) !important;
    flex: 0 0 calc(50% - 1rem) !important;
    max-width: calc(50% - 1rem) !important;
  }
  .form-section-pair > div:last-child {
    width: calc(50% - 1rem) !important;
    flex: 0 0 calc(50% - 1rem) !important;
    max-width: calc(50% - 1rem) !important;
  }
}

/* ============================================================================
   STEP 1: VEHICLE SIZE BUTTON POLISH
   ============================================================================ */

/* Size option cards: rounded, centered, safe text wrapping */
.vehicle-size-option .size-card {
  border-radius: 0.5rem; /* rounded-lg */
  min-height: 3.5rem; /* ~min-h-14 */
  min-width: 120px; /* prevent ultra-narrow buttons that cause vertical text */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: visible;
  transition: all 200ms ease-in-out;
}

/* Ensure inline size grids create horizontal chips instead of narrow columns */
.inline-size-panel .grid {
  grid-auto-flow: row !important;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
}

/* Google Autocomplete (legacy) — #autocomplete styled in scoped block above */

/* Map controls reused from book_nearby for ListSpot map */
.map-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Add expand map button positioning */
.map-expand-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* NEW: Top right controls container for vertically stacked buttons */
.map-top-right-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

/* Stacked button styling */
.map-control-stacked {
  width: 100%;
  min-width: 60px;
  max-width: 70px;
  justify-content: center;
  text-align: center;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .map-controls {
    top: 5px;
    left: 5px;
  }

  .map-expand-controls {
    top: 5px;
    right: 5px;
  }

  .map-top-right-controls {
    top: 4px;
    right: 4px;
    gap: 3px;
  }

  .map-control-btn {
    padding: 4px 6px;
    min-width: 32px;
    font-size: 10px;
  }

  .map-control-stacked {
    min-width: 50px;
    max-width: 60px;
    padding: 4px 6px;
    font-size: 9px;
  }

  /* Extra compact satellite button on mobile */
  #map-type-btn {
    padding: 3px 4px;
    min-width: 28px;
    font-size: 9px;
  }

  #map-type-btn span {
    font-size: 9px;
    margin-left: 1px;
  }

  /* Make expand button more compact and professional on mobile */
  #expand-map-btn {
    padding: 4px 6px;
    min-width: 32px;
    font-size: 9px;
  }
}

.map-control-btn {
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 5px; /* Further reduced for more compact buttons */
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15); /* Reduced shadow */
  font-size: 9px; /* Further reduced from 10px */
  min-width: 28px; /* Further reduced from 32px */
  max-width: 65px; /* Added max-width to prevent horizontal expansion */
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  transition: all 0.2s ease-in-out;
  white-space: nowrap;
}

/* Make expand button even more compact */
#expand-map-btn {
  padding: 3px 5px;
  min-width: 28px;
  font-size: 9px;
}

#expand-map-btn svg {
  width: 12px;
  height: 12px;
}

#expand-map-btn span {
  font-size: 9px;
  margin-left: 2px;
}

.map-control-btn:hover {
  background: #f5f5f5;
  transform: translateY(-0.5px); /* Reduced movement */
  box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* Reduced shadow */
}

/* Simple hover for expand button */
#expand-map-btn:hover {
  background: #f9fafb !important;
  border-color: #9ca3af !important;
  transform: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
}

/* Force satellite button to be black when active */
.map-control-btn.active,
#map-type-btn.active,
.map-controls .map-control-btn.active,
button#map-type-btn.active,
button.map-control-btn.active {
  background: #000000 !important;
  color: white !important;
  border-color: #000000 !important;
}

/* Override any inline styles that might be applied */
button#map-type-btn[class*="active"] {
  background: #000000 !important;
  color: white !important;
  border-color: #000000 !important;
}

/* Debug: Force all satellite button states to be black when active */
#map-type-btn.active,
#map-type-btn[class*="active"],
button#map-type-btn.active,
button#map-type-btn[class*="active"] {
  background: #000000 !important;
  color: white !important;
  border-color: #000000 !important;
  background-color: #000000 !important;
}

/* Override any potential inline styles */
#map-type-btn.active[style*="background"] {
  background: #000000 !important;
  background-color: #000000 !important;
}

/* Make satellite button more compact */
#map-type-btn {
  padding: 4px 6px;
  min-width: 32px;
  font-size: 10px;
}

#map-type-btn span {
  font-size: 10px;
  margin-left: 2px;
}

/* Simple expand button styling */
#expand-map-btn {
  z-index: 25;
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

#expand-map-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Ensure map container properly handles positioned controls */
#map {
  position: relative;
  overflow: visible;
}

/* Prevent map controls from being cut off */
.map-controls,
.map-expand-controls {
  pointer-events: auto;
  user-select: none;
}

/* Simple and compact expand button */
#expand-map-btn {
  position: relative;
  z-index: calc(var(--z-dropdown) - 1) !important;
  background: white !important;
  color: #374151 !important;
  border: 1px solid #d1d5db !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
  padding: 2px 4px !important;
  min-width: 24px !important;
  font-size: 8px !important;
}

/* Debug: Ensure satellite button doesn't overlap */
#map-type-btn {
  position: relative;
  z-index: calc(var(--z-dropdown) - 2) !important;
  max-width: 80px;
  overflow: hidden;
}

/* Ensure map container doesn't hide controls */
#map {
  position: relative !important;
  overflow: visible !important;
  z-index: 1;
}

/* Force map controls to be visible */
.map-controls,
.map-expand-controls {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Technical fields button and dropdown alignment */
#technical-fields-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  text-align: left !important;
}

#technical-fields {
  text-align: left !important;
}

#technical-fields .text-center {
  text-align: left !important;
}

/* Ensure technical fields section is properly aligned */
#technical-fields-toggle {
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#technical-fields {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Override any centering that might affect technical fields */
#technical-fields,
#technical-fields * {
  text-align: left !important;
  justify-content: flex-start !important;
}

.vehicle-size-option .size-card .text-xs {
  white-space: normal; /* allow wrapping */
  word-break: normal; /* avoid splitting words mid-letter */
  overflow-wrap: break-word; /* wrap only at word boundaries */
  line-height: 1.1rem; /* tighten lines slightly */
}

/* Selected state (also set inline by JS, but keep consistent styling here) */
.vehicle-size-option[aria-selected="true"] .size-card {
  border-color: #1d4ed8 !important; /* blue-500 */
  background-color: rgba(59, 130, 246, 0.1) !important; /* blue-500/10 */
}

/* Hover elevation */
.vehicle-size-option .size-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Keyboard focus for category cards */
.vehicle-category-option:focus-visible .vehicle-category-card {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
  outline: none;
}

/* ============================================================================
   STEP 1: AMENITIES LAYOUT (compact, multi-row on desktop)
   ============================================================================ */
.amenities-container:not(.listspot-features-combined) {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.5rem 0.75rem !important; /* row x column gap */
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
}

@media (min-width: 1024px) {
  .amenities-container:not(.listspot-features-combined) {
    max-width: 980px !important; /* constrain width so chips form 2–3 neat rows */
  }
}

/* Consolidated amenity-option styling with proper border visibility */
/* Override Tailwind's border: 0 default with maximum specificity */
.amenities-container .amenity-option,
.amenity-option {
  flex: 0 0 auto !important; /* keep natural chip width */
  width: auto !important;
  /* Base border styling to ensure container lines are visible */
  border: 1px solid #e5e7eb !important; /* gray-200 */
  border-radius: 0.5rem !important; /* rounded-lg */
  background-color: #ffffff !important; /* white */
  transition: all 0.2s ease-in-out !important;
  /* Ensure borders are visible - override Tailwind base */
  box-sizing: border-box !important;
  /* Force border visibility */
  border-width: 1px !important;
  border-style: solid !important;
}

/* Dark mode base border styling */
.dark .amenities-container .amenity-option,
.dark .amenity-option {
  border-color: #4b5563 !important; /* gray-600 */
  background-color: #374151 !important; /* gray-700 */
}

/* Hover effects for amenity options (legacy tiles; select-cards neutralize below) */
.amenities-container .amenity-option:hover,
.amenity-option:hover {
  border-color: #1d4ed8 !important; /* blue-500 */
  background-color: #dbeafe !important; /* blue-50 */
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

.amenities-container .amenity-option:has(.amenity-button--select-card):hover,
.amenity-option:has(.amenity-button--select-card):hover,
.amenities-container .amenity-option.amenity-selected:has(.amenity-button--select-card),
.amenity-option.amenity-selected:has(.amenity-button--select-card),
.amenities-container .amenity-option.amenity-selected:has(.amenity-button--select-card):hover,
.amenity-option.amenity-selected:has(.amenity-button--select-card):hover {
  border: none !important;
  background: transparent !important;
  background-color: transparent !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Dark mode hover effects */
.dark .amenities-container .amenity-option:not(:has(.amenity-button--select-card)):hover,
.dark .amenity-option:not(:has(.amenity-button--select-card)):hover {
  border-color: #7dd3fc !important; /* blue-300 */
  background-color: #1e3a8a !important; /* blue-900 */
  color: #ffffff !important;
}

/* Tighten vehicle category cards to visually reduce spacing without changing grid gap */
.vehicle-category-card {
  padding: 0.75rem !important; /* p-3 default to preserve touch target */
}

/* NOTE: Dark mode contrast fixes have been consolidated into themes/dark-mode.css
   to avoid duplication and potential conflicts. */

/* ============================================================================
   GUEST CONFLICT VALIDATION STYLES
   Consolidated from guest_conflict_validation.css
   ============================================================================ */

/* Validation Messages */
.validation-message {
    font-size: 0.875rem;
    margin-top: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.validation-message::before {
    margin-right: 0.5rem;
    font-family: "Font Awesome 6 Free", sans-serif;
    font-weight: 900;
}

.validation-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.validation-success::before {
    content: "\f00c"; /* fa-check */
}

.validation-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.validation-error::before {
    content: "\f00d"; /* fa-times */
}

.validation-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.validation-warning::before {
    content: "\f071"; /* fa-exclamation-triangle */
}

.validation-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.validation-info::before {
    content: "\f05a"; /* fa-info-circle */
}

/* Conflict Prompts */
.guest-conflict-prompt {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.conflict-alert {
    padding: 1rem;
    border-radius: 8px;
    border-width: 1px;
    border-style: solid;
}

.conflict-alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.conflict-alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #3b82f6;
}

.conflict-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.conflict-message i {
    margin-right: 0.5rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.conflict-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.conflict-actions .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
}

.conflict-actions .btn i {
    margin-right: 0.25rem;
}

.conflict-actions .btn-primary {
    background: #3b82f6;
    color: white;
}

.conflict-actions .btn-primary:hover {
    background: #2563eb;
}

.conflict-actions .btn-secondary {
    background: #6b7280;
    color: white;
}

.conflict-actions .btn-secondary:hover {
    background: #4b5563;
}

.conflict-actions .btn-outline-primary {
    background: transparent;
    color: #3b82f6;
    border: 1px solid #3b82f6;
}

.conflict-actions .btn-outline-primary:hover {
    background: #3b82f6;
    color: white;
}

/* Input States */
.form-group .form-control.conflict-detected {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.form-group .form-control.conflict-resolved {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Loading States */
.validation-loading {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    position: relative;
}

.validation-loading::before {
    content: "\f110"; /* fa-spinner */
    animation: spin 1s linear infinite;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .conflict-actions {
        flex-direction: column;
    }

    .conflict-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .guest-conflict-prompt {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .conflict-alert {
        padding: 0.75rem;
    }
}
