/**
 * Layout and Positioning Styles
 * Component positioning, layout helpers, and responsive design
 * Extracted from custom.css for better organization
 */

/* ============================================================================
   STICKY PROGRESS BAR - NO GAPS
   ============================================================================ */



/* Remove any default spacing from main content and form */
#mainContent {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* ============================================================================
   COMPONENT POSITIONING & LAYOUT
   ============================================================================ */

/* Cookie Banner - Compact */
#cookie-banner {
  position: fixed !important;
  bottom: 0.5rem !important;
  left: 0.5rem !important;
  right: 0.5rem !important;
  z-index: var(--z-overlay) !important;
  max-width: 28rem !important;
  margin: 0 auto !important;
  width: auto !important;
  transform: none !important;
}

#cookie-banner:not(.hidden) {
  display: block !important;
  visibility: visible !important;
}

/* Support Chat Widget */
#supportChatWidget {
  position: fixed !important;
  bottom: var(--spacing-base) !important;
  right: var(--spacing-base) !important;
  z-index: var(--z-overlay) !important;
  background: var(--gradient-primary);
  border-radius: var(--border-radius-full);
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-base);
}

/* Progress bar for list spot form */
.progress-bar-container {
  width: 100%;
  margin-left: var(--spacing-base);
  margin-right: var(--spacing-base);
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Mobile optimizations */

/* Cookie banner on large screens - Keep compact */
@media (width >= 1024px) {
  #cookie-banner {
    max-width: 32rem !important;
    left: 1rem !important;
    right: 1rem !important;
    transform: none !important;
  }
}

@media (width <= 640px) {
  /* Cookie banner responsive - Keep compact */
  #cookie-banner {
    left: 0.5rem !important;
    right: 0.5rem !important;
    transform: none !important;
    max-width: 24rem !important;
  }

  /* Support chat positioning */
  #supportChatWidget {
    bottom: var(--spacing-base) !important;
    right: var(--spacing-base) !important;
  }
}

/* Simplified cookie banner */
#cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 28rem;
  margin: 0 auto;
  padding: 1rem;
  border-radius: 0.5rem;
  background: var(--glass-morphism);
  box-shadow: var(--shadow-md);
}

/* ============================================================================
   ENHANCED POSITIONING UTILITIES
   ============================================================================ */

/* Position utilities - disabled to prevent conflicts with debugging */
/* .relative .dropdown-menu.show,
.relative .dropdown-menu.active,
.relative .dropdown-menu.opacity-100,
.relative .dropdown-menu.visible {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  margin-top: 0.5rem !important;
} */

/* Enhanced cookie banner styling */
#cookie-banner {
  background: var(--glass-morphism);
  border-radius: var(--border-radius-base);
  border: 1px solid rgb(255 255 255 / 20%);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

/* Enhanced support chat widget */
#supportChatWidget {
  background: var(--gradient-primary);
  border-radius: var(--border-radius-full);
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-base);
}

/* ============================================================================
   LAYOUT HELPERS
   ============================================================================ */

/* Layout constraint helpers */
.layout-constrained {
  max-width: 72rem; /* 1152px - industry standard */
  margin: 0 auto;
  padding: 0 1rem;
}

/* Responsive layout helpers */
.layout-mobile-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (width >= 768px) {
  .layout-mobile-stack {
    flex-direction: row;
    align-items: center;
  }
}

/* Layout spacing helpers */
.layout-section {
  margin-bottom: 2rem;
}

.layout-section:last-child {
  margin-bottom: 0;
}

/* Layout grid helpers */
.layout-grid {
  display: grid;
  gap: 1rem;
}

.layout-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.layout-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (width <= 768px) {
  .layout-grid-2,
  .layout-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   COMPONENT SPACING
   ============================================================================ */

/* Consistent component spacing */
.component-spacing {
  margin-bottom: 1.5rem;
}

.component-spacing-sm {
  margin-bottom: 1rem;
}

.component-spacing-lg {
  margin-bottom: 2rem;
}

/* Remove spacing from last child */
.component-spacing:last-child,
.component-spacing-sm:last-child,
.component-spacing-lg:last-child {
  margin-bottom: 0;
}

/* ============================================================================
   RESPONSIVE POSITIONING
   ============================================================================ */

/* Mobile-first responsive positioning */
.position-mobile-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-overlay);
}

