/* ==========================================================================================
   Cobertura Móvil del Azuay — Estilos
   Hereda el lenguaje visual de la app OFDM: fuente Nunito, azul de marca, tarjetas
   redondeadas, paleta clara. Adaptado a una interfaz centrada en un mapa a pantalla
   completa con paneles flotantes.
   ========================================================================================== */
:root {
  --ink: #0B2540;
  --ink-soft: #1C3A58;
  --muted: #5B6B7E;
  --muted-2: #94A3B5;
  --line: #E4EAF0;
  --line-soft: #F0F4F8;
  --bg: #F6F9FC;
  --surface: #FFFFFF;
  --brand: #1E54E0;
  --brand-dk: #1642B4;
  --brand-tint: #EEF3FE;
  --green: #18A34B;
  --green-dk: #0F7A38;
  --amber: #E8B400;
  --warn: #E0492F;
  --warn-tint: #FDECEC;
  --claro: #E2231A;
  --movistar: #0066CC;
  --shadow-sm: 0 1px 3px rgba(10,37,64,.05);
  --shadow-md: 0 6px 24px rgba(10,37,64,.10);
  --shadow-lg: 0 20px 56px rgba(10,37,64,.18);
  --header-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }

/* === HEADER === */
.header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  box-shadow: var(--shadow-sm);
  position: relative; z-index: 20;
}
.header .marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand), #3B7BFF);
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 18px;
  box-shadow: var(--shadow-sm);
}
.header h1 { margin: 0; font-size: 17px; font-weight: 900; letter-spacing: -.01em; white-space: nowrap; }
.header .sub { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 1px; }
.header nav { display: flex; gap: 4px; }
.header nav a {
  padding: 9px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 800;
  color: var(--muted); transition: all .15s;
}
.header nav a:hover { background: var(--line-soft); color: var(--ink); }
.header nav a.activo { background: var(--brand-tint); color: var(--brand-dk); }

/* === LAYOUT MAPA === */
.mapa-wrap { position: relative; height: calc(100vh - var(--header-h)); width: 100%; overflow: hidden; }
#mapa { position: absolute; inset: 0; }

