/*
 * Guía de precios (/precio-segunda-mano/): diseño A · Ficha de datos de
 * docs/guia-precios/ESTILO.md (referencia: docs/guia-precios/propuestas/).
 * Las piezas propias llevan el prefijo gp-; botones, tarjetas, pastillas,
 * buscador y avisos son los ws- de componentes.css. Colores, tipografía y
 * espacios de variables.css, sin colores nuevos. Puntos de corte: 768 y 992 px.
 */

.gp-pagina {
    display: flex;
    flex-direction: column;
    gap: var(--separacion);
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: var(--esp-5) var(--margen-lateral) var(--esp-6);
}

/* Foco visible en lo que se maneja con el teclado (los ws- ya lo llevan) */
.gp-ruta a:focus-visible,
.gp-fila a:focus-visible,
.gp-rel a:focus-visible,
.gp-cats a:focus-visible,
.gp-todos a:focus-visible,
.gp-faq summary:focus-visible,
.gp-ver-tabla summary:focus-visible,
.gp-grafico svg:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---- Ruta de navegación ---- */
.gp-ruta {
    color: var(--texto-3);
    font-size: var(--fs-etiqueta);
}

.gp-ruta ol {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .45rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gp-ruta li {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.gp-ruta li + li::before {
    content: "›";
    color: var(--texto-3);
}

.gp-ruta a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: var(--borde);
    text-underline-offset: 3px;
}

.gp-ruta a:hover {
    color: var(--accent);
}

.gp-ruta [aria-current] {
    color: var(--text);
    font-weight: 600;
}

/* ---- Cabecera de la página ---- */
.gp-cab {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.gp-h1 {
    margin: 0;
    font-size: var(--fs-titulo-pagina);
    font-weight: 800;
    line-height: 1.2;
    text-wrap: balance;
}

.gp-pregunta {
    margin: 0;
    color: var(--text);
    font-size: var(--fs-titulo-tarjeta);
    font-weight: 700;
    line-height: 1.3;
}

.gp-respuesta {
    max-width: 68ch;
    margin: 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.55;
}

.gp-respuesta strong {
    color: var(--text);
}

.gp-actualizado {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    max-width: 80ch;
    margin: 0;
    color: var(--texto-3);
    font-size: var(--fs-etiqueta);
}

.gp-actualizado .bi {
    line-height: 1.5;
}

.gp-h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.25;
}

/* Títulos de bloque fuera de una tarjeta (categorías, relacionados) */
.gp-titulo-suelto {
    margin-bottom: .7rem;
}

.gp-sub {
    margin: 0;
    color: var(--muted);
    font-size: var(--fs-texto-sm);
}

.gp-buscar {
    width: 100%;
}

/* El tipo search pinta su propia cruz de borrar: se deja, es útil */
.gp-buscar .ws-input {
    -webkit-appearance: none;
    appearance: none;
}

/* ---- Franja de cifras ---- */
.gp-cifras {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--borde);
    border-radius: var(--radio-tarjeta);
    background: var(--superficie);
}

.gp-principal {
    display: flex;
    align-items: center;
    gap: .9rem;
}

.gp-icono {
    display: inline-grid;
    flex-shrink: 0;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--borde);
    border-radius: 50%;
    background: var(--superficie-2);
    color: var(--accent);
    font-size: 1.35rem;
}

/* La cifra grande (el precio orientativo): una sola por página */
.gp-cifra {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    margin: 0;
}

.gp-cifra dt {
    color: var(--texto-3);
    font-size: var(--fs-dato);
    font-weight: 700;
}

.gp-cifra dd {
    margin: 0;
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.02em;
    white-space: nowrap;
}

.gp-datos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.gp-datos > div {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--superficie-2);
}

/* «Buen precio para comprar», destacado y, en el móvil, a todo el ancho */
.gp-datos > .gp-buen {
    grid-column: 1 / -1;
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    background: color-mix(in srgb, var(--accent) 8%, var(--superficie-2));
}

