/* ============================================================================
   UbicateBien.pe - High-Impact Light Mode Editorial Styles (v2.1)
   Theme: Slate / Warm Pearl with Royal Blue (#2563EB) & Emerald (#059669) accents
   ============================================================================ */

/* Zero Horizontal Overflow on Mobile Screens */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Custom Light Scrollbars */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 8px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Nav Tabs */
.nav-tab.active-tab {
  background-color: #0f172a;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}

/* Subtabs in Nominal Card */
.subtab-btn.active-subtab {
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

/* MapLibre Container Customizations */
.maplibregl-map {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

.maplibregl-ctrl-group {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.maplibregl-ctrl-group button {
  border-bottom: 1px solid #e2e8f0 !important;
}

.maplibregl-ctrl-group button:last-child {
  border-bottom: none !important;
}

.maplibregl-ctrl-icon {
  filter: none;
}

/* MapLibre Popups Light Editorial Theme */
.maplibregl-popup-content {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px !important;
  padding: 14px !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.04) !important;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif !important;
  font-size: 12px !important;
  max-width: 290px !important;
}

.maplibregl-popup-anchor-top .maplibregl-popup-tip {
  border-bottom-color: #ffffff !important;
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
  border-top-color: #ffffff !important;
}
.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: #ffffff !important;
}
.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: #ffffff !important;
}

.maplibregl-popup-close-button {
  color: #64748b !important;
  padding: 6px 10px !important;
  font-size: 16px !important;
}
.maplibregl-popup-close-button:hover {
  color: #0f172a !important;
  background: transparent !important;
}

/* Custom Marker Styling */
.marker-target {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  border: 3px solid #ffffff;
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.7), 0 0 32px rgba(37, 99, 235, 0.3);
  cursor: pointer;
  animation: pulse-ring-blue 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.marker-target.mode-business {
  background: #059669;
  box-shadow: 0 0 18px rgba(5, 150, 105, 0.7), 0 0 32px rgba(5, 150, 105, 0.3);
  animation: pulse-ring-green 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring-blue {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

@keyframes pulse-ring-green {
  0% {
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(5, 150, 105, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(5, 150, 105, 0);
  }
}

.marker-competitor {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.marker-competitor:hover {
  transform: scale(1.6);
  z-index: 30;
}

.marker-competitor.type-ruc20 {
  background: #059669;
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.8);
}
.marker-competitor.type-overture {
  background: #d97706;
  box-shadow: 0 0 8px rgba(217, 119, 6, 0.8);
}
.marker-competitor.type-municipal {
  background: #7c3aed;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.8);
}

.marker-anchor {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: #2563eb;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.8);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.marker-anchor:hover {
  transform: scale(1.6);
  z-index: 30;
}

.marker-public-work {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ea580c;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(234, 88, 12, 0.8);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.marker-public-work:hover {
  transform: scale(1.6);
  z-index: 30;
}

/* Convenience POI Marker (Mode: Housing) */
.marker-convenience {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #0284c7;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.8);
  cursor: pointer;
  transition: transform 0.2s ease;
}
.marker-convenience:hover {
  transform: scale(1.6);
  z-index: 30;
}

/* Address Autocomplete Suggestions Dropdown */
.address-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.address-suggestion-item:last-child {
  border-bottom: none;
}
.address-suggestion-item:hover,
.address-suggestion-item.is-selected {
  background-color: #f8fafc;
}

/* Radar Opportunity Interactive Buttons */
.radar-opportunity-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
}
.radar-opportunity-card:hover {
  background-color: #ecfdf5;
  border-color: #10b981;
  transform: translateX(3px);
}

.radar-saturated-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background-color: #f8fafc;
  border: 1px solid #fecdd3;
  cursor: pointer;
  transition: all 0.2s ease;
}
.radar-saturated-card:hover {
  background-color: #fff1f2;
  border-color: #f43f5e;
  transform: translateX(3px);
}

/* Card 3 Freemium Unlocked Class */
#card3-locked-layer.is-unlocked,
#security-locked-layer.is-unlocked {
  filter: none !important;
  pointer-events: auto !important;
  user-select: auto !important;
}

/* Keyhole Preview Rows */
.keyhole-blurred-rows {
  filter: blur(4.5px);
  pointer-events: none;
  user-select: none;
  opacity: 0.55;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.keyhole-blurred-rows.is-unlocked {
  filter: none !important;
  pointer-events: auto !important;
  user-select: auto !important;
  opacity: 1 !important;
}

/* ============================================================================
   Stage 15: Overlay Clipping Protection & Toast Components
   ============================================================================ */

#security-overlay,
#card3-overlay {
  box-sizing: border-box;
  overflow: hidden;
  word-break: break-word;
  max-width: 100%;
}

#security-overlay button,
#card3-overlay button {
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  max-width: 100%;
}

#ubi-toast-container {
  max-width: 380px;
}

/* ============================================================================
   Stage 15.1: Unlocked Locations Header Dropdown & Multi-Pass Selector
   ============================================================================ */

#unlocked-locations-dropdown {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transform-origin: top right;
}

#header-unlocked-locations-list > div:hover {
  background-color: #f1f5f9;
}

#associated-passes-list > div {
  transition: all 0.15s ease-in-out;
}

#exhausted-passes-alert {
  border-left-width: 4px;
}

/* ============================================================================
   Guided Control Bar & Dropdowns Overflow Protection
   ============================================================================ */

#select-preset-region,
#select-preset,
#select-category {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#preset-wrapper,
#step3-category-wrapper {
  flex-shrink: 0;
}

@media (max-width: 640px) {
  #preset-wrapper,
  #step3-category-wrapper {
    width: 100% !important;
    max-width: 100% !important;
  }

  #unlocked-locations-dropdown {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin-top: 0 !important;
    z-index: 9999 !important;
  }

  /* Micro-Nodos GIS en Móvil: Carto / Mapbox Studio precision */
  .marker-competitor {
    width: 10px !important;
    height: 10px !important;
    border: 1.5px solid #ffffff !important;
    opacity: 0.90 !important;
  }

  .marker-anchor {
    width: 13px !important;
    height: 13px !important;
    border-radius: 4px !important;
  }
}

/* ============================================================================
   Security Card Progressive 4-Level Risk Palette (Soft & Non-Alarmist)
   ============================================================================ */

.risk-badge-bajo {
  background-color: #ecfdf5 !important;
  color: #047857 !important;
  border: 1px solid #a7f3d0 !important;
}

.risk-score-bajo {
  color: #047857 !important;
}

.risk-badge-moderado {
  background-color: #fefce8 !important;
  color: #a16207 !important;
  border: 1px solid #fde047 !important;
}

.risk-score-moderado {
  color: #a16207 !important;
}

.risk-badge-alto {
  background-color: #fff7ed !important;
  color: #c2410c !important;
  border: 1px solid #fdba74 !important;
}

.risk-score-alto {
  color: #c2410c !important;
}

.risk-badge-critico {
  background-color: #fff1f2 !important;
  color: #9f1239 !important;
  border: 1px solid #fecdd3 !important;
}

.risk-score-critico {
  color: #be123c !important;
}