@media (width >= 768px) {
  .position-mobile-fixed {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    z-index: auto;
  }
}

/* Container positioning helpers */
.position-container {
  position: relative;
  z-index: 1;
}

.position-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
}

/* ============================================================================
   ACCESSIBILITY POSITIONING
   ============================================================================ */

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary-blue);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: var(--z-max);
}

.skip-to-content:focus {
  top: 6px;
}

/* Focus indicator positioning */
.focus-outline {
  position: relative;
}

.focus-outline::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid var(--color-primary-blue);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.focus-outline:focus::after {
  opacity: 1;
}

/* ============================================================================
   LISTSPOT UNIFIED RESPONSIVE DESIGN - CONSOLIDATED CONTAINER LOGIC
   ============================================================================ */

/* Base mainContent styles - unified approach */
#mainContent {
  margin-top: 0 !important;
  padding-left: 1rem;
  padding-right: 1rem;
  min-height: 100vh;
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal overflow */
  -webkit-overflow-scrolling: touch;
  /* Disable pull-to-refresh on main content */
  overscroll-behavior-y: none;
  box-sizing: border-box;
  width: 100%;
  max-width: 100vw;
}

/* FIX: Remove extra space for ListSpot wizard specifically */
#listspot-wizard-form #mainContent {
  padding-top: 0 !important;
}

#listspot-wizard-form .max-w-4xl.mx-auto {
  padding-top: 0 !important;
}

/* Mobile-First Responsive Design */
@media (width <= 768px) {
  html, body {
    height: 100vh;
    overflow-x: hidden;
    /* Disable pull-to-refresh on mobile */
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
  }

  /* Mobile Content Spacing - UNIFIED */
  #mainContent {
    padding-top: 6rem !important;
    padding-bottom: 12rem !important;
  }

  /* FIX: Remove extra space for ListSpot wizard on mobile */
  #listspot-wizard-form #mainContent {
    padding-top: 0 !important;
  }

  .max-w-4xl.mx-auto {
    padding-top: 1rem !important;
    width: 100%;
    max-width: min(85rem, calc(100vw - 2rem)); /* Increased from 56rem to 85rem for better width utilization */
    box-sizing: border-box;
  }

  /* FIX: Remove extra space for ListSpot wizard on mobile */
  #listspot-wizard-form .max-w-4xl.mx-auto {
    padding-top: 0 !important;
  }

  /* Hide desktop elements */
  .desktop-only {
    display: none !important;
  }
}

/* Desktop Styles */
@media (width >= 769px) {
  .mobile-only {
    display: none !important;
  }

  /* Desktop Content Spacing - UNIFIED */
  #mainContent {
    padding-top: 12rem !important; /* Increased to prevent progress bar blocking content */
    padding-bottom: 2rem !important;
  }

  /* FIX: Remove extra space for ListSpot wizard on desktop */
  #listspot-wizard-form #mainContent {
    padding-top: 0 !important;
  }

  .max-w-4xl.mx-auto {
    padding-top: 1rem !important;
    width: 100%;
    max-width: min(85rem, calc(100vw - 2rem)); /* Increased from 56rem to 85rem for better width utilization */
    box-sizing: border-box;
  }

  /* FIX: Remove extra space for ListSpot wizard on desktop */
  #listspot-wizard-form .max-w-4xl.mx-auto {
    padding-top: 0 !important;
  }

  .desktop-only[href*="host_dashboard"] {
    top: 6rem !important;
    z-index: 30 !important;
  }
}

/* Large Screen Styles */
@media (width >= 1280px) {
  .max-w-4xl.mx-auto {
    max-width: min(95rem, calc(100vw - 4rem)); /* Even wider on very large screens (1520px) */
  }
}

/* ============================================================================
   IOS-SPECIFIC STYLES
   ============================================================================ */

/* iOS-specific styles for progressive enhancement */
@supports (-webkit-touch-callout: none) {
  .desktop-only {
    display: none !important;
  }



  /* Disable pull-to-refresh on iOS */
  html, body {
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
  }
}
