/* /visor_publico/style.css */

:root {
  --green: #2e7d32;
  --green-soft: #e8f3ea;
  --gray: #666;
  --muted: #8a8a8a;
  --card: #fff;
  --bg: #f5f7f9;
  --br: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100vh; 
  overflow: hidden; 
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial;
  background: var(--bg);
  color: #111;
  display: flex; flex-direction: column;
}

/* ---------------- HEADER ---------------- */
.hdr {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; padding: 10px 20px; background: #fff; border-bottom: 1px solid #e5e8ec;
  flex-shrink: 0;
}
.brand { display: flex; flex-direction: column; gap: 4px; }
.logo { height: 38px; }
h1 { margin: 0; font-size: 22px; font-weight: 800; color: #2a2a2a; }
.muted { color: var(--muted); font-size: 12px; }

/* CONTROLES */
.ctrls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
label { font-size: 11px; font-weight: 700; color: #333; display: flex; flex-direction: column; gap: 4px; }
select { height: 34px; padding: 0 8px; border: 1px solid #d7dbe0; border-radius: 8px; background: #fff; }
.btn { height: 34px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--green); color: #fff; cursor: pointer; margin-top: 17px; }
.btn:hover { filter: brightness(0.95); }

/* ÁRBOL */
.zona-container { display: flex; flex-direction: column; height: 110px; min-width: 200px; }
#buscarZona { border: 1px solid #bbb; padding: 4px; border-radius: 4px 4px 0 0; border-bottom: none; width: 100%; margin: 0; font-size: 12px; }
#treeZonas { height: 100%; overflow-y: auto; background: #fff; border: 1px solid #ccc; padding: 4px; font-size: 12px; border-radius: 0 0 6px 6px; }

/* ---------------- TARJETAS ---------------- */
.card {
  background: var(--card);
  border-radius: var(--br); padding: 15px;
  border: 1px solid #e6eaef; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  
  display: grid;
  grid-template-rows: auto minmax(0, 1fr); 
  height: 100%; overflow: hidden; 
}

.card:nth-of-type(1) /* Tarta */
{
    background: var(--green-soft);
    border: 1px solid #d0e6d5; 
}

.card h3 { 
  margin: 0 0 10px 0; color: #2a2a2a; font-size: 1rem; 
  align-self: start;
}

/* GRÁFICOS */
canvas {
  width: 100% !important; height: 100% !important;
  display: block;
}
.card:nth-of-type(1) canvas {
  width: auto !important; height: 95% !important;
  max-width: 100%;
  justify-self: center; align-self: center;
}

/* 🟢 TABLA - AJUSTES PARA SCROLL (SLIDER) */
.panel-scroll {
  background: var(--green-soft);
  padding: 10px;
  border-radius: 8px;
  
  /*Permitimos scroll vertical si la tabla es larga */
  overflow-y: auto; 
  overflow-x: hidden;
  
  height: 100%; width: 100%;
  display: flex; flex-direction: column;
}

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { border-bottom: 1px solid #e9edf2; padding: 6px 10px; text-align: left; font-size: 13px; }

/* Estilos DataTables dentro del panel */
.dataTables_wrapper { font-size: 12px; display: flex; flex-direction: column; width: 100%; }
.dataTables_filter { margin-bottom: 8px; position: sticky; top: 0; z-index: 20; background: var(--green-soft); padding-bottom: 5px; }
.dataTables_filter input { border: 1px solid #ccc; border-radius: 4px; padding: 4px 8px; outline: none; }

/* Cabecera pegajosa (Sticky) para que no se pierda al bajar */
table.dataTable thead th { 
    position: sticky; top: 0; 
    background-color: #fff !important; 
    border-bottom: 2px solid #2e7d32 !important; 
    color: #111; cursor: pointer; 
    z-index: 10; 
}

table.dataTable tbody tr { background-color: transparent !important; }
table.dataTable tbody tr:hover { background-color: rgba(46, 125, 50, 0.1) !important; }
table.dataTable td { border-bottom: 1px solid #e0e0e0; padding: 6px 10px; }

/* MAPA */
section[style*="map"] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.map, #map {
  width: 100%; height: 100%; 
  border-radius: 8px; border: 1px solid #e6eaef; overflow: hidden;
}
.zona-interactiva { cursor: pointer; }
.btn-map-reset:hover { background-color: #f0f0f0 !important; color: #000; }

/* MÓVIL */
@media (max-width: 900px) {
  body { overflow: auto; height: auto; }
  main { display: flex !important; flex-direction: column !important; height: auto !important; }
  .card { display: flex; flex-direction: column; height: 350px; }
}