/* ==========================================
 * SEARCH.CSS - SEARCH & FILTERS COMPONENTS
 * FILE: /css/discover/components/search.css
 * VERSION: v=20251001
 * ==========================================
 * PURPOSE: Search bar, datetime picker, location field styling
 * COVERAGE: All breakpoints with unified design system (1101px+)
 * FEATURES: Top bar layout, autocomplete, responsive positioning
 * 📄 IMPORTED BY: discover.html (line 323)
 * STATUS: ACTIVE - Core search functionality styling
 * ========================================== */

/**
 * SEARCH INPUT
 * ============
 * Main search input with focus states and animations
 */
#search-input {
  /* SIMPLIFIED: Positioning & Layout */
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: var(--z-elevated) !important; /* Simple fixed z-index */

  /* SIMPLIFIED: Make invisible but functional */
  opacity: 0 !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  padding: 0 !important;
  margin: 0 !important;

  /* SIMPLIFIED: Enable interactions */
  cursor: pointer !important;
  pointer-events: auto !important;

  /* SIMPLIFIED: Prevent mobile zoom */
  font-size: 16px !important;
}
/* SIMPLIFIED: Search display container - must not grow with long content */
.search-display-container {
  /* SIMPLIFIED: Layout */
  position: relative;
  display: block;
  /* NOTE: Width controlled by breakpoint-specific rules - do NOT set width: 100% here */
  min-width: 0; /* Allow shrinking inside flex parent so long addresses don't expand the bar */
  min-height: 3rem;
  cursor: pointer;
  z-index: var(--z-map-container); /* Simple fixed z-index, lower than input */

  /* SIMPLIFIED: Interactions */
  transition: all var(--transition-base, 0.2s ease);
}

.search-display-container:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px #0000001a;
  transition: transform var(--transition-base, 0.2s ease), box-shadow var(--transition-base, 0.2s ease);
}

.search-display-container:active {
  transform: translateY(0);
  transition: transform var(--transition-fast, 0.15s ease);
}

/* Search display container text alignment - match datetime */
.search-display-container .flex.items-center {
  align-items: center !important;
}

.search-display-container .flex-1.min-w-0 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.125rem;
  align-items: flex-start;
  min-width: 0; /* Critical: allow shrinking so long addresses don't expand the container */
  max-width: 100%;
  overflow: hidden;
}

/* Text area: clip horizontally so inner text can use ellipsis. (overflow-x: auto prevented ellipsis.) Full text via span[title]. */
.search-display-container .search-button-display,
.discover-top-bar .search-display-container .search-button-display {
  min-width: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  padding-inline-end: 2px;
}

/* Inner div: min-width 0 so long addresses don't expand container (truncate with ellipsis instead) */
.search-display-container .search-button-display > div,
.discover-top-bar .search-display-container .search-button-display > div {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

/* Truncate long addresses with ellipsis; full text available via title attribute */
.search-display-container .search-button-display > div span.truncate,
.discover-top-bar .search-display-container .search-button-display > div span.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  min-width: 0;
}

/* Placeholder text: allow shrink so long selected values truncate; short placeholder still fits */
.search-display-container .search-placeholder-text,
.discover-top-bar .search-display-container .search-placeholder-text {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

/* Tablet: single-row search + flex min-width safety. Phone top-bar sizing lives in topbar.css. */
@media (min-width: 641px) and (max-width: 1100px) {
  .discover-top-bar .search-field-container {
    min-width: 0 !important;
  }

  .discover-top-bar .search-display-container .flex-1.min-w-0 {
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.25rem !important;
  }
  .discover-top-bar .search-display-container .relative.flex.items-center {
    display: flex !important;
    align-items: center !important;
    flex-direction: row !important;
  }
  .discover-top-bar .search-display-container .flex-shrink-0:first-child,
  .discover-top-bar .search-display-container .flex-shrink-0.mr-1 {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    flex-shrink: 0 !important;
  }
  .discover-top-bar .search-display-container .flex-shrink-0:first-child > div {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .discover-top-bar .search-display-container .search-button-display,
  .discover-top-bar .search-display-container .search-button-display > div {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .discover-top-bar #search-input-description {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .discover-top-bar .search-display-container span.truncate[title],
  .discover-top-bar #search-input-description span.truncate[title] {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
}

/* CRITICAL: Content wrapper must always fill container width and allow shrinking */
.search-display-container > .relative.flex.items-center,
#search-input-display-container > .relative.flex.items-center {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important; /* Allow row to shrink so long addresses don't expand container */
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

/* Search display container text sizing - match datetime */
.search-display-container .text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}

.search-display-container .text-sm {
  font-size: 0.875rem;
  line-height: 1.125rem;
}

/* SIMPLIFIED: Search input focus state */
#search-input:focus {
  z-index: var(--z-elevated); /* Simple fixed z-index higher than normal */
}
/* Search input active state (when searching) */
#search-input.search-active {
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-focus);
  transform: scale(1.02);
  transition: border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
}

/* Coarse pointer: avoid extra scale (reads like zoom next to iOS focus behavior and shifts fixed UI) */
@media (hover: none) and (pointer: coarse) {
  #search-input.search-active {
    transform: none;
  }
}
/* SIMPLIFIED: Search container positioning */
.max-w-md {
  position: relative;
  overflow: visible !important;
}
/* Top bar container overflow management - DESKTOP ONLY */
/* Touch mobile overflow is controlled by topbar.css media query - Override Tailwind items-center class on the main flex container to prevent scrollbar */
.discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0,
.discover-top-bar .flex.items-center.gap-2.sm\:gap-4.lg\:gap-6.flex-1.min-w-0 {
  align-items: flex-start !important; /* Override items-center to allow vertical expansion */
  height: auto !important; /* Flexible height */
  max-height: none !important; /* Remove height constraints */
  min-height: fit-content !important; /* Allow container to grow to fit content */
  /* CRITICAL: Ensure no scrollbar can appear */
  scrollbar-width: none !important; /* Firefox */
}

/* CRITICAL: Hide scrollbar if it somehow appears (webkit) */
.discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0::-webkit-scrollbar,
.discover-top-bar .flex.items-center.gap-2.sm\:gap-4.lg\:gap-6.flex-1.min-w-0::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Hamburger Menu - Clean & Consolidated */
#discover-menu-button {
  position: relative;
  z-index: var(--z-dropdown) !important; /* Override inline z-index: 9999 */
  pointer-events: auto;
  cursor: pointer;
  background: transparent;
  border: none;
  outline: none;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
}

/* Prevent image stretching in profile menu button (tablet+; phone sizes live in topbar.css). */
@media (min-width: 641px) {
  #discover-menu-button.profile-menu-trigger img,
  #discover-menu-button img {
    width: 2rem !important;
    height: 2rem !important;
    min-width: 2rem !important;
    max-width: 2rem !important;
    min-height: 2rem !important;
    max-height: 2rem !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 9999px !important;
    display: block !important;
    flex-shrink: 0 !important;
  }
}

/* CRITICAL: Override inline z-index that's blocking other elements */
#discover-menu-button[style*="z-index: 9999"],
#discover-menu-button[style*="z-index:9999"] {
  z-index: var(--z-dropdown) !important; /* Use proper z-index variable instead of 9999 */
}

/* Ensure container doesn't block other elements */
.discover-top-bar .flex-shrink-0.flex.items-center.gap-2:last-child {
  position: relative !important;
  z-index: var(--z-dropdown) !important; /* Match button z-index */
  pointer-events: auto !important;
  isolation: isolate !important; /* Create new stacking context */
  width: auto !important; /* Only take space needed */
  min-width: auto !important;
  max-width: fit-content !important; /* Don't extend beyond button */
  contain: layout style !important; /* Contain layout but allow pointer events */
}

/* Discover hamburger dropdown: visuals + box model. Position/z-index on Discover: discover-base-overrides.css */
#discover-menu {
  position: fixed;
  z-index: var(--z-dropdown-menu);
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  bottom: auto !important;
  min-width: 12rem !important;
  max-width: 18rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(229, 231, 235, 0.5) !important;
  border-radius: 0.75rem !important;
  background: var(--discover-glass-strong, rgba(248, 250, 252, 0.98)) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: 0 20px 25px -5px #0000001a, 0 10px 10px -5px #0000000a !important;
  transform-origin: top center !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.95) translateY(-10px);
  transition: all 0.2s ease-out;
}

.dark #discover-menu,
html.dark #discover-menu,
body.dark #discover-menu {
  background: rgba(31, 41, 55, 0.98) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-color: rgba(55, 65, 81, 0.5) !important;
  box-shadow: 0 20px 25px -5px #0000004d, 0 10px 10px -5px #00000033 !important;
}

