/* ============================================================
   ANALIZADOR DEL INFORME NCEES (/fe-diagnostic-report/)
   Va encima de style.css y disciplina.css y usa sus tokens. Los cuatro
   niveles de la barra llevan siempre el mismo color en el formulario,
   en las etiquetas y en el resultado, para que se reconozcan de un
   vistazo: rojo muy por debajo, oro algo por debajo, verde en el promedio
   o algo por encima, azul petroleo muy por encima.
   ============================================================ */
:root {
    --az-muy: #b23a36;
    --az-muy-soft: #fbeceb;
    --az-poco: #8a5f0f;
    --az-poco-soft: #f8eed8;
    --az-bien: #187a4d;
    --az-bien-soft: #e4f5ec;
    --az-sobra: #12657a;
    --az-sobra-soft: #e0f0f4;
}

.az {
    background: var(--bg-panel); border: 1px solid var(--border); border-radius: 22px;
    padding: clamp(1.2rem, 3.5vw, 2.2rem); display: flex; flex-direction: column; gap: 1.2rem;
    box-shadow: 0 24px 50px -40px rgba(13, 33, 54, 0.6);
}
.az-paso {
    display: flex; align-items: center; gap: 0.7rem;
    font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em;
    font-size: clamp(1.15rem, 2.4vw, 1.45rem); color: var(--text-main); text-wrap: balance;
}
.az-paso > span:first-child {
    flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: var(--primary); color: #fff; font-size: 0.9rem;
}
.az-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- paso 1: disciplina --- */
.az-discs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.az-disc {
    font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer;
    color: var(--text-main); background: var(--panel-soft);
    border: 1px solid var(--border-strong); border-radius: 999px; padding: 0.55rem 1.1rem;
}
.az-disc:hover { border-color: var(--secondary); color: var(--secondary); }
.az-disc[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.az-vacio { font-size: 0.92rem; color: var(--text-muted); }

/* --- paso 2: el informe --- */
.az-form { display: flex; flex-direction: column; gap: 1rem; border-top: 1px solid var(--border); padding-top: 1.3rem; }
.az-ayuda { font-size: 0.94rem; line-height: 1.6; color: var(--text-muted); max-width: 72ch; }

.az-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; }
.az-fig { margin: 0; background: var(--panel-soft); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 0.8rem; }
.az-fig svg { display: block; width: 100%; height: auto; }
.az-fig figcaption { margin-top: 0.4rem; font-size: 0.78rem; line-height: 1.45; color: var(--text-muted); }
.az-fig-fondo { fill: #ffffff; stroke: var(--border-strong); }
.az-fig-media, .az-fig-tu { stroke: var(--text-main); }
.az-fig-txt { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.04em; fill: var(--text-muted); }
.az-fig-yo { fill: var(--text-main); }
.az-fig figcaption strong { color: var(--text-main); }
.az-fig:nth-child(1) .az-fig-hueco { fill: var(--az-muy); opacity: 0.55; }
.az-fig:nth-child(2) .az-fig-hueco { fill: var(--az-poco); opacity: 0.75; }
.az-fig:nth-child(3) .az-fig-hueco { fill: var(--az-bien); opacity: 0.6; }
.az-fig:nth-child(4) .az-fig-hueco { fill: var(--az-sobra); opacity: 0.6; }

.az-filas { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.az-fila {
    display: grid; grid-template-columns: minmax(0, 1fr) 84px 104px minmax(0, 430px);
    gap: 0.4rem 0.9rem; align-items: center; padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border); background: #fff;
}
.az-fila:nth-child(even) { background: var(--panel-soft); }
.az-fila:last-child { border-bottom: none; }
.az-fila.is-mal { background: var(--az-muy-soft); }
.az-area { display: flex; align-items: baseline; gap: 0.6rem; font-weight: 600; font-size: 0.92rem; color: var(--text-main); }
.az-n { flex: none; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); width: 1.4rem; }

.az-campo { display: flex; flex-direction: column; gap: 0.15rem; }
.az-campo span {
    font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-muted);
}
.az-campo input {
    width: 100%; font: inherit; font-size: 0.95rem; font-variant-numeric: tabular-nums;
    padding: 0.45rem 0.55rem; border: 1px solid var(--border-strong); border-radius: 8px;
    background: #fff; color: var(--text-main);
}
.az-campo input:focus { outline: 2px solid var(--secondary); outline-offset: 1px; border-color: var(--secondary); }

