/* Mapa de plantas (va después de leaflet.css para poder sobrescribirlo). */
.plant-map { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
.map-canvas { height: 72vh; min-height: 380px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.map-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; min-height: 2rem; }
.map-toolbar .button.active { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.map-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.map-actions[hidden] { display: none; }
.map-side { max-height: 80vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .25rem .75rem .75rem; }
.map-side h3 { position: sticky; top: 0; background: var(--surface); padding: .5rem 0; margin: .5rem 0 0; }
.map-list { list-style: none; margin: 0; padding: 0; }
.map-item {
  display: grid; grid-template-columns: auto 1fr; column-gap: .5rem; width: 100%; text-align: left;
  border: none; border-radius: 6px; background: none; padding: .35rem .4rem; color: var(--text);
}
.map-item:hover { background: var(--surface-2); }
.map-item.selected { background: var(--accent-soft); outline: 2px solid var(--accent); }
.map-item small { color: var(--muted); grid-column: 2; }
.map-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .25rem; font-size: .85rem; }
.map-legend > span { display: inline-flex; align-items: center; gap: .35rem; }

/* Íconos de planta (Material Symbols de Google, Apache 2.0), según la forma que manda map_marker_shape. */
:is(.map-legend .dot, .map-item .dot, .plant-marker) { --icon: url("/assets/plant_icons/other-edce38d1.svg"); }
:is(.map-legend .dot, .map-item .dot, .plant-marker).tree { --icon: url("/assets/plant_icons/tree-8680c855.svg"); }
:is(.map-legend .dot, .map-item .dot, .plant-marker).pot { --icon: url("/assets/plant_icons/pot-590427c3.svg"); }
:is(.map-legend .dot, .map-item .dot, .plant-marker).shrub { --icon: url("/assets/plant_icons/shrub-8450d35d.svg"); }
:is(.map-legend .dot, .map-item .dot, .plant-marker).creeper { --icon: url("/assets/plant_icons/creeper-0a59e4b2.svg"); }
:is(.map-legend .dot, .map-item .dot, .plant-marker).herb { --icon: url("/assets/plant_icons/herb-f4da3e49.svg"); }
.plant-icon, :is(.map-legend, .map-item) .dot::after {
  display: block; background: #fff;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}

/* En la lista y la leyenda: círculo del color de la categoría con el ícono blanco. */
.map-legend .dot, .map-item .dot { position: relative; display: inline-block; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); }
:is(.map-legend, .map-item) .dot::after { content: ""; position: absolute; inset: 3px; }
.map-item .dot { margin-top: .1rem; box-shadow: 0 0 0 1px rgba(0,0,0,.25); grid-row: span 2; }

/* En el mapa: pin como los de Google Maps (gota con la punta en la posición de la planta). */
.plant-marker .pin {
  display: flex; align-items: center; justify-content: center; box-sizing: border-box;
  width: 28px; height: 28px; border: 2px solid #fff; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); box-shadow: -1px 1px 4px rgba(0,0,0,.5);
}
.plant-marker .plant-icon { width: 16px; height: 16px; transform: rotate(45deg); }
.plant-marker.tree .pin { width: 34px; height: 34px; }
.plant-marker.tree .plant-icon { width: 20px; height: 20px; }
.plant-popup { min-width: 140px; }
.plant-popup img { display: block; width: 160px; height: 120px; object-fit: cover; border-radius: 6px; margin-bottom: .35rem; }
.plant-popup .button { margin-top: .4rem; }
.leaflet-container { font: inherit; }

@media (max-width: 800px) {
  .plant-map { grid-template-columns: 1fr; }
  .map-canvas { height: 60vh; }
  .map-side { max-height: none; }
}

/* Rosa de los vientos (abajo a la izquierda). */
.map-compass { pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.map-compass svg { display: block; }
.map-compass .ring { fill: rgba(255,255,255,.25); stroke: #fff; stroke-width: 1.5; }
.map-compass .north { fill: #e03131; stroke: #fff; stroke-width: 1; }
.map-compass .south, .map-compass .side { fill: #fff; stroke: #333; stroke-width: .75; }
.map-compass text { fill: #fff; font: bold 10px system-ui, sans-serif; text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.7); stroke-width: 2.5px; }

/* Capa de luz solar. */
.sun-panel { margin-top: .5rem; padding: .75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: grid; gap: .6rem; }
.sun-panel[hidden] { display: none; }
.sun-controls { display: flex; flex-wrap: wrap; gap: .75rem 2rem; align-items: end; }
.sun-month { display: grid; gap: .2rem; flex: 1 1 260px; max-width: 460px; }
.sun-month input { width: 100%; accent-color: #f59f00; }
.sun-month-ticks { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); padding: 0 .2rem; }
.sun-size { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; font-size: .9rem; }
.sun-info { font-size: .9rem; }
.sun-draw { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .9rem; }
.sun-drawing { display: inline-flex; gap: .4rem; }
.sun-drawing[hidden] { display: none; }
.sun-warnings p { margin: 0 0 .25rem; font-size: .9rem; }
.sun-warnings ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.map-legend .swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.2); }
.swatch.sun-full { background: rgba(255, 212, 59, .7); }
.swatch.sun-partial { background: rgba(247, 103, 7, .7); }
.swatch.sun-shade { background: rgba(54, 79, 199, .8); }
.sun-ray-label span {
  display: inline-block; transform: translate(-50%, -50%); white-space: nowrap; font-size: .75rem; font-weight: 600;
  color: #fff; background: rgba(0,0,0,.55); padding: .1rem .35rem; border-radius: 4px;
}

/* Guía de sol y viento, debajo del mapa. */
.map-guide { margin-top: 2rem; }
.map-guide > p { max-width: 70ch; }
.map-guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; margin-bottom: 1rem; }
.map-guide-grid .card + .card { margin-top: 0; }
.map-guide .card h3 { margin-top: 0; }
.map-guide ul { padding-left: 1.1rem; margin: .25rem 0; }
.map-guide li + li { margin-top: .35rem; }
.sun-table { font-size: .85rem; }
.sun-table td, .sun-table th { padding: .3rem .5rem; white-space: nowrap; }
.sun-table tr.current td { background: var(--warn-soft); font-weight: 600; }
.guide-group summary { cursor: pointer; }
.guide-group p { margin: .5rem 0 .25rem; }
.map-guide .sun-months { margin-bottom: 1rem; }
.sun-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.sun-table-wrap .sun-table th { white-space: normal; }
.sun-table-wrap tr:last-child td { border-bottom: none; }

/* Lista de plantas oculta: el mapa ocupa todo el ancho. */
.plant-map.side-collapsed { grid-template-columns: 1fr; }
.map-side[hidden] { display: none; }
.map-compass svg { transition: transform .2s; }

/* Esquinas del lote en modo edición. */
.lot-corner span {
  display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 4px;
  background: #fff; color: #222; font-weight: 700; font-size: .85rem; border: 2px solid #f59f00; box-shadow: 0 1px 4px rgba(0,0,0,.6); cursor: move;
}