#discover-menu:not(.hidden) {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: scale(1) translateY(0) !important;
}

#discover-menu.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: scale(0.95) translateY(-10px) !important;
}

/* Phone: match global dropdown bottom-sheet pattern (dropdown.css <=520px) */
@media (max-width: 520px) {
  #discover-menu,
  #discover-menu[style],
  div#discover-menu,
  div#discover-menu[style] {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: var(--swiftspot-browser-chrome-bottom, 0px) !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    border-radius: var(--radius-sheet, 1rem) var(--radius-sheet, 1rem) 0 0;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px)) !important;
    box-shadow: 0 -8px 32px rgb(0 0 0 / 12%) !important;
  }

  #discover-menu:not(.hidden),
  #discover-menu[style]:not(.hidden) {
    transform: translateY(0) !important;
  }

  #discover-menu.hidden,
  #discover-menu[style].hidden {
    transform: translateY(100%) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #discover-menu {
    transition: none !important;
  }

  #discover-menu.hidden {
    transform: none !important;
  }
}

/* AGGRESSIVE PROTECTION: Ensure discover menu items aren't affected by broad selectors */
body.discover-page #discover-menu .dropdown-item,
body.discover-page #discover-menu button,
body.discover-page #discover-menu a:not(.discover-menu-profile-link),
#discover-menu .dropdown-item,
#discover-menu button,
#discover-menu a:not(.discover-menu-profile-link) {
  pointer-events: auto !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important; /* CRITICAL: Prevent items from exceeding container width */
  text-align: left !important;
  padding: 0.5rem 1rem !important;
  /* Prevent horizontal overflow */
  box-sizing: border-box !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  overflow-x: hidden !important; /* CRITICAL: Prevent horizontal scrollbar */
  white-space: normal !important;
  color: var(--discover-menu-text, #0f172a) !important;
  -webkit-text-fill-color: currentColor !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
}

/* Ensure the dropdown parent container allows overflow */
.discover-top-bar .flex-shrink-0 {
  position: relative;
}

/* CRITICAL: Ensure right section (hamburger menu) is not clipped */
.discover-top-bar .flex.items-center.justify-between.w-full > .flex-shrink-0:last-child,
.discover-top-bar > div.flex.items-center.justify-between.w-full > div.flex-shrink-0:last-child {
  overflow: visible !important;
  position: relative !important;
  z-index: var(--z-dropdown) !important;
  width: auto !important; /* Don't extend beyond content */
  max-width: none !important; /* Allow natural sizing */
  pointer-events: auto !important; /* Ensure it's interactive */
}

/* Search/date responsive layout is owned by topbar.css. */

/* Selected location value inside the search display */
.discover-top-bar .search-display-container #search-input-description span[title] {
  display: block !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/*
 * Wide tablet (769–1100): fill the toolbar search track (owned by topbar grid tokens).
 * Do not re-introduce fixed ~240px pill max-widths — they created dead space past 768px.
 */
@media (min-width: 769px) and (max-width: 1100px) {
  .discover-top-bar .search-field-container {
    min-width: 0 !important;
    width: 100% !important;
    max-width: none !important;
    flex-shrink: 1 !important;
    overflow: hidden !important;
  }

  .discover-top-bar .search-field-container > .relative {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .discover-top-bar .search-display-container,
  .discover-top-bar #search-input-display-container {
    width: 100% !important;
    max-width: 100% !important;
    transform: translateX(0px) !important;
    transition: transform var(--transition-base, 0.2s ease) !important;
  }

  .discover-top-bar .search-display-container:hover,
  .discover-top-bar .search-display-container:active,
  .discover-top-bar .search-display-container:focus {
    transform: translateX(0px) !important;
    transition: box-shadow var(--transition-base, 0.2s ease) !important;
  }

  .discover-top-bar .datetime-field-container,
  body.discover-page .discover-top-bar .datetime-field-container,
  div.discover-top-bar .datetime-field-container,
  .discover-top-bar > div > div.datetime-field-container,
  html body .discover-top-bar .datetime-field-container,
  html body div.discover-top-bar .datetime-field-container {
    position: relative !important;
    left: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
  }

  html body.discover-page .discover-top-bar .datetime-display-container[style] {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  html body.discover-page .discover-top-bar .datetime-display-container,
  .discover-top-bar .datetime-display-container {
    transform: none !important;
  }

  html body.discover-page .discover-top-bar .datetime-display-container:hover,
  .discover-top-bar .datetime-display-container:hover,
  html body.discover-page .discover-top-bar .datetime-display-container:active,
  .discover-top-bar .datetime-display-container:active,
  html body.discover-page .discover-top-bar .datetime-display-container:focus,
  .discover-top-bar .datetime-display-container:focus {
    transform: none !important;
  }

  .discover-top-bar .search-display-container .flex-shrink-0.hidden.sm\:block,
  .discover-top-bar .search-display-container .search-arrow-container,
  .discover-top-bar .search-display-container svg,
  .discover-top-bar .search-display-container .flex-shrink-0 svg,
  .discover-top-bar .search-button-display svg {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/*
 * Compact desktop (1101–1279): amenity rail is collapsed — let grid tokens size the
 * search track. Fixed 270px max left a dead strip before the menu on mid-width desktops.
 */
@media (min-width: 1101px) and (max-width: 1279px) {
  .discover-top-bar .search-field-container,
  .discover-top-bar .flex-1.min-w-0.search-field-container {
    max-width: none !important;
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .discover-top-bar .search-field-container > .relative {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Allow text expansion while maintaining unified styling */
  .search-display-container .flex-1.min-w-0 {
    overflow: visible !important;
    flex-direction: column !important;
    justify-content: center !important; /* Center content vertically */
  }

  .search-button-display {
    overflow: visible !important;
  }

  .search-button-display .text-xs,
  .search-button-display .text-sm {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Ensure text spans can expand properly */
  .search-display-container span {
    max-width: 100% !important;
    width: 100% !important;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
  }
}

/* DESKTOP+ DESIGN SYSTEM: ≥1101px */

/* Ensure "Find parking" placeholder is always visible */
#search-input-display-value {
  color: var(--discover-chrome-text) !important;
  font-weight: 500 !important;
  /* CRITICAL: Prevent text overflow */
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: 100% !important;
}

.dark #search-input-display-value {
  color: #9ca3af !important; /* gray-400 in dark mode */
}

/* CRITICAL: Prevent datetime display value from overflowing */
#datetime-display-value {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: 100% !important;
  display: block !important;
  flex-shrink: 1 !important; /* Allow it to shrink */
  min-width: 0 !important; /* Critical for flex truncation */
}
/* Ensure "When do you need parking?" label doesn't get cut off */
.datetime-display-container .text-xs.font-medium.text-gray-500,
.datetime-display-container .text-xs.font-medium.uppercase {
  overflow: visible !important;
  white-space: nowrap !important; /* Keep on one line */
  text-overflow: clip !important;
  max-width: 120% !important;
  line-height: 1.2 !important;
}

/* Ensure all text containers respect their bounds - ALLOW VERTICAL EXPANSION */
/* NOTE: flex properties controlled by breakpoint-specific rules - do NOT set flex here */
.search-display-container,
#search-input-display-container {
  overflow-x: hidden !important; /* Prevent horizontal overflow */
  overflow-y: visible !important; /* CRITICAL: Allow vertical expansion - prevent scrollbar */
  overflow: visible !important; /* CRITICAL: Override Tailwind overflow-hidden class */
  max-height: none !important; /* Allow vertical expansion */
  height: auto !important; /* Flexible height */
  /* CRITICAL: Prevent scrollbar on mobile */
  scrollbar-width: none !important; /* Firefox */
}

/* Desktop/tablet: listings.css overflow-y:visible + long addresses; must not apply below 520px (fine-pointer
   desktops at narrow DevTools widths were matching (hover:hover)+(pointer:fine) and overriding narrow caps). */
@media (min-width: 641px) and (hover: hover) and (pointer: fine), (min-width: 768px) {
  .search-display-container,
  #search-input-display-container {
    max-width: 100% !important;
  }

  /* Override listings.css (line 809): prevent container from growing with long addresses.
     Higher specificity so these win after listings.css sets display:flex / overflow-y:visible. */
  html body.discover-page .discover-top-bar #search-input-display-container.search-display-container,
  html body.discover-page .discover-top-bar .search-display-container,
  .discover-top-bar #search-input-display-container.search-display-container {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overflow: hidden !important;
  }
}