.az-barra { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.3rem; }
.az-op { position: relative; display: block; cursor: pointer; }
.az-op input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.az-op span {
    display: flex; align-items: center; justify-content: center; text-align: center; min-height: 2.4rem;
    font-size: 0.74rem; font-weight: 600; line-height: 1.2; padding: 0.3rem 0.35rem;
    border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text-muted); background: #fff;
}
.az-op input:focus-visible + span { outline: 2px solid var(--secondary); outline-offset: 1px; }
.az-op-muy input:checked + span { background: var(--az-muy-soft); border-color: var(--az-muy); color: var(--az-muy); }
.az-op-poco input:checked + span { background: var(--az-poco-soft); border-color: var(--az-poco); color: var(--az-poco); }
.az-op-bien input:checked + span { background: var(--az-bien-soft); border-color: var(--az-bien); color: var(--az-bien); }
.az-op-sobra input:checked + span { background: var(--az-sobra-soft); border-color: var(--az-sobra); color: var(--az-sobra); }

.az-error { grid-column: 1 / -1; font-size: 0.8rem; font-weight: 600; color: var(--az-muy); }
.az-aviso {
    font-size: 0.88rem; font-weight: 600; color: var(--az-poco);
    background: var(--az-poco-soft); border-radius: 10px; padding: 0.7rem 0.9rem;
}
.az-botones { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; }
.az-botones .dp-btn, .az-botones .dp-btn-ghost { font: inherit; font-weight: 700; font-size: 0.95rem; cursor: pointer; border: 0; }
.az-botones .dp-btn-ghost { border: 1px solid var(--border-strong); background: transparent; }
.az-link {
    font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--text-muted);
    background: none; border: 0; cursor: pointer; text-decoration: underline; padding: 0.4rem;
}

/* --- resultado --- */
.az-resultado { border-top: 1px solid var(--border); padding-top: 1.4rem; display: flex; flex-direction: column; gap: 1.1rem; }
.az-resultado h2 {
    font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em;
    font-size: clamp(1.25rem, 2.6vw, 1.7rem); color: var(--text-main); outline: none;
}
.az-cifras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
.az-cifra {
    border: 1px solid var(--border); border-radius: 14px; padding: 0.9rem 1rem; background: var(--panel-soft);
    display: flex; flex-direction: column; gap: 0.25rem;
}
.az-cifra strong {
    font-family: var(--font-display); font-weight: 800; font-size: 1.8rem;
    color: var(--text-main); font-variant-numeric: tabular-nums;
}
.az-cifra span { font-size: 0.82rem; line-height: 1.45; color: var(--text-muted); }
.az-cifra-muy strong { color: var(--az-muy); }
.az-cifra-poco strong { color: var(--az-poco); }
.az-lectura { font-size: 1rem; line-height: 1.65; color: var(--text-main); max-width: 72ch; }

.az-orden { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.az-item {
    display: flex; gap: 0.9rem; align-items: flex-start;
    border: 1px solid var(--border); border-left: 4px solid var(--az-bien);
    border-radius: 12px; padding: 0.8rem 1rem; background: #fff;
}
.az-item-muy { border-left-color: var(--az-muy); }
.az-item-poco { border-left-color: var(--az-poco); }
.az-item-sobra { border-left-color: var(--az-sobra); }
.az-pos {
    flex: none; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem;
    color: var(--text-muted); width: 1.6rem; font-variant-numeric: tabular-nums;
}
.az-item-cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.az-item-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem; }
.az-item-cab strong { font-size: 0.98rem; color: var(--text-main); }
.az-tag {
    font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
    font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 999px;
}
.az-tag-muy { background: var(--az-muy-soft); color: var(--az-muy); }
.az-tag-poco { background: var(--az-poco-soft); color: var(--az-poco); }
.az-tag-bien { background: var(--az-bien-soft); color: var(--az-bien); }
.az-tag-sobra { background: var(--az-sobra-soft); color: var(--az-sobra); }
.az-meter { height: 8px; border-radius: 999px; background: var(--panel-soft); overflow: hidden; }
.az-meter span { display: block; height: 100%; border-radius: 999px; background: var(--az-bien); }
.az-item-muy .az-meter span { background: var(--az-muy); }
.az-item-poco .az-meter span { background: var(--az-poco); }
.az-item-sobra .az-meter span { background: var(--az-sobra); }
.az-item-pie {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.3rem 1rem;
    font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.az-item-pie b { color: var(--text-main); }
.az-item-pie a { color: var(--secondary); font-weight: 700; text-decoration: none; }
.az-item-pie a:hover { text-decoration: underline; }
.az-nota { font-size: 0.82rem; line-height: 1.55; color: var(--text-muted); max-width: 72ch; }

.az-siguiente {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem;
    border-radius: 16px; padding: 1.2rem 1.4rem; background: var(--accent-soft); border: 1px solid rgba(30, 143, 91, 0.25);
}
.az-siguiente > div { flex: 1 1 320px; }
.az-siguiente h3 { font-family: var(--font-display); font-weight: 800; font-size: 1.08rem; color: var(--text-main); margin-bottom: 0.3rem; }
.az-siguiente p { font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); }
.az-siguiente button.dp-btn { font: inherit; font-weight: 700; font-size: 0.95rem; border: 0; cursor: pointer; }
.az-nota a { color: var(--secondary); font-weight: 600; }

