/* ---------------------------------------------------------------------------
   RadioaficionadosClub.cl - Centro de Herramientas para Radioaficionados
   Archivo: /calculadora/css/style.css
   Autor: RadioaficionadosClub.cl / Rodrigo Reyes
   Descripción: layout con cabecera, menú lateral, calculadoras modulares y footer.
--------------------------------------------------------------------------- */
:root{
  --azul:#0b4b7c;
  --azul-oscuro:#07375d;
  --azul-medio:#0f639b;
  --azul-claro:#e7f3ff;
  --fondo:#eef3f8;
  --texto:#1f2937;
  --muted:#5b6b7d;
  --card:#ffffff;
  --suave:#edf7ff;
  --borde:#d6dee8;
  --ok:#e8f7ee;
  --warn:#fff7e6;
  --danger:#fff1f2;
  --shadow:0 12px 32px rgba(15,23,42,.10);
}
*{box-sizing:border-box}
html{font-size:16px;-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{margin:0;font-family:Arial,Helvetica,sans-serif;background:linear-gradient(180deg,#f6f9fc 0%,var(--fondo) 100%);color:var(--texto);line-height:1.5}
a{color:var(--azul)}
img,svg{max-width:100%}
.wrap{width:100%;max-width:1280px;margin:0 auto;padding:18px}
.site-header{background:linear-gradient(135deg,#07375d,#0b4b7c);color:#fff;box-shadow:0 8px 28px rgba(7,55,93,.22)}
.header-inner{display:flex;justify-content:space-between;align-items:center;gap:20px}
.brand{display:inline-block;color:#fff;font-size:24px;font-weight:800;text-decoration:none;letter-spacing:.2px}
.site-header p{margin:5px 0 0;color:#dbeafe}
.site-header nav{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.site-header nav a{color:#fff;text-decoration:none;background:rgba(255,255,255,.14);padding:9px 12px;border-radius:999px;font-weight:700;border:1px solid rgba(255,255,255,.14)}
.site-header nav a:hover{background:rgba(255,255,255,.22)}
.app-layout{display:grid;grid-template-columns:270px minmax(0,1fr);gap:24px;align-items:start}
.tool-sidebar{position:sticky;top:18px;background:linear-gradient(180deg,#102846,#0b1f38);border-radius:18px;padding:18px;color:#fff;box-shadow:0 12px 32px rgba(15,23,42,.14);border:1px solid rgba(255,255,255,.08)}
.tool-sidebar-title{font-size:1.25rem;font-weight:900;margin:0 0 14px;color:#fff;letter-spacing:.2px}
.tool-sidebar nav{display:flex;flex-direction:column;gap:8px}
.tool-link{display:flex;align-items:center;gap:10px;width:100%;min-height:46px;color:#dcecff;text-decoration:none;padding:12px 14px;border-radius:12px;background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.08);transition:.2s;font-weight:800;text-align:left;cursor:pointer;margin:0;box-shadow:none;font-size:15px;font-family:inherit}
.tool-link:hover,.tool-link.active{background:#1f6fbe;color:#fff;transform:translateX(2px)}
.tool-link-external{background:rgba(34,197,94,.18);border-color:rgba(34,197,94,.22)}
.tool-content{min-width:0}
.tool-panel{display:none}
.tool-panel.active{display:block;animation:fadeIn .18s ease-in-out}
@keyframes fadeIn{from{opacity:.3;transform:translateY(4px)}to{opacity:1;transform:none}}
.card{background:var(--card);border:1px solid rgba(214,222,232,.9);border-radius:18px;padding:22px;box-shadow:var(--shadow);margin:0 0 18px;overflow:hidden}
.hero{text-align:center;background:linear-gradient(180deg,#ffffff 0%,#f5faff 100%)}
.compact-hero{text-align:left}
.eyebrow{margin:0 0 5px;color:var(--azul-medio);font-weight:900;text-transform:uppercase;letter-spacing:.08em;font-size:.8rem}
h1,h2,h3{color:var(--azul);line-height:1.2}
h1{margin:0 0 10px;font-size:clamp(1.55rem,5vw,2.35rem)}
h2{margin-top:0;font-size:clamp(1.25rem,3vw,1.65rem)}
h3{font-size:1.08rem}.lead{color:var(--muted);margin-top:-4px}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.field{background:#f9fbfd;border:1px solid var(--borde);border-radius:14px;padding:14px;min-width:0}
label{display:block;font-weight:800;margin-bottom:6px;color:#172033}
input,select,button{width:100%;max-width:100%;padding:13px;border-radius:11px;border:1px solid #b8c4d3;font-size:16px;background:#fff;color:#111827}
input:focus,select:focus,button:focus{outline:3px solid rgba(11,75,124,.22);outline-offset:2px;border-color:var(--azul)}
.help{margin-top:8px;font-size:14px;line-height:1.45;color:var(--muted)}
.tip{margin-top:8px;padding:10px;border-radius:11px;background:var(--ok);font-size:14px;line-height:1.45;border:1px solid rgba(34,197,94,.15)}
.card > button, .tool-panel .card button:not(.tool-link){background:linear-gradient(135deg,var(--azul),#0f639b);color:#fff;border:none;font-weight:900;cursor:pointer;margin-top:16px;box-shadow:0 8px 18px rgba(11,75,124,.22)}
.card > button:hover, .tool-panel .card button:not(.tool-link):hover{background:linear-gradient(135deg,var(--azul-oscuro),var(--azul))}
.result{background:var(--suave);border-left:6px solid var(--azul);border-radius:14px;padding:16px;line-height:1.6;overflow-wrap:anywhere}
.result hr{border:none;border-top:1px solid #cbd5e1;margin:14px 0}
.badge{display:inline-block;background:#dbeafe;color:#0b4b7c;border-radius:999px;padding:5px 11px;font-size:13px;font-weight:800}.badge.ok{background:#dcfce7;color:#166534}.badge.warn{background:#fef3c7;color:#92400e}.badge.bad{background:#ffe4e6;color:#9f1239}
.info-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.info{border:1px solid var(--borde);background:#fbfdff;border-radius:14px;padding:15px;line-height:1.5;min-width:0}.info h3{margin-top:0}.notice{background:var(--warn);border:1px solid #fde6ae;border-radius:12px;padding:13px;line-height:1.5}
.site-footer{background:#0f172a;color:#e5e7eb;margin-top:25px}.site-footer h3{color:#fff;margin-top:0}.footer-grid{display:grid;grid-template-columns:2fr 1fr 1fr;gap:18px}.site-footer a{display:block;color:#dbeafe;text-decoration:none;margin:7px 0}.site-footer a:hover{text-decoration:underline}.copyright{text-align:center;border-top:1px solid rgba(255,255,255,.14);padding:14px;color:#cbd5e1}
@media(max-width:940px){.wrap{padding:14px}.header-inner{align-items:flex-start;flex-direction:column;text-align:left;gap:12px}.site-header nav{justify-content:flex-start;width:100%}.app-layout{grid-template-columns:1fr;gap:14px}.tool-sidebar{position:static}.tool-sidebar nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.grid{grid-template-columns:1fr}.footer-grid{grid-template-columns:1fr}}
@media(max-width:560px){.wrap{padding:10px}.site-header .wrap{padding:14px 10px}.brand{font-size:20px;line-height:1.15}.site-header p{font-size:14px}.site-header nav{display:grid;grid-template-columns:1fr;gap:8px}.site-header nav a{text-align:center;border-radius:12px;padding:11px 12px}.tool-sidebar{border-radius:14px;padding:14px}.tool-sidebar nav{grid-template-columns:1fr}.tool-link{padding:11px 12px}.card{padding:15px;border-radius:14px;margin:0 0 12px;box-shadow:0 8px 22px rgba(15,23,42,.08)}.field{padding:12px;border-radius:12px}input,select,button{font-size:16px;padding:13px 12px;border-radius:10px}.help,.tip{font-size:13.5px}.result{font-size:15px;padding:14px}.info-grid{grid-template-columns:1fr}}
@media(max-width:380px){.wrap{padding:8px}.card{padding:12px}h1{font-size:1.45rem}h2{font-size:1.18rem}.brand{font-size:18px}}

.calc-help{margin:2rem 0;padding:1.2rem;border:1px solid #d0d7de;border-radius:10px;background:#f8fafc}.btn-contacto{display:inline-block;padding:.7rem 1rem;background:#0d6efd;color:#fff;text-decoration:none;border-radius:8px}.btn-contacto:hover{opacity:.9}.calc-note{font-size:.9rem;color:#555}
/* ---------------------------------------------------------------------------
   Ajuste móvil 2026-07: mejora visual y táctil del selector de calculadoras.
   Evita que el usuario pulse una herramienta y parezca que la calculadora no cambió.
--------------------------------------------------------------------------- */
.tool-panel[hidden]{display:none!important}
.tool-link{touch-action:manipulation;-webkit-tap-highlight-color:rgba(31,111,190,.18)}
@media(max-width:940px){
  .tool-sidebar{top:auto}
  .tool-sidebar-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
  .tool-sidebar-title:after{content:"Toca una opción";font-size:.78rem;font-weight:800;color:#bfdbfe;background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.12);border-radius:999px;padding:4px 8px}
  .tool-link.active{box-shadow:inset 4px 0 0 #bfdbfe,0 8px 18px rgba(31,111,190,.20);transform:none}
  .tool-content{scroll-margin-top:12px}
  .tool-panel{scroll-margin-top:12px}
}
@media(max-width:560px){
  .tool-sidebar nav{grid-template-columns:1fr 1fr}
  .tool-link{min-height:48px;font-size:14px;line-height:1.2;justify-content:flex-start}
  .tool-link span{display:inline-block;overflow:hidden;text-overflow:ellipsis}
}
@media(max-width:420px){.tool-sidebar nav{grid-template-columns:1fr}}

/* ---------------------------------------------------------------------------
   Corrección móvil definitiva 2026-07: navegación por enlaces reales.
--------------------------------------------------------------------------- */
.tool-sidebar nav a.tool-link{display:flex;text-decoration:none}
.tool-panel{display:none}
.tool-panel.active{display:block}
.tool-panel[hidden]{display:none!important}
.tool-panel:target{display:block}
@media(max-width:940px){
  .tool-sidebar nav a.tool-link{cursor:pointer;user-select:none;-webkit-user-select:none}
}

/* ---------------------------------------------------------------------------
   Fórmulas educativas por calculadora - 2026-07
   Cada herramienta muestra su fórmula, ejemplo manual y recomendaciones.
--------------------------------------------------------------------------- */
.formula-card{
  background:linear-gradient(180deg,#ffffff 0%,#f8fbff 100%);
  border-left:6px solid var(--azul-medio);
}
.formula-card h2{margin-bottom:8px}
.formula-card p{margin:10px 0;color:#263244}
.formula-box{
  background:#0f172a;
  color:#e5efff;
  border-radius:14px;
  padding:14px 16px;
  margin:12px 0;
  overflow-x:auto;
  border:1px solid rgba(255,255,255,.08);
}
.formula-box code{
  color:#e5efff;
  font-family:Consolas,Monaco,'Courier New',monospace;
  font-size:.95rem;
  white-space:nowrap;
}
.formula-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
  margin:12px 0;
}
.formula-grid > div{
  background:#f9fbfd;
  border:1px solid var(--borde);
  border-radius:13px;
  padding:13px;
  min-width:0;
}
.formula-grid h3{margin:0 0 6px;font-size:1rem;color:var(--azul-oscuro)}
.formula-grid code,.formula-card p code{
  background:#eef6ff;
  border:1px solid #d7e9fb;
  border-radius:7px;
  padding:2px 5px;
  color:#0b4b7c;
  font-family:Consolas,Monaco,'Courier New',monospace;
  font-size:.94em;
}
@media(max-width:700px){
  .formula-grid{grid-template-columns:1fr}
  .formula-box{padding:12px;font-size:.92rem}
  .formula-box code{white-space:normal;word-break:break-word}
}


/* Footer legal unificado RadioaficionadosClub.cl */
.unified-footer{margin-top:28px;background:#0f172a;color:#e5e7eb;border-top:1px solid rgba(255,255,255,.14)}
.unified-footer-inner{display:flex;align-items:center;justify-content:space-between;gap:18px;padding-top:18px;padding-bottom:18px}
.unified-footer-copy{margin:0;font-weight:700;line-height:1.45}
.unified-footer-actions{display:flex;align-items:center;justify-content:flex-end;gap:14px;flex-wrap:wrap}
.footer-theme-toggle,.unified-footer-links button{font:inherit;color:#dbeafe;background:transparent;border:1px solid rgba(255,255,255,.18);border-radius:999px;padding:8px 12px;cursor:pointer}
.footer-theme-toggle{display:inline-flex;align-items:center;gap:7px}.footer-theme-toggle:hover,.unified-footer-links button:hover{background:rgba(255,255,255,.08)}
.unified-footer-links{display:flex;align-items:center;justify-content:flex-end;gap:8px 15px;flex-wrap:wrap}
.unified-footer-links a{display:inline;color:#dbeafe;margin:0;text-decoration:none}.unified-footer-links a:hover{text-decoration:underline}
body.calc-light-theme{background:#f1f5f9;color:#0f172a}body.calc-light-theme .site-header{background:#fff;color:#0f172a}body.calc-light-theme .card,body.calc-light-theme .tool-sidebar{background:#fff;color:#0f172a}
@media(max-width:760px){.unified-footer-inner{flex-direction:column;align-items:stretch;text-align:center}.unified-footer-actions{flex-direction:column;justify-content:center}.unified-footer-links{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px}.unified-footer-links a,.unified-footer-links button{display:flex;align-items:center;justify-content:center;min-height:42px;margin:0;padding:8px}.unified-footer-links a:last-child{grid-column:1/-1}.footer-theme-toggle{justify-content:center}}

/* ---------------------------------------------------------------------------
   Footer profesional de la Calculadora — 2026-07-16
   RadioaficionadosClub.cl / Rodrigo Reyes
   Unifica identidad, enlaces legales, controles y adaptación móvil.
--------------------------------------------------------------------------- */
.unified-footer{
  position:relative;
  margin-top:36px;
  overflow:hidden;
  background:
    radial-gradient(circle at 88% 0%,rgba(14,165,233,.16),transparent 34%),
    linear-gradient(135deg,#07172b 0%,#0b2747 58%,#0a3558 100%);
  color:#eaf4ff;
  border-top:0;
  box-shadow:0 -8px 28px rgba(7,23,43,.12);
}
.unified-footer-accent{
  height:4px;
  background:linear-gradient(90deg,#38bdf8,#2563eb 48%,#22c55e);
}
.unified-footer-inner{
  display:grid;
  grid-template-columns:minmax(280px,1fr) minmax(420px,1.45fr);
  align-items:center;
  gap:30px;
  padding-top:26px;
  padding-bottom:26px;
}
.unified-footer-brand{min-width:0}
.unified-footer-logo{
  display:inline-flex!important;
  align-items:center;
  gap:10px;
  margin:0 0 9px!important;
  color:#fff!important;
  font-size:1.08rem;
  font-weight:900;
  letter-spacing:.01em;
  text-decoration:none!important;
}
.unified-footer-logo:hover{color:#bae6fd!important}
.unified-footer-logo-icon{
  display:inline-grid;
  place-items:center;
  flex:0 0 38px;
  width:38px;
  height:38px;
  border-radius:50%;
  color:#fff;
  background:linear-gradient(145deg,#0ea5e9,#2563eb);
  border:1px solid rgba(255,255,255,.26);
  box-shadow:0 8px 20px rgba(14,165,233,.22);
}
.unified-footer-logo-icon svg{width:23px;height:23px;fill:currentColor}
.unified-footer-copy{
  margin:0;
  max-width:520px;
  color:#c8d8e9;
  font-size:.91rem;
  font-weight:600;
  line-height:1.55;
}
.unified-footer-controls{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:14px;
  min-width:0;
}
.footer-theme-toggle,
.unified-footer-links button{
  width:auto;
  max-width:none;
  min-height:40px;
  margin:0;
  padding:9px 14px;
  border:1px solid rgba(186,230,253,.28);
  border-radius:999px;
  background:rgba(255,255,255,.07);
  color:#eff8ff;
  font:700 .88rem/1.2 Arial,Helvetica,sans-serif;
  box-shadow:none;
  cursor:pointer;
  transition:background .2s ease,border-color .2s ease,transform .2s ease;
}
.footer-theme-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.footer-control-icon{display:inline-grid;place-items:center;line-height:1}
.footer-theme-toggle:hover,
.unified-footer-links button:hover{
  background:rgba(255,255,255,.14);
  border-color:rgba(186,230,253,.52);
  transform:translateY(-1px);
}
.footer-theme-toggle:focus-visible,
.unified-footer-links a:focus-visible,
.unified-footer-links button:focus-visible{
  outline:3px solid rgba(56,189,248,.48);
  outline-offset:3px;
}
.unified-footer-links{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px 18px;
  flex-wrap:wrap;
}
.unified-footer-links a{
  position:relative;
  display:inline-flex!important;
  align-items:center;
  min-height:38px;
  margin:0!important;
  color:#d8e9f8!important;
  font-size:.9rem;
  font-weight:700;
  text-decoration:none!important;
  white-space:nowrap;
}
.unified-footer-links a::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:4px;
  height:2px;
  border-radius:2px;
  background:#38bdf8;
  transform:scaleX(0);
  transform-origin:center;
  transition:transform .2s ease;
}
.unified-footer-links a:hover{color:#fff!important}
.unified-footer-links a:hover::after{transform:scaleX(1)}
body.calc-light-theme .unified-footer{
  background:
    radial-gradient(circle at 88% 0%,rgba(14,165,233,.11),transparent 34%),
    linear-gradient(135deg,#f8fbff 0%,#eaf4fc 100%);
  color:#0f2942;
  border-top:1px solid #c9deed;
}
body.calc-light-theme .unified-footer-logo{color:#0b3559!important}
body.calc-light-theme .unified-footer-logo:hover{color:#075985!important}
body.calc-light-theme .unified-footer-copy{color:#52697e}
body.calc-light-theme .footer-theme-toggle,
body.calc-light-theme .unified-footer-links button{
  color:#123b5d;
  background:#fff;
  border-color:#b9d2e5;
}
body.calc-light-theme .footer-theme-toggle:hover,
body.calc-light-theme .unified-footer-links button:hover{background:#e7f4fc;border-color:#7fb8dc}
body.calc-light-theme .unified-footer-links a{color:#17466b!important}
body.calc-light-theme .unified-footer-links a:hover{color:#082f49!important}

@media(max-width:940px){
  .unified-footer-inner{
    grid-template-columns:1fr;
    gap:20px;
    text-align:center;
  }
  .unified-footer-logo{justify-content:center}
  .unified-footer-copy{margin-inline:auto}
  .unified-footer-controls{align-items:center}
  .unified-footer-links{justify-content:center}
}
@media(max-width:620px){
  .unified-footer{margin-top:26px}
  .unified-footer-inner{padding:22px 14px 24px;gap:18px}
  .unified-footer-logo{font-size:1rem;line-height:1.25}
  .unified-footer-logo-icon{width:36px;height:36px;flex-basis:36px}
  .unified-footer-copy{font-size:.86rem;padding:0 4px}
  .unified-footer-controls{width:100%;gap:13px}
  .footer-theme-toggle{width:100%;max-width:280px;min-height:44px}
  .unified-footer-links{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px;
    width:100%;
  }
  .unified-footer-links a,
  .unified-footer-links button{
    display:flex!important;
    align-items:center;
    justify-content:center;
    width:100%;
    min-height:44px;
    padding:9px 8px;
    border:1px solid rgba(186,230,253,.20);
    border-radius:12px;
    background:rgba(255,255,255,.055);
    font-size:.84rem;
    white-space:normal;
    text-align:center;
  }
  .unified-footer-links a::after{display:none}
  .unified-footer-links a:last-child{grid-column:1/-1}
  body.calc-light-theme .unified-footer-links a{background:#fff;border-color:#c7ddeb}
}
@media(max-width:370px){
  .unified-footer-links{grid-template-columns:1fr}
  .unified-footer-links a:last-child{grid-column:auto}
}

/* Auditoría móvil v101 - 19-07-2026 */
html,body{max-width:100%;overflow-x:clip;-webkit-text-size-adjust:100%}
img,svg,canvas,iframe{max-width:100%}
.app-layout,.content,.card,.field,.tool-sidebar{min-width:0;max-width:100%}
.card :where(h1,h2,h3,p,li,a,.result){overflow-wrap:anywhere}
@media(max-width:620px){
  .tool-sidebar nav{display:flex!important;overflow-x:auto;gap:8px;padding-bottom:4px;scroll-snap-type:x proximity;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
  .tool-link{
    flex:0 0 clamp(132px,42vw,184px);
    width:auto;
    min-height:42px;
    padding:9px 11px;
    font-size:13.5px;
    line-height:1.15;
    scroll-snap-align:start;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    white-space:normal;
  }
  .grid,.info-grid{grid-template-columns:1fr!important}
  input,select,textarea,button{font-size:16px!important;min-height:44px;max-width:100%}
  button{touch-action:manipulation}
  .result{max-width:100%;overflow-x:auto}
  table{min-width:560px}
  .table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
}
@media(max-width:370px){
  .tool-link{flex-basis:136px;min-height:40px;padding:8px 10px;font-size:13px}
  .wrap{padding-left:7px!important;padding-right:7px!important}
}

/* ============================================================
   Corrección móvil v103 — menú de calculadoras compacto
   Fecha: 19-07-2026
   Corrige botones excesivamente altos causados por reglas móviles
   superpuestas. Estas reglas se ubican al final para tener prioridad.
   ============================================================ */
@media (max-width: 620px) {
  .tool-sidebar {
    padding: 14px !important;
  }

  .tool-sidebar nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    overflow: visible !important;
    padding: 0 !important;
    scroll-snap-type: none !important;
  }

  .tool-sidebar nav > a.tool-link {
    box-sizing: border-box !important;
    display: flex !important;
    flex: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    margin: 0 !important;
    padding: 8px 10px !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: flex-start !important;
    border-radius: 11px !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    overflow: hidden !important;
    transform: none !important;
  }

  .tool-sidebar nav > a.tool-link span {
    display: -webkit-box !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
  }

  .tool-sidebar nav > a.tool-link.active {
    box-shadow: inset 3px 0 0 #bfdbfe, 0 5px 12px rgba(31,111,190,.18) !important;
  }
}

@media (max-width: 350px) {
  .tool-sidebar nav {
    grid-template-columns: 1fr !important;
  }

  .tool-sidebar nav > a.tool-link {
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    font-size: 13px !important;
  }
}