/* CRITICAL: Hide scrollbar if it somehow appears (webkit) */
.search-display-container::-webkit-scrollbar,
#search-input-display-container::-webkit-scrollbar,
.datetime-display-container::-webkit-scrollbar,
.datetime-display-container *::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* datetime-display-container must allow overflow to prevent clipping */
.datetime-display-container {
  overflow: visible !important; /* Changed from hidden to visible to prevent clipping */
  overflow-y: visible !important; /* Allow vertical expansion */
  overflow-x: visible !important;
  max-width: none !important; /* Changed from 100% to none to allow expansion */
  max-height: none !important; /* Allow vertical expansion */
  height: auto !important; /* Flexible height to fit content */
  flex-shrink: 1 !important; /* Allow container to shrink */
  position: relative !important;
  scrollbar-width: none !important; /* Firefox */
}

/* CRITICAL: All datetime children must not cause scroll */
.datetime-display-container *,
.datetime-display-container .relative,
.datetime-display-container .flex {
  scrollbar-width: none !important;
}

/* CRITICAL: Parent field containers must allow vertical expansion */
.datetime-field-container,
.search-field-container {
  overflow-y: visible !important; /* Allow vertical expansion */
  max-height: none !important; /* Allow containers to expand */
  height: auto !important; /* Flexible height */
  align-self: center !important; /* Center vertically within top bar */
  display: flex !important; /* Ensure flex layout */
  align-items: center !important; /* Center content within container */
  min-height: fit-content !important; /* Allow container to grow to fit content */
}

/* iOS 13/14 Safari Compatibility: Fallback rules without :has() selector */
/* :has() is not supported in iOS 13 Safari (Safari 13.x), so we need explicit fallbacks */
/* These rules ensure the search field is visible even when :has() selectors fail */

/* Base fallback - ensure search field container is always visible */
.discover-top-bar .search-field-container {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex: 1 1 0% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  position: relative !important;
}

.discover-top-bar .search-display-container {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  /* NOTE: width controlled by breakpoint-specific rules - do NOT set width: 100% here */
  position: relative !important;
}

