/* ====================================
   GENERADOR DE CALENDARIO DE CUSTODIA
   Archivo: wwwroot/css/Herramientas/CalendarioCustodia.css
   Se carga junto a css/Landing/Guia.css (tipografía y variables de lectura).
   ==================================== */

.herr {
    --herr-a: #FFB7A5;
    --herr-b: #BFD8B8;
    --herr-a-fuerte: #C2573F;
    --herr-b-fuerte: #5E8253;
    --herr-fuera: #F3F3F3;
    /* Trama para B: distingue a los dos progenitores sin depender del color. */
    --herr-trama: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.55) 0 2px, transparent 2px 7px);
}

.herr-ancho {
    max-width: 1140px;
}

/* ---------- Cabecera compacta: la herramienta tiene que verse pronto ---------- */

.herr-cabecera {
    padding: 6.5rem 0 1.5rem;
    background: linear-gradient(135deg, var(--cocrianza-melocoton-claro) 0%, var(--cocrianza-beige-neutro) 100%);
}

.herr-entradilla {
    max-width: 760px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--guia-texto-suave);
    margin-bottom: 0;
}

/* ---------- Formulario ---------- */

.herr-herramienta {
    padding: 1.5rem 0 1rem;
}

.herr-form {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    margin-bottom: 1.5rem;
}

@media (min-width: 992px) {
    .herr-form {
        grid-template-columns: 1.4fr 1fr;
    }

    .herr-form .herr-grupo:first-child {
        grid-row: span 3;
    }
}

.herr-grupo {
    border: 1px solid var(--guia-borde);
    border-radius: 16px;
    padding: 1rem 1.25rem 1.1rem;
    margin: 0;
    min-width: 0;
}

.herr-grupo legend {
    float: none;
    width: auto;
    font-size: 1rem;
    font-weight: 700;
    padding: 0 0.4rem;
    margin: 0 0 0.25rem -0.4rem;
}

.herr-opcional {
    font-weight: 400;
    color: var(--guia-texto-suave);
}

.herr-regimenes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