/* --- guia y preguntas --- */
.az-pasos {
    margin: 1rem 0 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.7rem; max-width: 74ch;
    font-size: 0.96rem; line-height: 1.65; color: var(--text-muted);
}
.az-pasos strong { color: var(--text-main); }
.az-pasos li::marker { font-family: var(--font-display); font-weight: 800; color: var(--primary); }
.az-fuente { margin-top: 1rem; font-size: 0.8rem !important; }
.dp-block > p a { color: var(--secondary); font-weight: 600; }
.az-faq details { border-bottom: 1px solid var(--border); padding: 0.9rem 0; max-width: 78ch; }
.az-faq summary { cursor: pointer; font-weight: 700; font-size: 0.98rem; color: var(--text-main); }
.az-faq details p { margin-top: 0.55rem; font-size: 0.94rem; line-height: 1.65; color: var(--text-muted); }

@media (max-width: 860px) {
    .az-fila { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .az-area, .az-barra { grid-column: 1 / -1; }
    .az-cifras { grid-template-columns: 1fr; }
    .az-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
    .az-botones { flex-direction: column; align-items: stretch; }
    .az-figs { grid-template-columns: 1fr; }
    /* Cuatro botones en 360 px no caben con texto legible: dos y dos,
       que ademas deja izquierda arriba y derecha abajo. */
    .az-barra { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .az-botones .dp-btn, .az-botones .dp-btn-ghost { width: 100%; }
}

/* --- subir el PDF del informe (lector_pdf.js) --- */
.az-subir { display: flex; flex-direction: column; gap: 0.6rem; }
.az-subir-zona {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.25rem 1.2rem;
    border: 2px dashed var(--border-strong); border-radius: 16px; padding: 1.1rem 1.3rem;
    background: var(--panel-soft); cursor: pointer;
}
.az-subir-zona strong { font-family: var(--font-display); font-weight: 800; font-size: 1.08rem; color: var(--text-main); }
.az-subir-zona span:not(.az-subir-btn) { grid-column: 1; font-size: 0.88rem; line-height: 1.5; color: var(--text-muted); }
.az-subir-btn { grid-column: 2; grid-row: 1 / span 2; font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.az-subir.is-encima .az-subir-zona, .az-subir-zona:hover { border-color: var(--secondary); }
.az-subir input:focus-visible + .az-subir-zona { outline: 2px solid var(--secondary); outline-offset: 2px; }
.az-pdf-estado { font-size: 0.9rem; font-weight: 600; line-height: 1.5; border-radius: 10px; padding: 0.7rem 0.9rem; background: var(--panel-soft); color: var(--text-main); }
.az-pdf-estado.is-bien { background: var(--az-bien-soft); color: var(--az-bien); }
.az-pdf-estado.is-mal { background: var(--az-muy-soft); color: var(--az-muy); }
.az-o { font-size: 0.88rem; color: var(--text-muted); }
/* Fila que el lector no pudo dar por segura: se ve sin ser un error. */
.az-fila.is-revisar { background: var(--az-poco-soft); box-shadow: inset 4px 0 0 var(--az-poco); }
.az-revisar { grid-column: 1 / -1; font-size: 0.8rem; font-weight: 600; color: var(--az-poco); }
@media (max-width: 520px) {
    .az-subir-zona { grid-template-columns: 1fr; }
    .az-subir-btn { grid-column: 1; grid-row: auto; justify-self: start; }
}
