/**
 * Sierra at Tahoe - Booking Module Styles
 * Custom tabbed booking interface matching Figma designs
 */

/* =============================================================================
   Main Booking Module Container
   ============================================================================= */

.sierra-booking-module {
  border-radius: 40px;
  padding: 0;
  margin: 0 auto;
  position: relative;
  overflow: visible;
  border: none;
  max-width: 1280px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--wp--preset--spacing--large) var(--wp--preset--spacing--large) calc(1.25 * var(--wp--preset--spacing--x-large));
  gap: var(--wp--preset--spacing--large);
  background: var(--wp--preset--color--deep-alpine);
  box-shadow: 0px 0px 30px rgba(20, 44, 45, 0.1);
  border-radius: 24px;
  isolation: isolate;
  position: relative;
  z-index: 9;
  margin-top: -120px;
  margin-bottom: -105px;
}

/* Block editor specific styling */
.wp-block-sierra-at-tahoe-booking-module {
  max-width: min( 1280px, calc(100% - ( 2 * (var(--wp--preset--spacing--medium)) ) ) );
}

/* Ensure editor preview matches frontend */
.block-editor-block-list__layout .sierra-booking-module {
  overflow: visible;
}

/* =============================================================================
   Tab Navigation
   ============================================================================= */

.booking-tabs {
  display: flex;
  gap: 8px;
  padding: 8px;
  align-items: center;
  flex-wrap: nowrap;
  background-color: rgba(10, 106, 88, 0.5);
  width: calc(100% - 16px);
  border-radius: 40px;
}

.booking-tab {
  background-color: transparent;
  border: none;
  color: var(--wp--preset--color--snowcap-sage);
  font-family: var(--wp--preset--font-family--gt-standard);
  font-size: var(--wp--preset--font-size--body-medium);
  font-weight: 400;
  padding: 12px 24px;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  outline: none;
  line-height: 1.33;
  font-style: normal;
}

.booking-tab:hover {
  background-color: rgba(245, 255, 240, 0.1);
}

.booking-tab:focus {
  outline: 2px solid var(--wp--preset--color--snowcap-sage);
  outline-offset: 2px;
}

.booking-tab.active {
  background-color: var(--wp--preset--color--snowcap-sage);
  color: var(--wp--preset--color--deep-alpine);
  font-weight: 700;
  box-shadow: none;
}

.booking-tab.active:hover {
  background-color: var(--wp--preset--color--snowcap-sage);
}

/* =============================================================================
   Form Container
   ============================================================================= */

.booking-form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 16px 0 8px;
  padding-top: 0;
  width: calc(100% - 8px);
}

.booking-tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
  align-items: center;
  gap: 40px;
}

.booking-tab-content.active {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================================================
   Form Fields Layout
   ============================================================================= */

.booking-fields {
  display: flex;
  gap: 40px;
  align-items: stretch;
  width: 100%;
  flex: 1;
}

.booking-form-content {
  display: flex;
  align-items: center;
  gap: 40px;
  width: 100%;
}

/* Equal width fields */
.booking-dropdown {
  flex: 1;
  min-width: 0;
}

/* Field separator - add between dropdowns */
.booking-fields > .booking-dropdown:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -20px;
  top: 0;
  bottom: 0;
  border-right: 1.5px solid #868EE2;
  pointer-events: none;
}

/* =============================================================================
   Dropdown Styling
   ============================================================================= */

.booking-dropdown {
  position: relative;
  background-color: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1;
}

.booking-dropdown.open {
  z-index: 10001;
}

.booking-dropdown:hover {
  background-color: transparent;
  border-color: transparent;
}

.booking-dropdown-header {
  background-color: transparent;
  border: none;
  color: var(--wp--preset--color--snowcap-sage);
  padding: 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.booking-dropdown-header:focus {
  outline: 2px solid var(--wp--preset--color--snowcap-sage);
  outline-offset: 2px;
  border-radius: 4px;
}

.booking-dropdown-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: flex-start;
  width: 100%;
  flex: 1;
}

.booking-dropdown-label {
  font-family: var(--wp--preset--font-family--gt-standard);
  font-size: var(--wp--preset--font-size--heading-5);
  font-weight: 700;
  color: var(--wp--preset--color--snowcap-sage);
  line-height: 1.14;
  letter-spacing: 0;
  text-transform: none;
  font-style: normal;
}

.booking-dropdown-value {
  font-family: var(--wp--preset--font-family--gt-standard);
  font-size: var(--wp--preset--font-size--body-medium);
  font-weight: 400;
  color: var(--wp--preset--color--snowcap-sage);
  line-height: 1.33;
  margin-top: 4px;
  font-style: normal;
}