/* iOS 13/14 Safari: visibility only; final phone sizing lives in topbar.css. */
@media screen and (max-width: 520px) {
  .discover-top-bar .search-field-container {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
  }

  .discover-top-bar .search-display-container {
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
  }

  .discover-top-bar .flex-1.min-w-0.search-field-container,
  .discover-top-bar .flex-1.min-w-0 .search-field-container,
  .discover-top-bar .flex.items-center .search-field-container {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* CRITICAL: Fix flex-1 min-w-0 container to properly truncate */
.search-display-container .flex-1.min-w-0 {
  overflow: hidden !important;
  min-width: 0 !important; /* Essential for flex truncation */
  flex-shrink: 1 !important;
  max-width: 100% !important;
}

/* Text column in the search row must grow to fill space after the icon. */
.search-display-container > .relative.flex.items-center > .flex-1.min-w-0,
.discover-top-bar .search-display-container > .relative.flex.items-center > .flex-1.min-w-0 {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  align-self: stretch !important;
}

.search-display-container .flex-1.min-w-0 .search-button-display {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

/* Ensure child elements also truncate */
.search-display-container .flex-1.min-w-0 > * {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Composing input: flex-grow into all remaining search width (width:0 + flex:1 pattern). */
.search-display-container.search-composing .flex-1.min-w-0 {
  flex: 1 1 0% !important;
  width: auto !important;
  max-width: none !important;
}

.search-display-container.search-composing .flex-1.min-w-0 > #search-input {
  position: relative !important;
  flex: 1 1 0% !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box !important;
  clip: auto !important;
  clip-path: none !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* AGGRESSIVE: Target the specific datetime text element */
.datetime-display-container #datetime-display-value,
.datetime-display-container [id*="datetime-display-value"] {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: block !important;
}

/* Content wrapper must allow vertical expansion to prevent scrollbar */
.datetime-display-container .relative.flex.items-center {
  overflow-x: hidden !important; /* Prevent horizontal overflow */
  overflow-y: visible !important; /* CRITICAL: Allow vertical expansion to prevent scrollbar */
  max-width: 100% !important;
  max-height: none !important; /* Allow vertical expansion */
  height: auto !important; /* Flexible height */
}

/* Date/time responsive sizing is owned by the shared toolbar rules in topbar.css. */

/* Responsive search button display text */
.search-button-display .text-xs.font-medium,
.search-button-display .text-sm.font-medium {
  color: var(--discover-chrome-text) !important;
  font-weight: 500 !important;
}

.dark .search-button-display .text-xs.font-medium,
.dark .search-button-display .text-sm.font-medium {
  color: #d1d5db !important; /* gray-300 in dark mode */
}

.search-button-display #search-input-description span[title] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: inherit !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Ensure location field arrow icon stays visible on all breakpoints */
.discover-top-bar .search-display-container svg,
.discover-top-bar .search-display-container .flex-shrink-0 svg,
.discover-top-bar .search-button-display svg,
.search-display-container .dropdown-arrow svg,
.search-display-container .chevron-down svg {
  display: block !important; /* Override any Tailwind responsive display classes */
  visibility: visible !important;
  opacity: 1 !important;
}

/* Search icon container padding adjustment */
.discover-top-bar .search-display-container .flex-shrink-0:first-child > div {
  padding-top: 0.125rem !important; /* Slightly reduced top padding */
  padding-bottom: 0.125rem !important; /* Equivalent bottom padding */
}

/* TARGETED FIX: Force these two specific datetime elements to behave identically */

/* Target datetime elements with different content but force same behavior */
.discover-top-bar .datetime-field-container:has(#datetime-display-value),
.discover-top-bar .datetime-field-container:has([id*="datetime-display-value"]) {
  /* Force identical positioning, width, and margins for both variants */
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  /* Ensure identical spacing */
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  /* Force same transform behavior */
  transform: none !important;
}

/* DESKTOP UNDER 1280px: DateTime display container behavior - MOVED TO 1101px */
@media (min-width: 1101px) and (max-width: 1279px) {
  .discover-top-bar .datetime-display-container:has(#datetime-display-value),
  .discover-top-bar .datetime-display-container:has([id*="datetime-display-value"]) {
    /* Force identical display container behavior for both variants - DESKTOP */
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important; /* Slightly smaller width for regular desktop */
    height: auto !important;
    /* Reset any conflicting transforms */
    transform: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* XL DESKTOP 1280px AND UP: DateTime display container behavior */
@media (min-width: 1280px) {
  .discover-top-bar .datetime-display-container:has(#datetime-display-value),
  .discover-top-bar .datetime-display-container:has([id*="datetime-display-value"]) {
    /* Force identical display container behavior for both variants - XL DESKTOP */
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important; /* Original width for XL desktop */
    height: auto !important;
    /* Reset any conflicting transforms */
    transform: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow: hidden !important;
  }

  /* XL DESKTOP: Make datetime text viewable area wider without affecting container */
  .discover-top-bar #datetime-display-value.truncate,
  .discover-top-bar #datetime-display-value,
  html body.discover-page .discover-top-bar #datetime-display-value.truncate,
  html body.discover-page .discover-top-bar #datetime-display-value,
  html body.discover-page .discover-top-bar .datetime-display-container #datetime-display-value.truncate {
    text-overflow: ellipsis !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
    flex-grow: 1 !important;
  }

  /* XL DESKTOP: Ensure parent containers don't constrain the datetime text */
  .discover-top-bar .datetime-display-container .flex-1.min-w-0,
  .discover-top-bar .datetime-display-container .flex-1,
  html body.discover-page .discover-top-bar .datetime-display-container .flex-1.min-w-0 {
    overflow: visible !important;
    min-width: auto !important; /* Remove min-width constraint */
    flex-shrink: 0 !important; /* Prevent shrinking */
  }
}

/* DESKTOP: Center datetime text content horizontally */

/* Desktop/tablet only — :has(#id) specificity must not smash the phone When chip. */
@media (min-width: 641px) {
  .discover-top-bar .datetime-field-container:has(#datetime-display-value) {
    max-width: 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    flex: initial !important;
    flex-grow: initial !important;
  }
}

/* Let datetime text truncate normally in the tablet toolbar range. */
@media (min-width: 641px) and (max-width: 1100px) {
  /* Keep date text inside the shared toolbar column so it cannot detach from the trigger. */
  html body.discover-page .datetime-display-container #datetime-display-value.truncate,
  body.discover-page .datetime-display-container #datetime-display-value.truncate,
  .discover-top-bar .datetime-display-container #datetime-display-value.truncate,
  .datetime-display-container #datetime-display-value.truncate,
  #datetime-display-value.truncate,
  #datetime-display-value {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    position: relative !important;
    z-index: auto !important;
  }

  /* Parent participates in normal shrink/truncate behavior. */
  .datetime-display-container .flex-1.min-w-0 {
    overflow: hidden !important;
    max-width: 100% !important;
    min-width: 0 !important;
    position: relative !important;
  }

  .datetime-display-container .relative.flex.items-center {
    overflow: hidden !important;
  }
}

/* Force consistent arrow visibility for both datetime variants */
.discover-top-bar .datetime-display-container:has(#datetime-display-value) .flex-shrink-0.hidden.sm\:block,
.discover-top-bar .datetime-display-container:has(#datetime-display-value) .flex-shrink-0 svg {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure consistent time formatting with space before AM/PM */

/* Target datetime display value for consistent formatting */
#datetime-display-value {
  /* Ensure consistent text rendering and spacing */
  font-variant-numeric: tabular-nums !important; /* Consistent number spacing */
  white-space: nowrap !important;
  font-feature-settings: "tnum" !important; /* Tabular numbers for consistent spacing */
}

/* Apply truncation only on smaller screens, not desktop */
@media (max-width: 1279px) {
  #datetime-display-value {
    text-overflow: ellipsis !important;
    overflow: hidden !important;
  }
}

/* CSS fix to ensure space before AM/PM - this will need JavaScript support */
/* Note: The actual fix should be in JavaScript to ensure "7:30PM" becomes "7:30 PM" */
/* TABLET TIME FORMATTING: Fixed in DateTimePicker.js formatDisplayText method */

/* DESKTOP TEXT DISPLAY: search labels only (datetime trigger is value-only on Discover) */
@media (min-width: 1101px) {
  .search-display-container .text-xs.font-medium:not(.hidden),
  .search-display-container .text-sm.font-medium:not(.hidden),
  .search-button-display .text-xs.font-medium:not(.hidden),
  .search-button-display .text-sm.font-medium:not(.hidden) {
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* Ensure hidden elements stay hidden */
  .search-display-container .hidden,
  .search-button-display .hidden {
    display: none !important;
  }
}
/* Adjust flex layout - make right section (hamburger menu) much smaller */
.discover-top-bar .flex.items-center.justify-between {
  gap: 8px !important;
}

/* Make the right section (hamburger menu) take minimal space */
.discover-top-bar .flex-shrink-0:last-child {
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  flex-basis: auto !important;
  width: auto !important;
  min-width: 27px !important;
  max-width: 27px !important;
}

/* Control the main top bar layout - now works with responsive.css fix */
.discover-top-bar > div.flex.items-center.justify-between.w-full {
  gap: 0 !important;
}

/* Control the left side container layout */
.discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0 {
  gap: 8px !important;
  flex-grow: 1 !important;
  flex-shrink: 1 !important;
}
/* Desktop amenity chip rail: sits after search/datetime in primary row (no flex push-right) */
.discover-top-bar .amenity-chips-container {
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Ensure hamburger menu stays on the right */
.discover-top-bar > div.flex.items-center.justify-between.w-full > div.flex-shrink-0:last-child {
  margin-left: 0 !important;
}

/* DESKTOP POSITIONING: 1101px-1279px - MOVED UP FROM 1024px */
@media (min-width: 1101px) and (max-width: 1279px) {
  .discover-top-bar .flex-shrink-0:last-child {
    min-width: 9px !important;
    max-width: 68px !important;
  }

  .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0 {
    gap: 16px !important;
  }

  .discover-top-bar .datetime-field-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    transform: none !important;
  }

  .discover-top-bar .datetime-display-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .discover-top-bar .amenity-chips-container {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* DESKTOP DATETIME VERTICAL CENTERING - Override tablet height constraints */
  .discover-top-bar .datetime-field-container {
    display: flex !important;
    align-items: center !important;
    align-self: center !important;
    min-height: 3rem !important;
  }

  .discover-top-bar .datetime-display-container {
    height: auto !important; /* Allow natural height on desktop */
    min-height: 3rem !important; /* Minimum height for alignment */
    max-height: none !important; /* Remove tablet height restriction */
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
  }
}

/* XL DESKTOP BREAKPOINT: wide screens with full two-line datetime + relaxed spacing */
@media (min-width: 1420px) {
  /* XL Desktop: Aggressive alignment fix for large screens */

  /* Fix the main top bar container alignment */
  html body.discover-page .discover-top-bar {
    display: flex !important;
    align-items: flex-start !important; /* CRITICAL: Use flex-start to allow vertical expansion */
    min-height: 4rem !important;
    height: auto !important; /* CRITICAL: Allow top bar to expand */
    max-height: none !important; /* Remove height constraints */
  }

  /* Fix the main flex container inside top bar */
  html body.discover-page .discover-top-bar .flex.items-center.justify-between.w-full {
    align-items: flex-start !important; /* CRITICAL: Use flex-start to allow vertical expansion */
    display: flex !important;
    min-height: 4rem !important;
    height: auto !important; /* CRITICAL: Allow container to expand */
    max-height: none !important; /* Remove height constraints */
  }

  /* Fix the left side container - CRITICAL: Ensure all children are vertically centered */
  html body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0,
  html body.discover-page .discover-top-bar .flex.items-center.gap-2.sm\\:gap-4.lg\\:gap-6.flex-1.min-w-0 {
    align-items: flex-start !important; /* CRITICAL: Allow vertical expansion */
    display: flex !important;
    gap: 16px !important;
    min-height: 4rem !important;
    height: auto !important; /* CRITICAL: Use auto instead of 100% to allow expansion */
    max-height: none !important; /* Allow vertical expansion */
    overflow-y: visible !important; /* CRITICAL: Prevent scrollbar - allow vertical expansion */
    overflow-x: visible !important; /* Allow horizontal overflow for dropdowns */
    /* CRITICAL: Remove any height constraints that might cause scrollbar */
    box-sizing: border-box !important;
  }

  /* CRITICAL: Center entry field containers vertically within the flex container */
  html body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0 .datetime-field-container,
  html body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0 .search-field-container,
  html body.discover-page .discover-top-bar .flex.items-center.gap-2.sm\\:gap-4.lg\\:gap-6.flex-1.min-w-0 .datetime-field-container,
  html body.discover-page .discover-top-bar .flex.items-center.gap-2.sm\\:gap-4.lg\\:gap-6.flex-1.min-w-0 .search-field-container {
    align-self: center !important; /* Center vertically within flex container */
  }

  /* CRITICAL: Center logo, amenity chips, and menu button vertically */
  html body.discover-page .discover-top-bar .flex.items-center.justify-between.w-full > .flex-shrink-0:first-child,
  html body.discover-page .discover-top-bar .discover-toolbar-primary .amenity-chips-container,
  html body.discover-page .discover-top-bar .flex.items-center.justify-between.w-full > .amenity-chips-container,
  html body.discover-page .discover-top-bar .flex.items-center.justify-between.w-full > .flex-shrink-0:last-child {
    align-self: center !important; /* Center vertically */
  }

  /* CONSOLIDATED XL DESKTOP: DateTime field container alignment - ROOT CAUSE FIX */
  html body.discover-page .discover-top-bar .datetime-field-container,
  html body.discover-page .discover-top-bar .datetime-field-container[style],
  html body.discover-page .discover-top-bar .flex.items-center .datetime-field-container[style] {
    display: flex !important;
    align-items: center !important;
    align-self: center !important;
    justify-self: center !important; /* Additional centering */
    min-height: 3rem !important;
    max-height: none !important; /* Allow expansion for content */
    margin-left: 15px !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    /* CRITICAL: Force vertical centering alignment */
    position: relative !important;
    top: 0 !important;
    transform: none !important;
    overflow-y: visible !important; /* Allow vertical expansion */
  }

  /* CONSOLIDATED XL DESKTOP: DateTime display container alignment - FLEXIBLE HEIGHT */
  html body.discover-page .discover-top-bar .datetime-display-container,
  html body.discover-page .discover-top-bar .datetime-field-container .datetime-display-container,
  html body.discover-page .discover-top-bar .datetime-display-container[style] {
    display: flex !important;
    align-items: center !important;
    align-self: center !important;
    min-height: 3rem !important;
    max-height: none !important; /* Allow expansion for content */
    height: auto !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    vertical-align: middle !important; /* Additional centering fallback */
    position: relative !important;
    top: 0 !important;
    transform: none !important;
  }

  /* CRITICAL: Ensure inner content wrapper is vertically centered */
  html body.discover-page .discover-top-bar .datetime-display-container .flex.items-center {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* CRITICAL: Match datetime container height to search field height - FLEXIBLE */
  .discover-top-bar .datetime-display-container {
    height: auto !important; /* Flexible height to fit content */
    min-height: 3rem !important; /* Minimum height for touch targets */
    max-height: none !important; /* Allow expansion for content */
    display: flex !important;
    align-items: center !important;
    align-self: center !important;
    overflow-y: visible !important; /* Allow vertical expansion */
  }

  /* Ensure search and datetime fields have identical alignment */
  .discover-top-bar .search-display-container,
  .discover-top-bar .datetime-display-container {
    align-self: center !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }


  .discover-top-bar .datetime-display-container .w-5.h-5,
  .discover-top-bar .datetime-display-container .sm\\:w-6.sm\\:h-6 {
    width: 1rem !important; /* Smaller container - 16px instead of 20px/24px */
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
  }

  .discover-top-bar .datetime-display-container .w-2\.5.h-2\.5,
  .discover-top-bar .datetime-display-container .sm\:w-3.sm\:h-3 {
    width: 0.625rem !important; /* Smaller SVG - 10px instead of 10px/12px */
    height: 0.625rem !important;
  }

  /* Alternative approach using attribute selectors for more specificity */
  .discover-top-bar .datetime-display-container svg[class*="w-2.5"],
  .discover-top-bar .datetime-display-container svg[class*="w-3"] {
    width: 0.625rem !important;
    height: 0.625rem !important;
  }

  .discover-top-bar .datetime-display-container div[class*="w-5"],
  .discover-top-bar .datetime-display-container div[class*="w-6"] {
    width: 1rem !important;
    height: 1rem !important;
  }

  /* ULTRA HIGH SPECIFICITY - Force content wrapper alignment */
  html body.discover-page .discover-top-bar .datetime-display-container .relative,
  html body.discover-page .discover-top-bar .datetime-display-container div[class*="relative"] {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 3rem !important;
    height: auto !important;
    margin: 0 !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
}
/* Bottom sheet drag-handle geometry is owned by bottomsheet.css. */

/* TARGETED: Only override containers that affect dropdown, preserve main container */
body.discover-page .flex-1.flex.overflow-visible.min-h-0,
body.discover-page .discover-content-area {
  overflow: visible !important;
  contain: none !important;
}

@media (min-width: 1101px) {
  body.discover-page main[role="main"] {
    overflow: visible !important;
    contain: none !important;
  }
}

@media (max-width: 1100px) {
  body.discover-page main[role="main"] {
    overflow: hidden !important;
    contain: none !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
}
/* Legacy h-screen shell + discover-app-shell: stable svh, no page scroll. */
body.discover-page .discover-app-shell,
body.discover-page .h-screen.flex.flex-col.overflow-hidden {
  overflow: hidden !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  min-height: 0 !important;
}

/* ENHANCED SEARCH FIELD UX IMPROVEMENTS */

/* Search button display styling */
.search-button-display {
  cursor: pointer !important;
  pointer-events: auto !important;
  display: block !important;
  width: 100% !important;
  min-height: 1.5rem !important;
  padding: 0 0 !important;
}

.search-button-display:hover {
  opacity: 0.8 !important;
}
/* MOBILE + TABLET + DESKTOP: ≤1279px */
@media (max-width: 1279px) {
  .search-button-display {
    overflow: hidden !important;
  }

  .search-button-display .text-xs,
  .search-button-display .text-sm {
    width: 100% !important;
    overflow: hidden !important;
  }

  .search-button-display .truncate {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Force truncation ONLY for selected location spans (with title attribute) */
  .search-button-display span[title] {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}
/* Enhanced search field UX improvements */
.search-display-container {
  transition: opacity var(--transition-base, 0.2s ease), transform var(--transition-base, 0.2s ease), background-color var(--transition-base, 0.2s ease) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}

.search-display-container:hover {
  border-color: var(--discover-chrome-border-strong) !important;
  box-shadow: var(--discover-premium-focus) !important;
}

.search-display-container.search-focused,
.search-display-container:focus-within {
  border-color: var(--discover-chrome-border-strong) !important;
  box-shadow: var(--discover-premium-focus) !important;
  background-color: var(--discover-chrome-surface-solid) !important;
}

.dark .search-display-container.search-focused,
.dark .search-display-container:focus-within {
  border-color: var(--discover-chrome-border-strong) !important;
  box-shadow: var(--discover-premium-focus) !important;
  background-color: var(--discover-chrome-surface-solid) !important;
}

/* Input field styling improvements */
.search-display-container input {
  transition: opacity var(--transition-base, 0.2s ease), transform var(--transition-base, 0.2s ease), background-color var(--transition-base, 0.2s ease) !important;
}

.search-display-container input:focus {
  color: var(--discover-chrome-text) !important;
}

.dark .search-display-container input:focus {
  color: var(--discover-chrome-text) !important;
}

/* Loading state for search arrow */
/* NOTE: @keyframes spin is defined in base/animations.css */
.search-arrow-container.loading svg {
  animation: spin 1s linear infinite;
}

/* Ensure dropdown is visible when shown */
#unified-autocomplete.show {
  display: flex !important;
  flex-direction: column !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: var(--z-discover-address-autocomplete) !important;
  isolation: isolate !important;
}

#unified-autocomplete.visible,
#unified-autocomplete[style*="display: block"],
#unified-autocomplete[style*="display: flex"] {
  z-index: var(--z-discover-address-autocomplete) !important;
}

/* Override any hidden classes when dropdown should be visible */
#unified-autocomplete.show.hidden {
  display: flex !important;
}

/* Dropdown positioning — shell visuals in discover-popover.css */
#unified-autocomplete {
  position: fixed;
}

body.discover-page .search-display-container.aca-trigger-attached {
  border-color: var(--discover-popover-border, rgba(214, 211, 208, 0.68)) !important;
  box-shadow: var(--discover-popover-shadow, 0 20px 40px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.06)) !important;
}

body.discover-page .search-display-container.aca-trigger-attached-below {
  border-bottom-left-radius: 0.45rem !important;
  border-bottom-right-radius: 0.45rem !important;
}

body.discover-page .search-display-container.aca-trigger-attached-above {
  border-top-left-radius: 0.45rem !important;
  border-top-right-radius: 0.45rem !important;
}

/* Main field composing mode: type in the top bar while suggestions panel is open */
.search-display-container.search-composing .search-button-display {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.search-display-container.search-composing .flex-1.min-w-0 {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  align-self: stretch !important;
  flex: 1 1 0% !important;
  width: auto !important;
  max-width: none !important;
  gap: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
}

.search-display-container.search-composing #search-input {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  opacity: 1 !important;
  clip: auto !important;
  clip-path: none !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  outline: none !important;
  background: transparent !important;
  color: var(--discover-chrome-text, #292524) !important;
  /* Keep ≥16px always — iOS Safari zooms focused inputs under 16px. Do not rely on
     (hover:none)/(pointer:coarse) media queries alone; they miss some mobile WebViews. */
  font-size: 16px !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
  align-self: stretch !important;
  z-index: 2 !important;
  cursor: text !important;
  text-align: left !important;
}

.dark .search-display-container.search-composing #search-input {
  color: var(--discover-chrome-text, #f5f5f4) !important;
}

.search-display-container.search-composing #search-input::placeholder {
  color: var(--discover-popover-text-muted, #78716c) !important;
  opacity: 1 !important;
}

.dark .search-display-container.search-composing #search-input::placeholder {
  color: var(--discover-popover-text-muted-dark, #a8a29e) !important;
}

/* CRITICAL: Override inline overflow-y: hidden to allow scrolling to "show more" button */
.autocomplete-suggestions[style*="overflow-y: hidden"],
.autocomplete-suggestions[style*="overflow-y:hidden"] {
  overflow-y: auto !important; /* Allow scrolling to access "show more" button */
}

/* AUTOCOMPLETE DROPDOWN POSITIONING */

/* Dropdown positioning controlled by JavaScript for consistency */

/* AUTOCOMPLETE NAV BAR (back button only) */

.autocomplete-nav-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.65rem 0.25rem;
  border-bottom: 1px solid var(--discover-popover-border, rgba(214, 211, 208, 0.68));
}

.dark .autocomplete-nav-bar {
  border-bottom-color: var(--discover-popover-border-dark, rgba(82, 82, 82, 0.72));
}

.autocomplete-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.65rem;
  background: var(--discover-popover-bg-elevated, #ffffff);
  color: var(--discover-popover-text, #292524);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.autocomplete-back-button:hover {
  background: var(--discover-popover-hover, rgba(245, 245, 244, 0.92));
}

.dark .autocomplete-back-button {
  background: var(--discover-popover-bg-dark-elevated, #2f2f2f);
  color: var(--discover-popover-text-dark, #f5f5f4);
}

.dark .autocomplete-back-button:hover {
  background: var(--discover-popover-hover-dark, rgba(64, 64, 64, 0.78));
}

@media (hover: none) and (pointer: coarse) {
  html body.discover-page .discover-top-bar .search-display-container.search-composing .search-button-display,
  html body.discover-page .discover-top-bar .search-display-container.search-composing .search-button-display > div {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html body.discover-page .discover-top-bar .search-display-container.search-composing #search-input,
  .search-display-container.search-composing #search-input {
    opacity: 1 !important;
    visibility: visible !important;
    color: var(--discover-chrome-text, #171412) !important;
    -webkit-text-fill-color: currentColor !important;
    caret-color: currentColor !important;
    font-size: 16px !important;
  }

  html body.discover-page .discover-top-bar .search-display-container.search-composing #search-input::placeholder,
  .search-display-container.search-composing #search-input::placeholder {
    color: var(--discover-popover-text-muted, #78716c) !important;
    opacity: 1 !important;
    -webkit-text-fill-color: currentColor !important;
  }

  html.dark body.discover-page .discover-top-bar .search-display-container.search-composing #search-input,
  html body.dark.discover-page .discover-top-bar .search-display-container.search-composing #search-input,
  .dark .search-display-container.search-composing #search-input {
    color: var(--discover-chrome-text, #fafaf9) !important;
  }

  html.dark body.discover-page .discover-top-bar .search-display-container.search-composing #search-input::placeholder,
  html body.dark.discover-page .discover-top-bar .search-display-container.search-composing #search-input::placeholder,
  .dark .search-display-container.search-composing #search-input::placeholder {
    color: var(--discover-popover-text-muted-dark, #a8a29e) !important;
  }
}

/* Autocomplete header styling */
.autocomplete-header {
  padding: 8px 12px 4px 12px; /* More compact header */
}

.autocomplete-title {
  font-size: 12px; /* Smaller title */
  font-weight: 600;
  color: var(--discover-popover-text, #292524);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px; /* Tighter gap */
}

.dark .autocomplete-title {
  color: var(--discover-popover-text-dark, #f5f5f4);
}

.autocomplete-subtitle {
  font-size: 11px; /* Smaller subtitle */
  color: var(--discover-popover-text-muted, #78716c);
  margin: 2px 0 0 0; /* Less margin */
}

.dark .autocomplete-subtitle {
  color: var(--discover-popover-text-muted-dark, #a8a29e);
}

/* AUTOCOMPLETE SUGGESTIONS STYLING */

/* Autocomplete suggestions container - unified styling */
.autocomplete-suggestions {
  padding: 4px 0;
  background: transparent; /* Let parent dropdown background show through */
  overflow-y: auto !important; /* Allow scrolling to access "show more" button */
  overflow-x: hidden !important; /* Prevent horizontal scrollbar */
}

/* Back button styles - Smaller and positioned to the left */
.autocomplete-back-button {
  position: static !important; /* Ensure it stays in flex flow */
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 20px !important; /* Smaller compact width */
  height: 20px !important; /* Smaller compact height */
  min-width: 20px !important; /* Prevent shrinking */
  max-width: 20px !important; /* Prevent growing */
  margin: 0 !important; /* Remove all margins - use gap instead */
  padding: 3px; /* Tighter padding */
  background: var(--discover-popover-hover, rgba(245, 245, 244, 0.92));
  border: 0;
  border-radius: 3px; /* Smaller radius */
  color: var(--discover-popover-text-muted, #78716c);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0 !important; /* Never shrink */
  flex-grow: 0 !important; /* Never grow */
  flex-basis: auto !important; /* Let content determine size */
  box-sizing: border-box !important; /* Include padding/border in size */
  order: 1 !important; /* Ensure it comes first in flex order */
}

.autocomplete-back-button:hover {
  background: var(--discover-popover-active, rgba(231, 229, 228, 0.9));
  color: var(--discover-popover-text, #292524);
}

.autocomplete-back-button:active {
  background: var(--discover-popover-active, rgba(231, 229, 228, 0.9));
  transform: scale(0.95);
}

.autocomplete-back-button svg {
  width: 10px; /* Smaller icon */
  height: 10px; /* Smaller icon */
}

/* Dark mode styles for back button */
html.dark .autocomplete-back-button,
body.dark .autocomplete-back-button,
.dark .autocomplete-back-button {
  background: var(--discover-popover-hover-dark, rgba(64, 64, 64, 0.78)) !important;
  border-color: transparent !important;
  color: var(--discover-popover-text-muted-dark, #a8a29e) !important;
}

html.dark .autocomplete-back-button:hover,
body.dark .autocomplete-back-button:hover,
.dark .autocomplete-back-button:hover {
  background: var(--discover-popover-active-dark, rgba(82, 82, 82, 0.72)) !important;
  color: var(--discover-popover-text-dark, #f5f5f4) !important;
}

html.dark .autocomplete-back-button:active,
body.dark .autocomplete-back-button:active,
.dark .autocomplete-back-button:active {
  background: rgba(115, 115, 115, 0.78) !important;
}

/* Individual autocomplete items */
.autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 0;
  transition: background-color 0.15s ease;
  overflow: visible;
  word-wrap: break-word;
  min-height: 32px;
}

.autocomplete-item:hover {
  background-color: var(--discover-popover-hover, rgba(245, 245, 244, 0.92));
}

.autocomplete-item:active {
  background-color: var(--discover-popover-active, rgba(231, 229, 228, 0.9));
}

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

html.dark .autocomplete-item,
body.dark .autocomplete-item,
.dark .autocomplete-item {
  border-bottom-color: transparent !important;
}

html.dark .autocomplete-item:hover,
body.dark .autocomplete-item:hover,
.dark .autocomplete-item:hover {
  background-color: var(--discover-popover-hover-dark, rgba(64, 64, 64, 0.78)) !important;
}

html.dark .autocomplete-item:active,
body.dark .autocomplete-item:active,
.dark .autocomplete-item:active {
  background-color: var(--discover-popover-active-dark, rgba(82, 82, 82, 0.72)) !important;
}

/* Item main content */
.item-main {
  display: flex;
  flex-direction: column;
  gap: 2px; /* Tighter gap */
  width: 100%;
  overflow: hidden;
}

/* Item header with icon and name */
.item-header {
  display: flex;
  align-items: flex-start;
  gap: 6px; /* Tighter gap */
  width: 100%;
}

/* Location/type icons */
.location-icon,
.type-icon {
  flex-shrink: 0;
  font-size: 12px; /* Smaller icon */
  margin-top: 1px;
}

/* Location/suggestion names - allow 2 lines */
.location-name,
.suggestion-name {
  flex: 1;
  font-weight: 500;
  color: var(--discover-popover-text, #292524);
  font-size: 13px; /* Smaller text */
  line-height: 1.3; /* Tighter line height */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  line-clamp: 2; /* Standard property for compatibility */
  -webkit-box-orient: vertical;
  word-break: break-word;
  hyphens: auto;
}

html.dark .location-name,
html.dark .suggestion-name,
body.dark .location-name,
body.dark .suggestion-name,
.dark .location-name,
.dark .suggestion-name {
  color: var(--discover-popover-text-dark, #f5f5f4) !important;
}

/* Item details */
.item-details {
  margin-left: 18px; /* Align with text, accounting for smaller icon */
  margin-top: 1px; /* Tighter gap */
  overflow: hidden;
  /* Allow details to wrap naturally */
  white-space: normal;
  word-break: break-word;
}

/* Secondary text (descriptions) */
.location-description,
.suggestion-secondary {
  color: var(--discover-popover-text-muted, #78716c);
  font-size: 11px; /* Smaller text */
  line-height: 1.25; /* Tighter line height */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Allow secondary text to wrap to 2 lines */
  line-clamp: 2; /* Standard property for compatibility */
  -webkit-box-orient: vertical;
  word-break: break-word;
}

html.dark .location-description,
html.dark .suggestion-secondary,
body.dark .location-description,
body.dark .suggestion-secondary,
.dark .location-description,
.dark .suggestion-secondary {
  color: var(--discover-popover-text-muted-dark, #a8a29e) !important;
}

/* NOTE: Dark mode contrast styles consolidated in dark-mode.css */

/* ======================== DATETIME DISPLAY CONTAINER WIDTH FIX ======================== */
/* Remove restrictive width constraints that cut off datetime content */

/* CRITICAL: Ensure parent flex container allows overflow and doesn't clip */
/* Main left flex container - prevent horizontal overflow but allow vertical expansion */
.discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0,
.discover-top-bar .flex.items-center.gap-2.sm\:gap-4.lg\:gap-6.flex-1.min-w-0,
html body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0,
body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0 {
  overflow-x: hidden !important; /* Prevent horizontal overflow */
  overflow-y: visible !important; /* CRITICAL: Allow vertical expansion for content - prevent scrollbar */
  overflow: visible !important; /* CRITICAL: Override any conflicting overflow rules */
  clip-path: none !important; /* Remove any clipping */
  contain: none !important; /* Allow content to overflow vertically */
  max-width: 100% !important; /* Ensure container doesn't exceed viewport */
  max-height: none !important; /* Allow vertical expansion */
  height: auto !important; /* CRITICAL: Ensure flexible height */
  /* CRITICAL: Hide scrollbar if it somehow appears */
  scrollbar-width: none !important; /* Firefox */
}

/* CRITICAL: Hide scrollbar if it somehow appears (webkit) */
.discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0::-webkit-scrollbar,
.discover-top-bar .flex.items-center.gap-2.sm\:gap-4.lg\:gap-6.flex-1.min-w-0::-webkit-scrollbar,
html body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0::-webkit-scrollbar,
body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Other flex containers - allow overflow for dropdowns and content expansion */
.discover-top-bar .flex.items-center,
.discover-top-bar .flex.items-center.gap-2,
.discover-top-bar .flex.items-center.gap-2.sm\:gap-4,
.discover-top-bar .flex.items-center.gap-2.sm\:gap-4.lg\:gap-6,
.discover-top-bar .flex.items-center.flex-1.min-w-0 {
  overflow: visible !important; /* CRITICAL: Allow children to overflow */
  overflow-x: visible !important;
  overflow-y: visible !important; /* CRITICAL: Allow vertical expansion for content */
  clip-path: none !important; /* Remove any clipping */
  contain: none !important; /* Allow content to overflow */
  max-height: none !important; /* Allow vertical expansion */
  height: auto !important; /* CRITICAL: Ensure flexible height */
  align-items: flex-start !important; /* CRITICAL: Override items-center to allow expansion */
}

/* Override max-width constraint on inner flex container (was 230px) */
.datetime-display-container .relative.flex.items-center {
  max-width: none !important; /* Remove 230px constraint */
  width: 100% !important; /* Allow full width */
  overflow-x: hidden !important; /* Prevent horizontal overflow */
  overflow-y: visible !important; /* CRITICAL: Allow vertical expansion to prevent scrollbar */
  max-height: none !important; /* Allow vertical expansion */
  height: auto !important; /* Flexible height */
  position: relative !important;
  left: 0 !important; /* Ensure it's not positioned off-screen */
  transform: none !important; /* Remove any transforms */
}

/* Ensure parent datetime-field-container can grow */
.datetime-field-container,
.datetime-field-container.flex.flex-col.gap-0.min-w-0.flex-1 {
  max-width: none !important; /* Remove restrictive max-widths */
  min-width: auto !important;
  width: auto !important;
  flex: 1 1 auto !important;
  flex-grow: 1 !important; /* Allow growing */
  overflow: visible !important; /* Allow content to overflow */
  position: relative !important;
  transform: none !important; /* Remove any transforms that might move it off-screen */
  left: auto !important; /* Reset positioning */
  margin-left: 0 !important; /* Remove negative margins */
}

/* Override Tailwind max-width classes */
.datetime-field-container.max-w-\[140px\],
.datetime-field-container.max-w-\[180px\],
.datetime-field-container.max-w-\[220px\],
.datetime-field-container.max-w-sm,
.datetime-field-container.max-w-md {
  max-width: none !important;
}

/* Ensure flex-1 container can grow to accommodate text */
.datetime-display-container .flex-1.min-w-0 {
  max-width: 100% !important;
  flex-grow: 1 !important;
  flex-shrink: 1 !important;
  overflow: hidden !important;
  width: auto !important;
}

/* Ensure datetime display value truncates inside its shared toolbar column */
.datetime-display-container #datetime-display-value,
#datetime-display-value {
  max-width: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex-shrink: 1 !important;
}

/* Override truncate class */
.datetime-display-container #datetime-display-value.truncate,
#datetime-display-value.truncate {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
  width: 100% !important;
}

/* Tablet toolbar reset: shared topbar layout owns widths; keep text constrained to its trigger. */
@media (min-width: 768px) and (max-width: 1100px) {
  .discover-top-bar .flex.items-center.gap-2,
  .discover-top-bar .flex.items-center.gap-2.sm\:gap-4,
  .discover-top-bar .flex.items-center.gap-2.sm\:gap-4.lg\:gap-6,
  .discover-top-bar .flex.items-center.flex-1.min-w-0,
  .discover-top-bar .flex.items-center.gap-2.sm\:gap-4.lg\:gap-6.flex-1.min-w-0,
  html body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0,
  body.discover-page .discover-top-bar .flex.items-center.gap-2.flex-1.min-w-0 {
    overflow: visible !important;
    clip-path: none !important; /* Remove any clipping */
    contain: none !important; /* Allow content to overflow */
    max-height: none !important;
  }

  .datetime-display-container,
  .datetime-field-container,
  html body.discover-page .discover-top-bar .datetime-display-container,
  html body.discover-page .discover-top-bar .datetime-field-container,
  body.discover-page .discover-top-bar .datetime-display-container,
  body.discover-page .discover-top-bar .datetime-field-container,
  .discover-top-bar .datetime-display-container,
  .discover-top-bar .datetime-field-container {
    max-width: 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    flex-shrink: 1 !important;
    flex-grow: initial !important;
    overflow: hidden !important;
    position: relative !important;
    margin-left: 0 !important;
    left: auto !important;
  }

  .datetime-display-container .relative.flex.items-center,
  .datetime-display-container > div.relative.flex.items-center {
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    position: relative !important;
    left: 0 !important;
    transform: none !important;
  }

  .datetime-display-container .flex-1.min-w-0,
  .datetime-display-container .flex-1 {
    max-width: 100% !important;
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
    overflow: hidden !important;
    width: auto !important;
    min-width: 0 !important;
    position: relative !important;
  }

  .datetime-display-container #datetime-display-value,
  #datetime-display-value,
  html body.discover-page #datetime-display-value,
  body.discover-page #datetime-display-value {
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    flex-shrink: 1 !important;
    position: relative !important;
    left: 0 !important;
  }

  .datetime-display-container .text-xs.font-medium.text-gray-500,
  .datetime-display-container .text-xs.font-medium.uppercase {
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    position: relative !important;
    left: 0 !important;
  }
}

/* ========================================
 * WELCOME HEADER SECTION STYLING
 * ========================================
 * Modern, engaging welcome section for non-authenticated users
 * ======================================== */

.welcome-header-section {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  position: relative;
  overflow: hidden;
}

.dark .welcome-header-section {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  border-bottom-color: #334155 !important;
}

/* Subtle animated background pattern */
.welcome-header-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(120, 113, 108, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(68, 64, 60, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.dark .welcome-header-section::before {
  background:
    radial-gradient(circle at 20% 50%, rgba(168, 162, 158, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(120, 113, 108, 0.1) 0%, transparent 50%);
}

/* Icon wrapper with animation */
.welcome-icon-wrapper {
  position: relative;
  animation: welcomeIconPulse 2s ease-in-out infinite;
  transition: transform var(--transition-slow, 0.3s ease);
}

.welcome-icon-wrapper:hover {
  transform: scale(1.1);
}

@keyframes welcomeIconPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(28, 25, 23, 0.16);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(28, 25, 23, 0.22);
  }
}

.dark .welcome-icon-wrapper {
  animation: welcomeIconPulseDark 2s ease-in-out infinite;
}

@keyframes welcomeIconPulseDark {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.46);
  }
}

/* Typography enhancements */
.welcome-header-section p:first-child {
  font-size: 0.9375rem !important; /* 15px */
  font-weight: 700 !important;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.375rem !important;
}

.dark .welcome-header-section p:first-child {
  background: linear-gradient(135deg, #f5f5f4 0%, #a8a29e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-header-section p:last-child {
  font-size: 0.8125rem !important; /* 13px */
  line-height: 1.5 !important;
  color: var(--discover-premium-muted) !important;
  width: 100% !important;
  max-width: 100% !important;
}

.dark .welcome-header-section p:last-child {
  color: var(--discover-premium-muted) !important;
}

/* Ensure text container takes full width */
.welcome-header-section .flex-1 {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 100% !important;
}

/* Responsive adjustments */

@media (min-width: 1101px) {
.discover-top-bar {
    overflow-x: visible !important; /* Allow right edge content (hamburger menu) to be visible */
    overflow-y: visible !important; /* Allow vertical expansion for content */
    contain: none !important;
  }

  .discover-top-bar .flex.items-center.justify-between.w-full {
    overflow-x: visible !important; /* Allow right edge content (hamburger menu) to be visible */
    overflow-y: visible !important; /* Allow vertical expansion for content */
    height: auto !important; /* CRITICAL: Allow parent to expand */
    max-height: none !important; /* Remove height constraints */
  }

  .discover-top-bar .flex,
  .discover-top-bar .max-w-md {
    overflow: visible !important;
    contain: none !important;
  }

.discover-page {
    /* Search/top-bar container tokens (scoped; design-tokens.css owns global discover palette) */
    --topbar-height: 4rem;
    --container-height: 3rem;
    --container-padding-x: 1rem;
    --container-padding-y: 0.75rem;
    --container-gap: 0.75rem;

    /* Unified border radius system */
    --container-radius: 0.75rem;
    --container-radius-sm: 0.5rem;

    /* Unified shadow system */
    --container-shadow: 0 1px 3px #0000001a;
    --container-shadow-hover: 0 4px 12px #00000026;
    --container-shadow-focus: var(--discover-premium-focus);

    /* Unified typography system */
    --text-size-sm: 0.875rem;
    --text-size-xs: 0.75rem;
    --text-weight-medium: 500;
    --text-weight-semibold: 600;
    --line-height-tight: 1.25;

    /* Unified color system (--text-* scoped under .discover-top-bar below; do not override global tokens on .discover-page) */
    --border-color: #e5e7eb;
    --border-color-hover: #d1d5db;
    --bg-container: var(--discover-surface-card, var(--color-slate-50));
    --bg-container-hover: var(--discover-premium-hover);

    /* Dark mode colors */
    --dark-text-primary: var(--discover-premium-ink);
    --dark-text-secondary: #d1d5db;
    --dark-text-muted: #9ca3af;
    --dark-border-color: #374151;
    --dark-border-color-hover: #4b5563;
    --dark-bg-container: var(--discover-premium-surface-solid);
    --dark-bg-container-hover: var(--discover-premium-hover);
  }

  /* Top bar search/datetime: local text tokens only (avoid overriding global --text-* on the whole discover page) */
  .discover-page .discover-top-bar {
    --text-primary: var(--discover-premium-ink);
    --text-secondary: var(--discover-premium-ink-soft);
    --text-muted: var(--discover-premium-muted);
  }

  /* UNIFIED CONTAINER STYLING - Apply to all top bar containers */
  .discover-top-bar .search-display-container,
  .discover-top-bar .datetime-display-container {
    /* Unified dimensions */
    min-height: var(--container-height) !important;
    height: auto !important;
    max-height: none !important;

    /* Unified borders and radius */
    border: 1px solid var(--border-color) !important;
    border-radius: var(--container-radius) !important;

    /* Unified shadows */
    box-shadow: var(--container-shadow) !important;

    /* Unified background */
    background-color: var(--bg-container) !important;

    /* Unified transitions */
    transition: opacity var(--transition-base, 0.2s ease), transform var(--transition-base, 0.2s ease), background-color var(--transition-base, 0.2s ease) !important;

    /* Unified layout */
    display: flex !important;
    align-items: center !important;
    gap: var(--container-gap) !important;
  }

  /* UNIFIED HOVER STATES */
  .discover-top-bar .search-display-container:hover,
  .discover-top-bar .datetime-display-container:hover {
    border-color: var(--border-color-hover) !important;
    box-shadow: var(--container-shadow-hover) !important;
    background-color: var(--bg-container-hover) !important;
    transform: translateY(-1px) !important;
  }

  /* UNIFIED FOCUS STATES */
  .discover-top-bar .search-display-container:focus-within,
  .discover-top-bar .datetime-display-container:focus-within {
    border-color: var(--discover-chrome-border-strong) !important;
    box-shadow: var(--container-shadow-focus) !important;
  }

  /* UNIFIED TYPOGRAPHY */
  .discover-top-bar .search-display-container .text-xs,
  .discover-top-bar .search-display-container .text-sm,
  .discover-top-bar .datetime-display-container .text-xs,
  .discover-top-bar .datetime-display-container .text-sm {
    font-size: var(--text-size-sm) !important;
    line-height: var(--line-height-tight) !important;
    font-weight: var(--text-weight-medium) !important;
    color: var(--text-primary) !important;
  }

  /* UNIFIED SECONDARY TEXT */
  .discover-top-bar .search-display-container .text-gray-500,
  .discover-top-bar .search-display-container .text-gray-600,
  .discover-top-bar .datetime-display-container .text-gray-500,
  .discover-top-bar .datetime-display-container .text-gray-600 {
    font-size: 0.8125rem !important; /* 13px - increased from 12px (0.75rem) */
    color: var(--text-secondary) !important;
    font-weight: var(--text-weight-medium) !important;
  }

  /* UNIFIED ICON STYLING */
  .discover-top-bar .search-display-container .w-6.h-6,
  .discover-top-bar .search-display-container .w-7.h-7,
  .discover-top-bar .search-display-container .w-8.h-8,
  .discover-top-bar .datetime-display-container .w-6.h-6,
  .discover-top-bar .datetime-display-container .w-7.h-7,
  .discover-top-bar .datetime-display-container .w-8.h-8,
  .discover-top-bar .datetime-display-container .w-10.h-10 {
    width: 2rem !important;
    height: 2rem !important;
    border-radius: var(--container-radius-sm) !important;
  }

  /* UNIFIED DARK MODE */
  .dark .discover-top-bar .search-display-container,
  .dark .discover-top-bar .datetime-display-container {
    border-color: var(--dark-border-color) !important;
    background-color: var(--dark-bg-container) !important;
  }

  .dark .discover-top-bar .search-display-container:hover,
  .dark .discover-top-bar .datetime-display-container:hover {
    border-color: var(--dark-border-color-hover) !important;
    background-color: var(--dark-bg-container-hover) !important;
  }

  .dark .discover-top-bar .search-display-container .text-xs,
  .dark .discover-top-bar .search-display-container .text-sm,
  .dark .discover-top-bar .datetime-display-container .text-xs,
  .dark .discover-top-bar .datetime-display-container .text-sm {
    color: var(--dark-text-primary) !important;
  }

  .dark .discover-top-bar .search-display-container .text-gray-500,
  .dark .discover-top-bar .search-display-container .text-gray-600,
  .dark .discover-top-bar .datetime-display-container .text-gray-500,
  .dark .discover-top-bar .datetime-display-container .text-gray-600 {
    color: var(--dark-text-secondary) !important;
  }

/* ULTRA HIGH SPECIFICITY: Center the text content container */
  html body .discover-top-bar .datetime-display-container .relative.flex.items-center .flex-1.min-w-0,
  html body .datetime-display-container .relative.flex.items-center .flex-1.min-w-0,
  html body.discover-page .datetime-display-container .flex-1.min-w-0,
  .discover-top-bar .datetime-display-container .flex-1.min-w-0,
  .datetime-display-container .flex-1.min-w-0,
  .datetime-display-container .flex-1 {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Center the label text */
  html body .datetime-display-container .datetime-label-text,
  html body.discover-page .datetime-display-container .datetime-label-text,
  .discover-top-bar .datetime-display-container .datetime-label-text,
  .datetime-display-container .datetime-label-text {
    text-align: center !important;
    width: 100% !important;
  }

  /* Center the datetime value */
  html body .datetime-display-container #datetime-display-value,
  html body.discover-page .datetime-display-container #datetime-display-value,
  .discover-top-bar .datetime-display-container #datetime-display-value,
  .datetime-display-container #datetime-display-value,
  #datetime-display-value {
    text-align: center !important;
    width: 100% !important;
  }
}

@media (max-width: 640px) {
  /* Compact discover pill: do not inherit global 44px touch-input sizing */
  html body.discover-page .discover-top-bar .search-display-container #search-input {
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  html body.discover-page .discover-top-bar .search-display-container.search-composing #search-input,
  .search-display-container.search-composing #search-input {
    font-size: 16px !important;
    line-height: 1.05rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html body.discover-page .discover-top-bar .search-display-container.search-composing #search-input::placeholder,
  .search-display-container.search-composing #search-input::placeholder {
    font-size: 16px !important;
    line-height: 1.05rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
  }

  .welcome-header-section {
    padding: 0.875rem 1rem !important;
  }

  .welcome-icon-wrapper {
    width: 2.5rem !important;
    height: 2.5rem !important;
  }

  .welcome-icon-wrapper svg {
    width: 1.125rem !important;
    height: 1.125rem !important;
  }

  .welcome-header-section p:first-child {
    font-size: 0.875rem !important; /* 14px */
  }

  .welcome-header-section p:last-child {
    font-size: 0.75rem !important; /* 12px */
  }
}
