/* ==============================================================================
 * FILE: map-core.css
 * CATEGORY: MarlonWalksLA Website - Clean Master Stylesheet
 * ============================================================================== */

/* =========================================================
   1. DESKTOP POSTURE (Master Frame Height Constraints)
   ========================================================= */
.filter-bar, 
.filter-bar form,
.map-master-polaroid .filter-bar {
  display: flex !important;
  flex-direction: column !important;
  height: 520px !important;
  max-height: 520px !important;
  overflow: hidden !important;
}

#top-header-view {
  flex-shrink: 0 !important;
}

/* =========================================================
   2. REFLEXES (Strict Tab Visibility Control)
   ========================================================= */
#search-view.view-is-hidden,
#trip-view.view-is-hidden,
#passport-view.view-is-hidden,
#routes-view.view-is-hidden,
.view-is-hidden {
  display: none !important;
}

#search-view.view-is-active,
#trip-view.view-is-active,
#passport-view.view-is-active,
#routes-view.view-is-active,
.view-is-active {
  display: flex !important;
}

/* =========================================================
   3. CONNECTIVE TISSUE (Strict Full-Height Flex Chain)
   ========================================================= */
#search-view, 
#trip-view, 
#passport-view, 
#routes-view,
.search-view-wrapper, 
.trip-view-wrapper,
.itinerary-view-wrapper, 
.passport-view-wrapper, 
.routes-view-wrapper,
.itinerary-section {
  flex: 1 1 0% !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Master container inside views */
.itinerary-blocks-container {
  flex: 1 1 0% !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: 100% !important; 
  overflow: hidden !important; 
  margin: 0 !important;
  padding: 0 !important;
}

/* The White Shell Card */
.reusable-shell-card {
  flex: 1 1 0% !important; 
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important; 
  max-height: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
}

/* Fixed Shell Header */
.reusable-shell-card .route-block-header {
  flex: 0 0 auto !important;
}

/* Shell Body Container */
.reusable-shell-card .route-block-body {
  flex: 1 1 0% !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
  padding: 6px !important;
}

/* ONLY the list items feed is allowed to scroll */
.shell-items-feed,
.popular-spot-feed-list {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  margin-bottom: 4px !important;
}

/* Fixed Bottom Search Wrapper */
.manual-search-wrap,
.map-search-wrapper {
  flex: 0 0 auto !important;
  width: 100% !important;
}

/* =========================================================
   4. NAVIGATION LIMBS (4-Tab Scope Bar Styling)
   ========================================================= */
.scope-toggle-wrap {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 4px !important;
  background-color: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none !important;
}

.scope-toggle-wrap::-webkit-scrollbar,
.day-filter-bar::-webkit-scrollbar, 
.routes-slider-wrapper::-webkit-scrollbar {
  display: none !important;
}

.scope-toggle-btn {
  flex: 1 1 auto;
  white-space: nowrap;
  padding: 8px 10px !important;
  font-size: 11px;
  font-weight: 800;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.scope-toggle-btn:nth-child(1) { background-color: #f0f9ff !important; color: var(--ernesto-blue) !important; border-color: #bae6fd !important; }
.scope-toggle-btn:nth-child(2) { background-color: #fff7ed !important; color: var(--ernesto-orange) !important; border-color: #fed7aa !important; }
.scope-toggle-btn:nth-child(3) { background-color: #fdf2f8 !important; color: var(--ernesto-pink) !important; border-color: #fbcfe8 !important; }
.scope-toggle-btn:nth-child(4) { background-color: #ecfdf5 !important; color: var(--ernesto-green) !important; border-color: #a7f3d0 !important; }

.scope-toggle-btn:nth-child(1).is-active { background-color: var(--ernesto-blue) !important; color: #ffffff !important; border-color: var(--ernesto-blue) !important; }
.scope-toggle-btn:nth-child(2).is-active { background-color: var(--ernesto-orange) !important; color: #ffffff !important; border-color: var(--ernesto-orange) !important; }
.scope-toggle-btn:nth-child(3).is-active { background-color: var(--ernesto-pink) !important; color: #ffffff !important; border-color: var(--ernesto-pink) !important; }
.scope-toggle-btn:nth-child(4).is-active { background-color: var(--ernesto-green) !important; color: #ffffff !important; border-color: var(--ernesto-green) !important; }

.mobile-drag-handle {
  display: none !important;
}

/* =========================================================
   5. SENSORY RECEPTORS (Consolidated Search Input Styling)
   ========================================================= */
.map-search-wrapper,
.manual-search-wrap {
  position: relative !important;
  width: 100% !important;
  margin-bottom: 0;
}

.map-search-input,
.manual-search-wrap input.manual-spot-search,
.empty-slot-input {
  width: 100% !important;
  padding: 10px 14px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border: 1.5px solid #2563eb !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1) !important;
  outline: none !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
}

.map-search-input:focus,
.manual-search-wrap input.manual-spot-search:focus,
.empty-slot-input:focus {
  border-color: #1d4ed8 !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2) !important;
  background: #ffffff !important;
}

.map-search-input::placeholder,
.manual-search-wrap input.manual-spot-search::placeholder,
.empty-slot-input::placeholder {
  color: #64748b !important;
  font-weight: 600 !important;
}

/* =========================================================
   6. RECALL VISUALS (Upward Popping Search Suggestions Dropdown)
   ========================================================= */
.search-results-dropdown,
.manual-search-wrap .search-results-dropdown {
  position: absolute !important;
  bottom: calc(100% + 6px) !important;
  top: auto !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 10000 !important;
  background: #ffffff !important;
  border: 1.5px solid #2563eb !important;
  border-radius: 10px !important;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.15) !important;
  max-height: 180px !important;
  overflow-y: auto !important;
  padding: 4px 0 !important;
}

.search-result-item,
.manual-search-wrap .search-result-item {
  padding: 8px 12px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  transition: background 0.15s ease !important;
}

.search-result-item:last-child,
.manual-search-wrap .search-result-item:last-child {
  border-bottom: none !important;
}

.search-result-item:hover,
.manual-search-wrap .search-result-item:hover {
  background: #eff6ff !important;
}

/* =========================================================
   7. SKIN & BLEMISHES (Mapbox Markers & Popups)
   ========================================================= */
.custom-emoji-marker {
  width: 32px;
  height: 32px;
  border-radius: 50% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  border: 2px solid #ffffff;
  box-sizing: border-box;
}

.mapboxgl-popup { z-index: 1050 !important; }
.mapboxgl-popup-content { padding: 0 !important; background: transparent !important; box-shadow: none !important; width: 280px; }
.mapboxgl-popup-close-button {
  background: #1a202c !important;
  color: #ffffff !important;
  border-radius: 50% !important;
  width: 24px !important;
  height: 24px !important;
  font-size: 16px !important;
  top: -8px !important;
  right: -8px !important;
  z-index: 10 !important;
  border: 2px solid #ffffff !important;
}

/* =========================================================
   8. MOBILE STRICT STACKED LAYOUT (50/50 EQUAL SPLIT)
   ========================================================= */
@media (max-width: 820px) {
  html:has(#map), 
  body:has(#map) {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #222222 !important;
  }

  .hero-polaroid-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    width: 100vw !important;
    height: 100% !important; 
    max-width: 100vw !important;
    background: transparent !important;
  }

  .map-master-polaroid {
    position: fixed !important; 
    top: 48px !important;
    bottom: 0 !important; 
    left: 0 !important;
    right: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    width: 100vw !important;
    height: calc(100dvh - 48px) !important; 
    overflow: hidden !important;
    z-index: 10 !important;
    background: #ffffff !important;
  }

  /* TOP 50%: Map Box (+10% Height Increase) */
  .map-master-polaroid #map,
  .map-master-polaroid .map-container {
    position: relative !important; 
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100vw !important;
    height: 50% !important; 
    min-height: 50% !important;
    max-height: 50% !important;
    flex: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border-bottom: 2px solid #e2e8f0 !important;
    border-radius: 0 !important;
    z-index: 1 !important;
  }

  /* BOTTOM 50%: UI Container */
  .filter-bar,
  .map-master-polaroid .filter-bar {
    position: relative !important; 
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100vw !important;
    height: 50% !important; 
    min-height: 50% !important;
    max-height: 50% !important;
    flex: 1 !important;
    margin: 0 !important;
    padding: 6px 10px 6px 10px !important; 
    border-radius: 0 !important; 
    box-shadow: none !important; 
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    z-index: 2 !important;
  }

  .mobile-drag-handle {
    display: none !important;
  }

  .scope-toggle-wrap.tri-tab {
    position: relative !important;
    background: #ffffff !important;
    z-index: 20 !important;
    padding: 2px 0 !important;
    margin-top: 0 !important;
    flex-shrink: 0 !important;
  }

  .scope-toggle-wrap {
    padding: 2px !important;
    gap: 2px !important;
    border-radius: 6px !important;
  }

  .scope-toggle-btn {
    padding: 6px 4px !important; 
    font-size: 10px !important; 
    border-radius: 4px !important;
  }
}

/* =========================================================
   9. ROUTE ORGANS (Extracted Route UI Theme Styles)
   ========================================================= */
.route-view-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.route-view-desc {
  font-size: 12px;
  color: #334155;
  line-height: 1.5;
}
.route-highlight-box {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.route-highlight-title {
  font-weight: 800;
  font-size: 12px;
}
.route-highlight-list {
  font-size: 11px;
  margin-top: 2px;
}

.theme-blue { background: #eff6ff; border-color: #bfdbfe; }
.theme-blue .route-highlight-title { color: #1e40af; }
.theme-blue .route-highlight-list { color: #1e3a8a; }

.theme-yellow { background: #fefce8; border-color: #fef08a; }
.theme-yellow .route-highlight-title { color: #854d0e; }
.theme-yellow .route-highlight-list { color: #713f12; }

.theme-green { background: #f0fdf4; border-color: #bbf7d0; }
.theme-green .route-highlight-title { color: #166534; }
.theme-green .route-highlight-list { color: #14532d; }

.theme-purple { background: #faf5ff; border-color: #e9d5ff; }
.theme-purple .route-highlight-title { color: #6b21a8; }
.theme-purple .route-highlight-list { color: #581c87; }