.booking-dropdown-arrow {
  position: relative;
  top: auto;
  right: auto;
  transform: rotate(0deg);
  color: var(--wp--preset--color--snowcap-sage);
  font-size: 16px;
  transition: transform 0.3s ease;
  opacity: 0.8;
  pointer-events: none;
  width: 24px;
  height: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  align-self: flex-end;
}

.booking-dropdown-arrow.open,
.booking-dropdown.open .booking-dropdown-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

.booking-dropdown:hover .booking-dropdown-arrow {
  opacity: 1;
}

/* =============================================================================
   Dropdown Options
   ============================================================================= */

.booking-dropdown-options {
  position: fixed;
  background-color: var(--wp--preset--color--snowcap-sage);
  border-radius: 12px;
  box-shadow: 0px 12px 48px rgba(10, 43, 45, 0.15);
  z-index: 99999;
  overflow: hidden;
  display: none;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  min-width: 200px;
}

.booking-dropdown.open .booking-dropdown-options {
  display: block;
  max-height: 300px;
  opacity: 1;
}

.booking-dropdown-option {
  padding: 12px 16px;
  font-family: var(--wp--preset--font-family--gt-standard);
  font-size: var(--wp--preset--font-size--body-small);
  font-weight: 400;
  color: var(--wp--preset--color--deep-alpine);
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: none;
  line-height: 1.5;
}

.booking-dropdown-option:first-child {
  border-radius: 12px 12px 0 0;
}

.booking-dropdown-option:last-child {
  border-radius: 0 0 12px 12px;
}

.booking-dropdown-option:hover {
  background-color: rgba(10, 106, 88, 0.06);
  color: var(--wp--preset--color--deep-alpine);
}

.booking-dropdown-option.selected {
  background-color: var(--wp--preset--color--sugar-pine-green);
  color: var(--wp--preset--color--snowcap-sage);
  font-weight: 500;
}

.booking-dropdown-option.selected:hover {
  background-color: var(--wp--preset--color--sugar-pine-green);
  color: var(--wp--preset--color--snowcap-sage);
}

/* =============================================================================
   CTA Button Styling
   ============================================================================= */

.booking-cta {
  background-color: var(--wp--preset--color--sierra-gold);
  color: var(--wp--preset--color--deep-alpine);
  border: none;
  border-radius: 80px;
  padding: 12px 24px;
  font-family: var(--wp--preset--font-family--gt-standard);
  font-size: var(--wp--preset--font-size--heading-5);
  font-weight: 700;
  line-height: 1.14;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: none;
  outline: none;
  justify-self: end;
  align-self: center;
  min-width: auto;
  text-transform: none;
  letter-spacing: 0;
  flex-shrink: 0;
  font-style: normal;
}

.booking-cta:hover {
  background-color: rgba(249, 183, 80, 0.9);
  transform: none;
  box-shadow: none;
}

.booking-cta:focus {
  outline: 3px solid rgba(249, 183, 80, 0.5);
  outline-offset: 2px;
}

.booking-cta:active {
  transform: none;
  box-shadow: none;
}

/* Alternative button colors */
.booking-cta-sugar-pine-green {
  background-color: var(--wp--preset--color--sugar-pine-green);
  color: var(--wp--preset--color--snowcap-sage);
}

.booking-cta-sugar-pine-green:hover {
  background-color: rgba(10, 106, 88, 0.9);
}

.booking-cta-last-light {
  background-color: var(--wp--preset--color--last-light);
  color: var(--wp--preset--color--snowcap-sage);
}

.booking-cta-last-light:hover {
  background-color: rgba(134, 142, 236, 0.9);
}

/* =============================================================================
   Loading States
   ============================================================================= */