/* Paneles flotantes sobre el mapa */
.panel {
  position: absolute; z-index: 10;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.panel-cabecera {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: default;
}
.panel-cabecera h2 { margin: 0; font-size: 14px; font-weight: 900; color: var(--ink); }
.panel-cabecera .icono { color: var(--muted-2); }
.panel-cuerpo { padding: 12px 14px; }

/* Panel de capas (izquierda) */
#panel-capas { top: 14px; left: 14px; width: min(290px, calc(100vw - 28px)); max-height: calc(100vh - var(--header-h) - 28px); display: flex; flex-direction: column; }
#panel-capas .panel-cuerpo { overflow-y: auto; }

.op-grupo { margin-bottom: 14px; }
.op-titulo {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 900;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px;
}
.op-punto { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.op-punto.claro { background: var(--claro); }
.op-punto.movistar { background: var(--movistar); }

/* Switch de tecnología */
.tech-fila {
  display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px;
  transition: background .15s;
}
.tech-fila:hover { background: var(--line-soft); }
.tech-nombre { font-size: 13.5px; font-weight: 800; color: var(--ink-soft); flex: 1; }
.tech-badge { font-size: 10.5px; font-weight: 800; color: var(--muted); }

.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .pista {
  position: absolute; inset: 0; background: var(--line); border-radius: 999px;
  transition: .2s; cursor: pointer;
}
.switch .pista::before {
  content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .pista { background: var(--brand); }
.switch input:checked + .pista::before { transform: translateX(16px); }

/* Control de opacidad */
.opacidad-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.opacidad-row label { font-size: 11.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.opacidad-row input[type=range] { flex: 1; accent-color: var(--brand); }

/* Leyenda (abajo izquierda) */
#leyenda { bottom: 16px; left: 14px; width: min(230px, calc(100vw - 28px)); }
.leyenda-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); margin: 5px 0; }
.leyenda-swatch { width: 16px; height: 16px; border-radius: 4px; flex: none; border: 1px solid rgba(0,0,0,.08); }

/* Panel de resultado de punto (derecha) */
#panel-punto { top: 14px; right: 14px; width: min(308px, calc(100vw - 28px)); display: none; }
#panel-punto.visible { display: block; }
.reco {
  background: var(--brand-tint); border-radius: 10px; padding: 11px 12px; margin-bottom: 12px;
}
.reco .lbl { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.reco .op { font-size: 19px; font-weight: 900; color: var(--brand-dk); margin-top: 2px; }
.reco.sin { background: var(--warn-tint); }
.reco.sin .op { color: var(--warn); font-size: 16px; }

.tabla-punto { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tabla-punto th, .tabla-punto td { padding: 7px 6px; border-bottom: 1px solid var(--line-soft); text-align: center; }
.tabla-punto th { font-size: 10.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.tabla-punto td.op-celda { text-align: left; font-weight: 800; }
.celda-nivel { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #fff; }
.celda-no { color: var(--muted-2); font-weight: 800; }

/* Barra de herramientas (arriba centro) */
#toolbar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 11;
  display: flex; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; box-shadow: var(--shadow-md);
  max-width: calc(100vw - 20px); flex-wrap: wrap; justify-content: center;
}
.tool-btn {
  display: inline-flex; align-items: center; gap: 7px; border: none; background: none;
  font-family: inherit; font-size: 12.5px; font-weight: 800; color: var(--muted);
  padding: 8px 13px; border-radius: 9px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.tool-btn:hover { background: var(--line-soft); color: var(--ink); }
.tool-btn.activo { background: var(--brand); color: #fff; }
.tool-btn svg { width: 16px; height: 16px; }

/* === BOTONES (compartido con OFDM) === */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none;
  border-radius: 10px; padding: 10px 18px; font-family: inherit; font-size: 12.5px;
  font-weight: 800; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; transition: all .2s;
}
.boton-primario { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.boton-primario:hover { background: var(--brand-dk); box-shadow: var(--shadow-md); }
.boton-suave { background: var(--line-soft); color: var(--ink-soft); }
.boton-suave:hover { background: var(--line); }
.boton-bloque { width: 100%; }

/* Badges */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; }
.badge-azul { background: var(--brand-tint); color: var(--brand-dk); }

.muted { color: var(--muted); }
.nota-mini { font-size: 11.5px; font-weight: 700; color: var(--muted); line-height: 1.45; margin-top: 8px; }

/* Spinner */
.spinner { display:inline-block; width:15px; height:15px; border:2.5px solid rgba(30,84,224,.25); border-top-color: var(--brand); border-radius:50%; animation: girar .8s linear infinite; vertical-align: middle; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Etiqueta de swipe */
.swipe-label {
  position: absolute; top: 70px; z-index: 9; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 900; color: #fff; box-shadow: var(--shadow-md); display: none;
}
.swipe-label.visible { display: block; }
#swipe-izq { left: 18px; background: var(--claro); }
#swipe-der { right: 18px; background: var(--movistar); }

/* === PÁGINA /archivos === */
.doc {
  max-width: 1080px; margin: 0 auto; padding: 28px 22px 80px;
}
.doc h1 { font-size: 30px; font-weight: 900; letter-spacing: -.02em; margin: 8px 0 6px; }
.doc .lead { font-size: 16px; font-weight: 700; color: var(--muted); margin: 0 0 26px; line-height: 1.5; }
.doc h2 { font-size: 21px; font-weight: 900; margin: 34px 0 12px; padding-top: 10px; }
.doc h3 { font-size: 16px; font-weight: 800; color: var(--ink-soft); margin: 20px 0 8px; }
.doc p { font-size: 14.5px; font-weight: 600; line-height: 1.65; color: var(--ink-soft); margin: 0 0 12px; }
.doc strong { color: var(--ink); font-weight: 800; }
.doc code { background: var(--line-soft); border-radius: 5px; padding: 1px 6px; font-size: 13px; font-family: 'Cascadia Code', ui-monospace, monospace; color: var(--brand-dk); }

.tarjeta {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm); padding: 20px;
}
.tarjetas-grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat { text-align: center; padding: 16px 12px; }
.stat .valor { font-size: 30px; font-weight: 900; color: var(--brand-dk); line-height: 1; }
.stat .etq { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 7px; }

/* Diagrama de estructura de carpetas */
.arbol {
  background: #0B2540; color: #D7E3F4; border-radius: 12px; padding: 18px 20px;
  font-family: 'Cascadia Code', ui-monospace, monospace; font-size: 12.5px; font-weight: 500;
  line-height: 1.7; overflow-x: auto;
}
.arbol .dir { color: #6FA8FF; font-weight: 700; }
.arbol .c { color: #7FB98A; }
.arbol .m { color: #F2C36B; }
.arbol .note { color: #7E91A8; }

/* Pasos del pipeline */
.pasos { display: flex; flex-direction: column; gap: 12px; counter-reset: paso; }
.paso { display: flex; gap: 14px; align-items: flex-start; }
.paso::before {
  counter-increment: paso; content: counter(paso);
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand);
  color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 14px;
}
.paso .txt { padding-top: 3px; }
.paso .txt b { font-weight: 900; }

/* Explorador de datos */
.explorador-controles {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px;
}
.explorador-controles select, .explorador-controles input {
  border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 12px; font-family: inherit;
  font-size: 13.5px; font-weight: 700; color: var(--ink); background: var(--surface); outline: none;
}
.explorador-controles select:focus, .explorador-controles input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30,84,224,.12); }

.tabla-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.datos { width: 100%; border-collapse: collapse; font-size: 13px; }
table.datos th, table.datos td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
table.datos thead th {
  position: sticky; top: 0; background: var(--line-soft); font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .03em; color: var(--muted); z-index: 1;
}
table.datos tbody tr:hover { background: var(--brand-tint); }
table.datos td.num { text-align: right; font-variant-numeric: tabular-nums; }
.swatch-rgb { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 6px; border: 1px solid rgba(0,0,0,.1); }

/* Ranking */
.barra-pct { position: relative; background: var(--line-soft); border-radius: 6px; height: 18px; min-width: 90px; overflow: hidden; }
.barra-pct > span { position: absolute; inset: 0 auto 0 0; background: var(--green); border-radius: 6px; }
.barra-pct > em { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; color: var(--ink); }

/* === MODAL (ranking) === */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-fondo { position: absolute; inset: 0; background: rgba(10,37,64,.55); animation: fadeIn .2s; }
.modal-caja {
  position: relative; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(940px, 96vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  animation: subir .25s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-header h2 { margin: 0; font-size: 17px; font-weight: 900; color: var(--ink); }
.modal-body { padding: 18px 20px; overflow: auto; }

@media (max-width: 900px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; }
  #panel-capas { width: 250px; }
  #panel-punto { width: 250px; }
  .header h1 { font-size: 15px; }
}