.gp-datos-dos > div {
    grid-column: 1 / -1;
}

.gp-datos dt {
    color: var(--texto-3);
    font-size: var(--fs-dato);
    font-weight: 700;
}

.gp-datos dd {
    margin: 0;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.2;
}

.gp-datos small {
    display: block;
    color: var(--texto-3);
    font-size: var(--fs-dato);
    font-weight: 400;
}

/* Tendencia: flecha y texto, nunca solo color; la bajada es buena noticia para quien compra */
.gp-tendencia {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--muted);
    font-size: var(--fs-etiqueta);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gp-tendencia .bi {
    color: var(--color-correcto);
}

.gp-tendencia.gp-sube .bi {
    color: var(--texto-3);
}

/* El botón de la alerta y su frase */
.gp-cta {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.gp-cta .ws-btn {
    white-space: normal;
}

.gp-cta p {
    margin: 0;
    color: var(--texto-3);
    font-size: var(--fs-etiqueta);
    text-align: center;
}

/* Para revendedores, debajo de la franja de cifras: el botón a los planes con análisis */
.gp-revender {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem .8rem;
    margin: 0;
    color: var(--muted);
    font-size: var(--fs-etiqueta);
}

.gp-revender .ws-btn {
    white-space: normal;
}

/* Sin datos suficientes */
.gp-sin-datos {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .7rem;
    padding: 18px 16px;
    border: 1px dashed var(--borde);
    border-radius: var(--radio-tarjeta);
}

.gp-sin-datos p {
    max-width: 68ch;
    margin: 0;
    color: var(--muted);
}

.gp-sin-datos .gp-cta {
    width: 100%;
}

/* ---- Rejillas de tarjetas ---- */
.gp-rejilla,
.gp-rejilla-2 {
    display: grid;
    gap: var(--separacion);
}

.gp-tarjeta-cab {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .3rem .8rem;
}

.gp-tarjeta-pie {
    display: flex;
    justify-content: center;
}

/* ---- Gráfico de la evolución (js/grafico.js) ---- */
.gp-grafico {
    position: relative;
    min-height: 210px;
}

.gp-grafico svg {
    display: block;
    width: 100%;
    height: 210px;
    overflow: visible;
    border-radius: 4px;
}

.gp-grafico .eje {
    fill: var(--texto-3);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.gp-grafico .rejilla {
    stroke: var(--borde);
    stroke-width: 1;
}

.gp-grafico .franja {
    fill: var(--accent);
    fill-opacity: .1;
}

.gp-grafico .franja-sola {
    stroke: var(--accent);
    stroke-opacity: .25;
    stroke-width: 8;
    stroke-linecap: round;
}

.gp-grafico .linea {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.gp-grafico .punto,
.gp-grafico .punto-suelto {
    fill: var(--accent);
    stroke: var(--superficie);
    stroke-width: 2;
}

.gp-grafico .etq-fin {
    fill: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.gp-grafico .cruz {
    stroke: var(--texto-3);
    stroke-width: 1;
}

.gp-grafico .zona {
    fill: transparent;
    cursor: crosshair;
}

.gp-globo {
    position: absolute;
    z-index: 2;
    min-width: 150px;
    padding: .5rem .65rem;
    border: 1px solid var(--borde);
    border-radius: 10px;
    background: var(--superficie-2);
    box-shadow: var(--sombra-flotante);
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.4;
    pointer-events: none;
}

.gp-globo b {
    display: block;
    color: var(--text);
    font-size: .82rem;
}

.gp-globo[hidden] {
    display: none;
}

.gp-leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem 1rem;
    margin: 0;
    color: var(--texto-3);
    font-size: var(--fs-etiqueta);
}

.gp-leyenda span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.gp-leyenda i {
    display: inline-block;
    width: 16px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
}

.gp-leyenda i.gp-franja {
    height: 10px;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.gp-ver-tabla summary {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: var(--alto-control);
    color: var(--accent);
    font-size: var(--fs-etiqueta);
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.gp-ver-tabla summary::-webkit-details-marker {
    display: none;
}

.gp-ver-tabla summary .bi,
.gp-faq summary .bi {
    transition: transform .15s ease;
}

.gp-ver-tabla[open] summary .bi,
.gp-faq details[open] summary .bi {
    transform: rotate(180deg);
}

/* ---- Tablas de datos ---- */
.gp-tabla-caja {
    overflow-x: auto;
}

.gp-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-texto-sm);
}

.gp-tabla th {
    padding: .5rem .6rem;
    border-bottom: 1px solid var(--borde);
    color: var(--texto-3);
    font-size: var(--fs-dato);
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.gp-tabla td {
    padding: .6rem;
    border-bottom: 1px solid var(--borde);
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.gp-tabla tr:last-child td {
    border-bottom: 0;
}

.gp-tabla .num {
    text-align: right;
    white-space: nowrap;
}

.gp-tabla .sec {
    color: var(--texto-3);
}

.gp-tabla .ws-enlace {
    font-size: inherit;
}

.gp-tabla-nombre {
    font-weight: 600;
}

.gp-desglose .gp-h2 + .gp-tabla-caja {
    margin-top: -.2rem;
}

/* ---- Consejos ---- */
.gp-consejos {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: consejo;
}

.gp-consejos li {
    position: relative;
    padding-left: 2.1rem;
    color: var(--muted);
    font-size: var(--fs-texto-sm);
}

.gp-consejos li::before {
    position: absolute;
    top: 0;
    left: 0;
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid var(--borde);
    border-radius: 50%;
    background: var(--superficie-2);
    color: var(--accent);
    content: counter(consejo);
    counter-increment: consejo;
    font-size: .75rem;
    font-weight: 800;
}

.gp-consejos b {
    color: var(--text);
}

/* ---- Preguntas frecuentes ---- */
.gp-faq {
    display: flex;
    flex-direction: column;
}

.gp-faq details {
    border-bottom: 1px solid var(--borde);
}

.gp-faq details:last-child {
    border-bottom: 0;
}

.gp-faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 50px;
    padding: .5rem 0;
    color: var(--text);
    font-size: var(--fs-texto-sm);
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}

.gp-faq summary::-webkit-details-marker {
    display: none;
}

.gp-faq summary .bi {
    color: var(--texto-3);
}

.gp-faq details p {
    margin: 0 0 .85rem;
    color: var(--muted);
    font-size: var(--fs-texto-sm);
}

/* ---- Productos relacionados y lista completa ---- */
.gp-rel,
.gp-cats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .6rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gp-rel a {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    height: 100%;
    min-height: 72px;
    padding: .7rem .8rem;
    border: 1px solid var(--borde);
    border-radius: 14px;
    background: var(--superficie);
    text-decoration: none;
}

.gp-rel a:hover,
.gp-cats a:hover {
    border-color: var(--accent);
}

.gp-rel span {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.3;
}

.gp-rel b {
    color: var(--text);
    font-size: 1.05rem;
}

/* ---- Nota «Cómo calculamos…» ---- */
.gp-nota {
    display: flex;
    gap: .7rem;
    padding: 14px;
    border: 1px dashed var(--borde);
    border-radius: var(--radio-tarjeta);
    color: var(--muted);
    font-size: .85rem;
}

.gp-nota > .bi {
    color: var(--accent);
    font-size: 1.05rem;
    line-height: 1.3;
}

.gp-nota h2 {
    margin: 0 0 .25rem;
    color: var(--text);
    font-size: .95rem;
    font-weight: 700;
}

.gp-nota p {
    margin: 0;
}

/* ---- Índice (portada, categoría y búsqueda) ---- */
.gp-filas {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gp-fila a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .75rem;
    min-height: 54px;
    padding: .5rem .2rem;
    border-bottom: 1px solid var(--borde);
    text-decoration: none;
}

.gp-fila-bajada a {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.gp-fila:last-child a {
    border-bottom: 0;
}

.gp-fila a:hover .gp-fila-nombre {
    color: var(--accent);
}

.gp-fila-nombre {
    color: var(--text);
    font-size: var(--fs-texto-sm);
    font-weight: 600;
    line-height: 1.3;
}

.gp-fila-nombre small {
    display: block;
    color: var(--texto-3);
    font-size: var(--fs-dato);
    font-weight: 600;
}

.gp-fila-precio {
    color: var(--text);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.gp-fila .bi-chevron-right {
    color: var(--texto-3);
}

.gp-solo-escritorio {
    display: none;
}

/* ---- Categorías (portada) ---- */
.gp-cats a {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    height: 100%;
    min-height: 92px;
    padding: .8rem;
    border: 1px solid var(--borde);
    border-radius: 16px;
    background: var(--superficie);
    text-decoration: none;
}

.gp-cats .bi {
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1;
}

.gp-cats b {
    color: var(--text);
    font-size: .9rem;
    line-height: 1.25;
}

.gp-cats span {
    color: var(--texto-3);
    font-size: var(--fs-dato);
    font-weight: 700;
}

/* ---- Todos los productos (portada) ---- */
.gp-todos {
    display: flex;
    flex-direction: column;
    gap: var(--separacion);
}

.gp-todos .gp-titulo-suelto {
    margin-bottom: 0;
}

.gp-todos h3 {
    margin: 0 0 .3rem;
    font-size: var(--fs-titulo-tarjeta);
    font-weight: 700;
}

.gp-todos h3 a {
    display: inline-flex;
    align-items: center;
    min-height: var(--alto-control);
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--borde);
    text-underline-offset: 3px;
}

.gp-todos h3 a:hover {
    color: var(--accent);
}

.gp-todos ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 .8rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gp-todos li a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: var(--alto-control);
    padding: .3rem 0;
    border-bottom: 1px solid var(--borde);
    text-decoration: none;
}

.gp-todos li span {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.3;
}

.gp-todos li b {
    color: var(--text);
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

.gp-todos li a:hover span {
    color: var(--accent);
}

.gp-sin-datos-lista .ws-enlace {
    font-size: inherit;
}

@media (min-width: 768px) {
    .gp-rel,
    .gp-cats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .gp-todos ul {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .gp-cifras {
        grid-template-areas: "principal datos" "principal cta";
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 16px 28px;
        padding: 22px 26px;
    }

    .gp-principal {
        grid-area: principal;
        align-self: stretch;
        padding-right: 28px;
        border-right: 1px solid var(--borde);
    }

    .gp-datos {
        grid-area: datos;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .gp-datos > .gp-buen,
    .gp-datos-dos > div {
        grid-column: auto;
    }

    .gp-datos-dos {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gp-datos dd {
        white-space: nowrap;
    }

    .gp-cifras .gp-cta {
        grid-area: cta;
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }

    .gp-cta .ws-btn-bloque {
        width: auto;
    }

    .gp-cifras .gp-cta .ws-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .gp-cta p {
        text-align: left;
    }

    .gp-sin-datos {
        padding: 22px 26px;
    }

    .gp-rejilla {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    }

    .gp-rejilla-una {
        grid-template-columns: minmax(0, 1fr);
    }

    .gp-rejilla-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .gp-rel,
    .gp-cats {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .gp-todos ul {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .gp-buscar {
        max-width: 480px;
    }

    .gp-solo-movil {
        display: none;
    }

    .gp-solo-escritorio {
        display: block;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gp-ver-tabla summary .bi,
    .gp-faq summary .bi {
        transition: none;
    }
}