.booking-module-loading .booking-cta {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.booking-module-loading .booking-cta::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid var(--wp--preset--color--deep-alpine);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* =============================================================================
   Responsive Design
   ============================================================================= */

/* Tablet Layout */
@media (max-width: 1024px) {
  .sierra-booking-module {
    padding: var(--wp--preset--spacing--medium);
    margin: var(--wp--preset--spacing--medium) 0;
  }

  .booking-tab-content {
    flex-direction: column;
    gap: 24px;
  }

  .booking-fields {
    flex-direction: column;
    gap: 24px;
  }

  .booking-dropdown:not(:last-child)::after {
    display: none;
  }

  .booking-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .booking-tab {
    flex-shrink: 0;
  }

  .booking-cta {
    width: 100%;
    font-size: var(--wp--preset--font-size--heading-6);
    line-height: 1.33;
  }

  .booking-dropdown-label {
    font-size: var(--wp--preset--font-size--heading-6);
    line-height: 1.33;
  }

  .booking-dropdown-value {
    font-size: var(--wp--preset--font-size--body-small);
    line-height: 1.5;
  }

  .booking-form {
    padding: 12px;
  }

  .booking-dropdown-options {
    max-width: calc(100vw - 32px);
  }
}

/* Mobile Layout */
@media (max-width: 480px) {
  .sierra-booking-module {
    padding: var(--wp--preset--spacing--small);
    border-radius: 32px;
    margin: 0 auto;
  }

  .booking-tabs {
    height: auto;
    min-height: 48px;
    padding: 6px 8px;
    gap: 6px;
    justify-content: space-between;
  }

  .booking-tab {
    font-size: var(--wp--preset--font-size--body-small);
    line-height: 1.5;
    padding: 8px 16px;
  }

  .booking-form {
    padding: 8px;
  }

  .booking-tab-content {
    gap: 16px;
  }

  .booking-fields {
    gap: 16px;
  }

  .booking-dropdown-label {
    font-size: var(--wp--preset--font-size--body-large);
    line-height: 1.4;
  }

  .booking-dropdown-value {
    font-size: var(--wp--preset--font-size--body-small);
    line-height: 1.5;
  }

  .booking-dropdown-arrow {
    width: 20px;
    height: 20px;
    font-size: 20px;
  }

  .booking-cta {
    font-size: var(--wp--preset--font-size--body-large);
    line-height: 1.4;
    padding: 10px 20px;
  }

  .booking-dropdown-options {
    max-width: calc(100vw - 24px);
  }
}

/* =============================================================================
   Accessibility Enhancements
   ============================================================================= */

/* High contrast mode */
@media (prefers-contrast: high) {
  .sierra-booking-module {
    border: 2px solid var(--wp--preset--color--snowcap-sage);
  }

  .booking-tab,
  .booking-dropdown-header,
  .booking-cta {
    border: 1px solid currentColor;
  }

  .booking-dropdown-options {
    border: 2px solid var(--wp--preset--color--deep-alpine);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .booking-tab,
  .booking-dropdown-arrow,
  .booking-dropdown-options,
  .booking-dropdown-option,
  .booking-cta,
  .booking-tab-content {
    transition: none;
    animation: none;
  }

  .booking-cta:hover,
  .booking-tab:hover {
    transform: none;
  }
}

/* Focus visible for keyboard users */
.booking-tab:focus-visible,
.booking-dropdown-header:focus-visible,
.booking-cta:focus-visible {
  outline: 3px solid var(--wp--preset--color--sierra-gold);
  outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================================
   Block Editor Specific Styles
   ============================================================================= */

.block-editor-page .sierra-booking-module {
  position: relative;
}

.block-editor-page .sierra-booking-module::before {
  content: "Sierra Booking Module - Preview";
  position: absolute;
  top: -30px;
  left: 0;
  font-family: var(--wp--preset--font-family--mont);
  font-size: var(--wp--preset--font-size--caption);
  color: var(--wp--preset--color--sugar-pine-green);
  background-color: var(--wp--preset--color--snowcap-sage);
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: var(--wp--preset--font-weight--medium);
}

/* Editor warning for missing booking URL - Only show in editor */
.block-editor-page .sierra-booking-module:not([data-booking-url]),
.block-editor-page .sierra-booking-module[data-booking-url=""] {
  border: 2px dashed rgba(249, 183, 80, 0.5);
}

.block-editor-page .sierra-booking-module:not([data-booking-url])::after,
.block-editor-page .sierra-booking-module[data-booking-url=""]::after {
  content: "⚠️ Booking URL not configured. Set the URL in block settings.";
  position: absolute;
  bottom: -40px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--wp--preset--font-family--mont);
  font-size: var(--wp--preset--font-size--caption);
  color: var(--wp--preset--color--sierra-gold);
  background-color: rgba(249, 183, 80, 0.1);
  padding: var(--wp--preset--spacing--small);
  border-radius: 4px;
  border: 1px solid rgba(249, 183, 80, 0.3);
}

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

@media print {
  .sierra-booking-module {
    break-inside: avoid;
    page-break-inside: avoid;
    background: white !important;
    color: black !important;
    border: 1px solid #000;
  }

  .booking-dropdown-options {
    display: none !important;
  }

  .booking-cta::after {
    content: " (Booking available at " attr(data-booking-url) ")";
  }
}