/* Windy-inspired map composition, using Climalerta's existing brand tokens. */
.map-first { --map-glass: rgba(7,30,66,.94); --map-edge: rgba(255,255,255,.18); }
.map-first #appGrid { display: block; }
.map-first #shell { width: 100%; }
.map-first #shellTop { padding: 18px 24px; background: linear-gradient(180deg,rgba(7,30,66,.75),transparent); pointer-events: none; }
.map-first #shellTop > * { pointer-events: auto; }
.map-first #shellBrand { margin-left: 370px; }
.map-first #shellBrand b { font-size: 1.35rem; letter-spacing: -.7px; }
.map-first #shellBrand small { color: #fff; opacity: .8; font-size: .65rem; letter-spacing: .03em; }
#mapSearch { position: absolute; top: 20px; left: 24px; width: 336px; z-index: 65; color: #fff; filter: drop-shadow(0 8px 20px #0003); }
#mapSearch #worldPlaceForm { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0; margin: 0; background: #fff; border-radius: 12px; padding: 5px; }
#mapSearch label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#mapSearch input { width: 100%; min-width: 0; border: 0; background: #fff; color: var(--navy-deep); border-radius: 9px; min-height: 40px; padding: 8px 10px; font: inherit; font-size: .85rem; }
#mapSearch button[type=submit] { background: var(--navy); color: #fff; border: 0; border-radius: 8px; min-height: 40px; padding: 8px 12px; font-size: .78rem; }
#mapLocalSummary { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 14px; margin-top: 8px; color: #fff; background: var(--map-glass); border: 1px solid var(--map-edge); border-radius: 12px; cursor: pointer; }
.map-location-icon { color: var(--orange); font-size: 1.7rem; }
.map-local-copy { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
#mapSelectedPlace { font-family: var(--font-head); font-size: .92rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#mapLocalStatus { font-size: .7rem; line-height: 1.4; color: #c8d6e8; }
#mapSearchFeedback { background: var(--navy-deep); border-radius: 10px; max-height: min(45dvh,340px); overflow: auto; }
#mapSearchFeedback:has(#worldPlaceStatus:empty):has(#worldPlaceResults:empty) { display: none; }
#mapSearchFeedback[hidden] { display: none; }
#mapSearchFeedback #worldPlaceStatus { margin: 0; padding: 10px 12px; font-size: .75rem; }
#mapSearchFeedback #worldPlaceResults { display: grid; gap: 4px; padding: 0 8px 8px; }
#mapSearchFeedback .btn { text-align: left; white-space: normal; font-size: .8rem; }
.map-first #shellBars { top: 100px; left: auto; right: 24px; width: 174px; max-height: calc(100dvh - 300px); overflow: auto; padding: 0 3px 5px; scrollbar-width: thin; z-index: 30; }
.map-first #shellBars .layer-chips { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 7px; overflow: visible; mask-image: none; -webkit-mask-image: none; padding: 0; }
.map-first #shellBars .layer-chip { display: flex; flex-direction: row-reverse; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 44px; padding: 5px 7px 5px 12px; background: var(--map-glass); color: #fff; border: 1px solid var(--map-edge); border-radius: 28px; text-align: right; font-size: .73rem; box-shadow: 0 3px 12px #0003; }
.map-first #shellBars .layer-chip > span:last-child { flex: 1; }
.map-first #shellBars .layer-chip.active { background: var(--navy); border-color: var(--orange); }
.map-first #shellBars .swatch { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #ffffff18; color: #fff; font-size: 1.3rem; line-height: 1; }
.map-first #shellBars .active .swatch { background: var(--orange); }
.map-first #moreLayers { padding: 0; background: transparent; color: #fff; }
.map-first #moreLayers > summary { min-height: 44px; padding: 12px; text-align: right; border-radius: 24px; background: var(--map-glass); font-size: .75rem; border: 1px solid var(--map-edge); }
.map-first #moreLayers .layer-chips { margin-top: 7px; max-height: none; }
.map-first #shellActions { bottom: max(22px, env(safe-area-inset-bottom)); width: 430px; }
.map-first #primaryNav { padding: 5px; border: 1px solid var(--map-edge); border-radius: 18px; background: var(--map-glass); box-shadow: 0 8px 28px #0004; gap: 3px; }
.map-first #primaryNav .btn { background: transparent; border: 0; border-radius: 12px; color: #d8e3f2; min-height: 48px; }
.map-first #primaryNav .btn:hover, .map-first #primaryNav [aria-pressed=true] { background: #ffffff15; color: #fff; }
.map-first #primaryNav [data-primary-section=map][aria-pressed=true] { color: var(--orange); }
.map-first #shellCornerL { bottom: 24px; left: 24px; flex-direction: row; max-width: 300px; }
.map-first #shellCornerR { bottom: 112px; right: 24px; left: auto; max-width: 210px; flex-direction: column; align-items: flex-end; }
.map-first #shellCornerR #btnLocate { max-width: 210px; min-height: 44px; white-space: normal; }
.map-first #btnGuias, .map-first #btnCompartirApp { display: none; } /* Available in Prepare / More. */
.map-first #shellMap .leaflet-top.leaflet-left { top: auto; left: auto; right: 24px; bottom: 170px; }
.map-first .leaflet-control-zoom { margin: 0; border: 1px solid var(--map-edge); box-shadow: 0 3px 12px #0003; border-radius: 10px; overflow: hidden; }
.map-first .leaflet-control-zoom a { width: 38px; height: 38px; line-height: 38px; background: var(--map-glass); color: #fff; border-color: var(--map-edge); }
.map-first .leaflet-control-attribution { font-size: 9px; background: #071e42d9; color: #c8d6e8; }
.map-first .leaflet-control-attribution a { color: #c8d6e8; }
.map-first #shellOverlays { top: 170px; left: 24px; right: 220px; width: auto; padding: 0; max-width: 420px; }
.map-first .ac-tira { top: 170px !important; left: 24px; right: 220px; max-width: 420px; max-height: 160px; overflow: auto; }
#mapSourceDetails { position: absolute; left: 24px; bottom: 88px; z-index: 45; width: min(336px,calc(100% - 48px)); border: 1px solid var(--map-edge); border-radius: 10px; background: var(--map-glass); color: #fff; box-shadow: 0 4px 16px #0002; }
#mapSourceDetails > summary { display: flex; align-items: center; gap: 7px; padding: 11px 12px; cursor: pointer; font-size: .68rem; min-height: 40px; list-style: none; }
#mapSourceDetails > summary::-webkit-details-marker { display: none; }
.map-source-dot { width: 6px; height: 6px; background: #a6b8cc; border-radius: 50%; flex: 0 0 6px; }
#mapSourceDetails[data-state=unavailable] .map-source-dot { background: var(--amber); }
.map-source-health { margin-left: auto; color: #c8d6e8; font-size: .62rem; }
#mapSourceDetails #mapCoverage { position: static; max-width: none; border-radius: 0; background: transparent; margin: 0; padding: 0 12px 12px; font-size: .72rem; line-height: 1.55; pointer-events: auto; max-height: 30dvh; overflow: auto; }
.map-first #mapLeyenda { bottom: 78px; left: 24px; max-height: calc(100dvh - 250px); z-index: 70; }
.map-first #drawer { position: absolute; inset: 20px auto 20px 24px; z-index: 100; width: 370px; height: auto; border: 1px solid var(--map-edge); border-radius: 18px; background: var(--navy-deep); box-shadow: 0 16px 60px #0006; visibility: hidden; transform: translateX(-420px); transition: transform .22s, visibility .22s; }
.map-first.panel-abierto #drawer { transform: none; visibility: visible; }
.map-first #drawerBody { min-width: 0; padding-bottom: 30px; }
.map-first #drawerCerrar { min-width: 44px; min-height: 44px; }
.map-first #drawer #mapSearch { position: static; width: 100%; margin: 14px 0; filter: none; }
.map-first .map-incident { position: absolute !important; top: 170px !important; left: 24px !important; bottom: auto !important; margin: 0; width: 336px; max-height: calc(100dvh - 310px); transform: none !important; z-index: 75; }
.map-first .map-incident .leaflet-popup-content-wrapper { border: 1px solid var(--map-edge); background: var(--map-glass); color: #fff; border-radius: 16px; box-shadow: 0 8px 32px #0004; padding: 1px; }
.map-first .map-incident .leaflet-popup-content { width: auto !important; margin: 24px 20px 20px; max-height: calc(100dvh - 370px); overflow: auto; font: inherit; font-size: .8rem; line-height: 1.6; }
.map-first .map-incident .leaflet-popup-content a { color: #ffb68a; }
.map-first .map-incident .leaflet-popup-tip-container { display: none; }
.map-first .map-incident .leaflet-popup-close-button { width: 36px; height: 36px; color: #fff; font-size: 24px; line-height: 36px; }
.map-first :is(button,input,summary,a):focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
@media (max-width: 1100px) and (min-width: 880px) {
  .map-first #shellBrand small { display: none; }
  .map-first #shellTopRight #redCuenta #btnEntrar { font-size: 0; min-width: 44px; min-height: 44px; }
  .map-first #shellTopRight #redCuenta #btnEntrar::before { content: '♙'; font-size: 1.2rem; }
  .map-first #shellActions { width: 340px; left: auto; right: 24px; transform: none; }
}
@media (max-width: 879px) {
  .map-first #shellTop { padding: 10px 12px; min-height: 58px; }
  .map-first #shellBrand { margin-left: 0; gap: 7px; }
  .map-first #shellBrand b { font-size: 1.1rem; }
  .map-first #shellBrand small { display: none; }
  .map-first #shellTopRight #redCuenta #btnEntrar { font-size: 0; min-width: 44px; min-height: 44px; padding: 8px 12px; background: #fff; color: var(--navy); }
  .map-first #shellTopRight #redCuenta #btnEntrar::before { content: '♙'; font-size: 1.2rem; }
  #mapSearch { top: 70px; left: 12px; width: calc(100% - 24px); }
  #mapLocalSummary { padding: 10px 12px; margin-top: 6px; }
  #mapSelectedPlace { font-size: .83rem; }
  #mapLocalStatus { font-size: .66rem; }
  .map-first #shellBars { display: flex; top: 200px; right: 10px; width: 150px; max-height: calc(100dvh - 390px); }
  .map-first #shellBars .layer-chip { min-height: 42px; gap: 5px; font-size: .67rem; padding-left: 8px; }
  .map-first #shellBars .swatch { flex-basis: 28px; width: 28px; height: 28px; }
  .map-first #shellActions { width: calc(100% - 24px); bottom: max(18px, env(safe-area-inset-bottom)); }
  .map-first #shellCornerL { left: 12px; bottom: 142px; max-width: calc(100% - 100px); overflow: visible; }
  .map-first #shellCornerL .pill { min-height: 40px; padding: 8px 10px; font-size: .68rem; }
  .map-first #shellCornerR { left: auto; right: 12px; bottom: 142px; max-width: 52px; overflow: visible; }
  .map-first #shellCornerR #btnLocate { font-size: 0; min-width: 44px; width: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .map-first #shellCornerR #btnLocate::before { content: '⌖'; font-size: 1.5rem; }
  .map-first #shellMap .leaflet-top.leaflet-left { left: 12px; right: auto; bottom: 200px; }
  #mapSourceDetails { left: 12px; bottom: 88px; width: calc(100% - 24px); }
  #mapSourceDetails > summary { min-height: 40px; }
  .map-first #mapLeyenda { left: 12px; bottom: 190px; max-height: calc(100dvh - 270px); max-width: calc(100% - 24px); }
  .map-first #drawer { inset: auto 0 0; width: 100%; height: min(78dvh,780px); border-radius: 22px 22px 0 0; transform: translateY(105%); padding-bottom: env(safe-area-inset-bottom); }
  .map-first #drawerHead { padding: 8px 14px; }
  .map-first #drawerHead #primaryNav { border: 0; box-shadow: none; padding: 0; }
  .map-first #drawerHead #primaryNav .btn { min-height: 42px; }
  .map-first .map-incident { top: auto !important; bottom: 88px !important; left: 12px !important; width: calc(100% - 24px); max-height: 48dvh; }
  .map-first .map-incident .leaflet-popup-content { max-height: calc(48dvh - 50px); }
  .map-first #shellOverlays { display: flex; top: 200px; left: 12px; right: 174px; max-width: none; }
  .map-first .ac-tira { top: 200px !important; left: 12px; right: 174px; max-width: none; max-height: 130px; font-size: .68rem; }
}
@media (max-height: 520px) {
  .map-first #shellBrand { display: none; }
  .map-first #shellTop { justify-content: flex-end; }
  #mapSearch { top: 12px; width: 300px; }
  #mapLocalSummary { display: none; }
  .map-first #shellBars { display: flex; top: 74px; max-height: calc(100dvh - 170px); right: 12px; }
  .map-first #shellActions { width: 340px; left: 50%; bottom: 14px; }
  .map-first #shellCornerL { bottom: 84px; }
  .map-first #shellCornerR { bottom: 84px; }
  #mapSourceDetails { width: 300px; bottom: 138px; }
  .map-first #shellMap .leaflet-top.leaflet-left { bottom: 190px; }
  .map-first #drawer { height: 100dvh; }
  .map-first .map-incident { top: 74px !important; bottom: auto !important; width: 300px; max-height: calc(100dvh - 160px); }
  .map-first .map-incident .leaflet-popup-content { max-height: calc(100dvh - 210px); }
}
@media (prefers-reduced-motion: reduce) { .map-first #drawer { transition: none; } }