@media (min-width: 576px) {
    .herr-regimenes {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .herr-regimenes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.herr-opcion {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.herr-opcion input {
    position: absolute;
    opacity: 0;
}

.herr-opcion > span {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    height: 100%;
    padding: 0.7rem 0.85rem;
    border: 2px solid var(--guia-borde);
    border-radius: 12px;
    line-height: 1.25;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.herr-opcion small {
    color: var(--guia-texto-suave);
    font-size: 0.82rem;
}

.herr-opcion input:checked + span {
    border-color: var(--herr-a-fuerte);
    background: var(--cocrianza-melocoton-claro);
}

.herr-opcion input:focus-visible + span {
    outline: 3px solid var(--herr-a-fuerte);
    outline-offset: 2px;
}

.herr-ayuda {
    font-size: 0.9rem;
    color: var(--guia-texto-suave);
    margin: 0.6rem 0 0;
}

.herr-fila {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.herr-campo {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
}

.herr-campo input,
.herr-campo select {
    font: inherit;
    font-weight: 400;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--guia-borde);
    border-radius: 10px;
    background: #fff;
    color: var(--guia-texto);
    min-height: 44px;
}

.herr-segmentado {
    display: flex;
    border: 1px solid var(--guia-borde);
    border-radius: 10px;
    overflow: hidden;
}

.herr-segmentado label {
    flex: 1;
    margin: 0;
    cursor: pointer;
    position: relative;
}

.herr-segmentado input {
    position: absolute;
    opacity: 0;
}

.herr-segmentado span {
    display: block;
    min-height: 44px;
    padding: 0.6rem 0.5rem;
    text-align: center;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.herr-segmentado input:checked + span {
    background: var(--cocrianza-melocoton-claro);
    font-weight: 700;
}

.herr-segmentado input:focus-visible + span {
    outline: 3px solid var(--herr-a-fuerte);
    outline-offset: -3px;
}

/* Ciclo personalizado */

.herr-personalizado {
    margin-top: 0.9rem;
}

.herr-ciclo {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
}

.herr-ciclo-separador {
    display: none;
}

.herr-ciclo-dia {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    min-height: 48px;
    padding: 0.3rem 0;
    border: 0;
    border-radius: 10px;
    font: inherit;
    color: #3A3A3A;
    cursor: pointer;
}

.herr-ciclo-dia:nth-of-type(n + 8) {
    margin-top: 0.2rem;
}

.herr-ciclo-semana {
    font-size: 0.75rem;
}

.herr-ciclo-inicial {
    font-weight: 800;
}

/* ---------- Colores de los días ---------- */

.herr-a {
    background: var(--herr-a);
}

.herr-b {
    background-color: var(--herr-b);
    background-image: var(--herr-trama);
}

.herr-intercambio-muestra,
.herr-de-a-a-b {
    background: linear-gradient(135deg, var(--herr-a) 50%, var(--herr-b) 50%);
}

.herr-de-b-a-a {
    background: linear-gradient(135deg, var(--herr-b) 50%, var(--herr-a) 50%);
}

/* ---------- Resultado ---------- */

.herr-resultado {
    /* Reserva el alto antes de pintar para no mover la página. */
    min-height: 640px;
}

.herr-aviso {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: var(--guia-fondo-suave);
}

.herr-resumen {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1rem;
}

.herr-resumen-titulo {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0;
}

.herr-resumen-sub {
    margin: 0;
    color: var(--guia-texto-suave);
}

.herr-leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.1rem;
    font-size: 0.95rem;
}

.herr-leyenda-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.herr-muestra {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #3A3A3A;
}

.herr-cifras {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.herr-cifra {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.9rem 1.1rem;
    border-radius: 14px;
    color: #3A3A3A;
}

.herr-cifra-a {
    background: var(--herr-a);
}

.herr-cifra-b {
    background-color: var(--herr-b);
}

.herr-cifra-numero {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.herr-cifra-texto {
    font-size: 0.95rem;
    line-height: 1.3;
}

.herr-cifras-nota {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.85rem;
    color: var(--guia-texto-suave);
}

.herr-subtitulo {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.6rem;
}

.herr-proximos {
    margin-bottom: 1.5rem;
}

.herr-lista-intercambios {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem 1rem;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 0.95rem;
}

.herr-lista-intercambios li {
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--guia-borde);
    border-radius: 10px;
    line-height: 1.35;
}

.herr-intercambio-fecha {
    display: block;
    font-weight: 700;
}

.herr-intercambio-detalle {
    color: var(--guia-texto-suave);
}

/* Meses */

.herr-meses {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 576px) {
    .herr-meses {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .herr-meses {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .herr-meses {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.herr-mes {
    padding: 0.75rem;
    border: 1px solid var(--guia-borde);
    border-radius: 14px;
    break-inside: avoid;
}

.herr-mes-titulo {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.4rem;
}

.herr-tabla-mes {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 3px;
}

.herr-tabla-mes th {
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    color: var(--guia-texto-suave);
}

.herr-dia {
    height: 38px;
    padding: 2px 3px;
    border-radius: 7px;
    vertical-align: top;
    color: #3A3A3A;
    position: relative;
}

.herr-num {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.1;
}

.herr-ini {
    position: absolute;
    right: 4px;
    bottom: 2px;
    font-size: 0.62rem;
    font-weight: 800;
    opacity: 0.75;
}

.herr-fuera {
    background: var(--herr-fuera);
    color: #9A9A9A;
}

.herr-mes-noches {
    margin: 0.35rem 0 0;
    font-size: 0.8rem;
    color: var(--guia-texto-suave);
}

.herr-pie-impresion {
    display: none;
}

/* ---------- Acciones ---------- */

.herr-acciones {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 0;
}

.herr-acciones[hidden] {
    display: none;
}

.herr-boton-secundario {
    border: 2px solid var(--herr-a-fuerte);
    color: var(--herr-a-fuerte);
    background: transparent;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.6rem 1.4rem;
}

.herr-boton-secundario:hover,
.herr-boton-secundario:focus {
    background: var(--cocrianza-melocoton-claro);
    color: var(--herr-a-fuerte);
}

.herr-copiado {
    font-size: 0.9rem;
    color: var(--guia-texto-suave);
}

.herr .guia-cta-boton {
    display: inline-block;
    background: #C2573F;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    padding: 0.7rem 1.6rem;
}

.herr .guia-cta-boton:hover,
.herr .guia-cta-boton:focus {
    background: #A84A35;
    color: #fff;
}

@media (max-width: 575.98px) {
    .herr-cabecera {
        padding: 5.25rem 0 1rem;
    }

    .herr-cabecera .guia-titulo {
        font-size: 1.6rem;
        margin-bottom: 0.5rem;
    }

    .herr-entradilla {
        font-size: 1rem;
    }

    .herr-cifra {
        flex-direction: column;
        gap: 0.2rem;
    }

    .herr-dia {
        height: 40px;
    }
}

/* ---------- Modo oscuro ---------- */

[data-theme="dark"] .herr-cabecera {
    background: var(--dm-bg-secondary);
}

[data-theme="dark"] .herr-campo input,
[data-theme="dark"] .herr-campo select {
    background: var(--dm-bg-input);
    color: var(--dm-text-primary);
}

[data-theme="dark"] .herr-opcion input:checked + span,
[data-theme="dark"] .herr-segmentado input:checked + span {
    background: var(--dm-bg-card-hover);
}

[data-theme="dark"] .herr-fuera {
    background: var(--dm-bg-card);
    color: var(--dm-text-muted);
}

/* ---------- Impresión: el año (12 o 13 meses) en una hoja A4 ---------- */

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    #navbarLanding,
    footer,
    #cc-consentimiento,
    .visually-hidden-focusable,
    .herr-no-imprimir {
        display: none !important;
    }

    html,
    body {
        background: #fff !important;
    }

    main,
    .container-fluid,
    .herr-ancho {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
    }

    .herr,
    .herr * {
        color: #222 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .herr-herramienta {
        padding: 0;
    }

    .herr-resultado {
        min-height: 0;
    }

    .herr-resumen {
        margin-bottom: 3mm;
    }

    .herr-resumen-titulo {
        font-size: 14pt;
    }

    .herr-cifras {
        margin-bottom: 3mm;
        gap: 3mm;
    }

    .herr-cifra {
        padding: 2mm 3mm;
    }

    .herr-cifra-numero {
        font-size: 14pt;
    }

    .herr-cifra-texto,
    .herr-cifras-nota,
    .herr-leyenda {
        font-size: 8pt;
    }

    .herr-meses {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 2.5mm;
    }

    .herr-mes {
        padding: 1.5mm 2mm;
        border-color: #ccc;
    }

    .herr-mes-titulo {
        font-size: 9pt;
        margin-bottom: 1mm;
    }

    .herr-tabla-mes {
        border-spacing: 1px;
    }

    .herr-tabla-mes th {
        font-size: 6.5pt;
    }

    .herr-dia {
        height: 5.8mm;
        padding: 0.5mm 1mm;
        border-radius: 3px;
    }

    .herr-num {
        font-size: 7pt;
    }

    .herr-ini {
        font-size: 5pt;
        right: 1mm;
        bottom: 0.3mm;
    }

    .herr-mes-noches {
        font-size: 6.5pt;
        margin-top: 1mm;
    }

    .herr-pie-impresion {
        display: block;
        margin-top: 3mm;
        font-size: 8pt;
        text-align: center;
    }
}
