/* =========================================
   JATR · Mantenimiento preventivo
   ========================================= */

:root {
    --navy: #1F3A5F;
    --navy-dark: #15293F;
    --blue: #2F6DA1;

    --background: #EEF2F5;
    --surface: #FFFFFF;
    --border: #D9E1E8;

    --text: #1F2933;
    --text-muted: #667085;

    --green: #2E8B57;
    --green-dark: #246F46;

    --state-blue: #2F6DA1;
    --state-blue-dark: #24547C;

    --yellow: #E6A700;
    --yellow-dark: #C28E00;

    --red: #C93C3C;
    --red-dark: #A52F2F;

    --neutral: #E8EDF2;
    --neutral-text: #475467;
}


/* =========================================
   BASE
   ========================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 1.25rem;
    font-family: Arial, sans-serif;

    background-color: var(--background);
    color: var(--text);

    line-height: 1.5;
}


/* =========================================
   ENCABEZADO
   ========================================= */

.app-header {
    max-width: 1000px;
    margin: 0 auto 2rem;
}

.app-header h1 {
    margin: 0;
    color: var(--navy);
    font-size: 2rem;
}

.app-header p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}


/* =========================================
   CONTENEDOR PRINCIPAL
   ========================================= */

.app-container {
    max-width: 1000px;
    margin: 0 auto;
}


/* =========================================
   SECCIONES
   ========================================= */

.section {
    background-color: var(--surface);

    border: 1px solid var(--border);
    border-radius: 10px;

    padding: 1.25rem;
    margin-bottom: 1.25rem;

    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.section h2 {
    margin: 0 0 1.25rem;

    color: var(--navy);

    font-size: 1.25rem;
    line-height: 1.3;
}

.section h3 {
    margin: 0 0 0.75rem;

    color: var(--text);

    font-size: 1rem;
}


/* =========================================
   FORMULARIOS
   ========================================= */

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;

    margin-bottom: 0.4rem;

    font-weight: bold;
    font-size: 0.95rem;

    color: var(--text);
}

input[type="text"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;

    padding: 0.75rem;

    border: 1px solid var(--border);
    border-radius: 6px;

    background-color: #FFFFFF;

    color: var(--text);

    font-family: inherit;
    font-size: 1rem;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;

    border-color: var(--blue);

    box-shadow: 0 0 0 3px rgba(47, 109, 161, 0.15);
}

input[readonly] {
    background-color: #F3F6F8;
    color: var(--text-muted);
}


/* =========================================
   BLOQUES DE REVISIÓN
   ========================================= */

.check-item {
    padding-bottom: 1rem;
    margin-bottom: 1rem;

    border-bottom: 1px solid var(--border);
}

.check-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}


/* =========================================
   BOTONES DE ESTADO
   ========================================= */

.state-buttons {
    display: flex;
    flex-wrap: wrap;

    gap: 0.6rem;
}

.state-btn {
    border: 1px solid transparent;
    border-radius: 8px;

    min-height: 48px;

    padding: 0.75rem 1.1rem;

    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        opacity 0.15s ease;
}

.state-btn:hover {
    transform: translateY(-1px);
}

.state-btn:active {
    transform: translateY(0);
}

.state-btn.selected {
    box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.25);
}


/* VERDE */

.state-btn.green {
    background-color: var(--green);
    color: #FFFFFF;
}

.state-btn.green:hover {
    background-color: var(--green-dark);
}


/* AZUL */

.state-btn.blue {
    background-color: var(--state-blue);
    color: #FFFFFF;
}

.state-btn.blue:hover {
    background-color: var(--state-blue-dark);
}


/* AMARILLO */

.state-btn.yellow {
    background-color: var(--yellow);
    color: #1F2933;
}

.state-btn.yellow:hover {
    background-color: var(--yellow-dark);
}


/* ROJO */

.state-btn.red {
    background-color: var(--red);
    color: #FFFFFF;
}

.state-btn.red:hover {
    background-color: var(--red-dark);
}


/* NEUTRAL / ESTADO INICIAL */

.state-btn.neutral {
    background-color: var(--neutral);
    color: var(--neutral-text);

    border-color: var(--border);
}

/* =========================================
   OBSERVACIONES
   Inicialmente ocultas
   ========================================= */

.observation {
    display: none;

    margin-top: 0.75rem;
}


/* =========================================
   MANTENIMIENTO FÍSICO
   ========================================= */

.maintenance-block {
    margin-bottom: 1.5rem;
}

.completed-list {
    margin: 0;
    padding-left: 1.25rem;
}

.completed-list li {
    margin-bottom: 0.5rem;
}


/* Fecha de cambio de pasta térmica */

.thermal-date {
    display: none;

    margin-top: 0.75rem;
}


/* =========================================
   ALMACENAMIENTO
   ========================================= */

.storage-unit {
    padding: 1rem;

    margin-bottom: 1rem;

    border: 1px solid var(--border);
    border-radius: 8px;

    background-color: #FAFBFC;
}

.storage-unit:last-child {
    margin-bottom: 0;
}

.add-unit {
    margin-top: 1rem;

    padding: 0.75rem 1rem;

    background-color: var(--navy);
    color: #FFFFFF;

    border: none;
    border-radius: 6px;

    font-family: inherit;
    font-size: 0.95rem;
    font-weight: bold;

    cursor: pointer;
}

.add-unit:hover {
    background-color: var(--navy-dark);
}


/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 600px) {

    body {
        padding: 0.75rem;
    }

    .app-header {
        margin-bottom: 1.25rem;
    }

    .app-header h1 {
        font-size: 1.7rem;
    }

    .section {
        padding: 1rem;
    }

    .state-buttons {
        flex-direction: column;
    }

    .state-btn {
        width: 100%;
        min-height: 48px;
    }

}

/* =========================================
   VISTA PREVIA DEL REPORTE
   ========================================= */

#report-preview {
    max-width: 1000px;
    margin: 2rem auto;
}

.report-container {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 1.25rem;
}


/* =========================================
   ENCABEZADO DEL REPORTE
   ========================================= */

.report-header {
    grid-column: 1 / -1;

    margin-bottom: 0.25rem;
}

.report-header h1 {
    margin: 0;

    color: var(--navy);

    font-size: 1.75rem;
    line-height: 1.3;
}


/* =========================================
   TARJETAS
   ========================================= */

.report-card {
    background-color: var(--surface);

    border: 1px solid var(--border);
    border-radius: 10px;

    padding: 1.25rem;

    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.report-card.report-full {
    grid-column: 1 / -1;
}

.report-card h2 {
    margin: 0 0 1rem;

    color: var(--navy);

    font-size: 1.15rem;
    line-height: 1.3;
}


/* =========================================
   CONTENIDO DE LAS TARJETAS
   ========================================= */

.report-content {
    color: var(--text);

    font-size: 0.95rem;
}

.report-row {
    display: flex;

    justify-content: space-between;
    align-items: baseline;

    gap: 1rem;

    padding: 0.45rem 0;

    border-bottom: 1px solid var(--border);
}

.report-row:last-child {
    border-bottom: none;
}

.report-check-row {
    justify-content: flex-start;

    gap: 0.5rem;
}

.report-check-row .report-status {
    flex: 0 0 auto;

    width: 1rem;

    text-align: center;
}

.report-label {
    font-weight: bold;
}

.report-value {
    text-align: right;
}


/* =========================================
   RESUMEN DEL EQUIPO · SECCIÓN 01
   ========================================= */

.report-system-grid {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 0.75rem;
}

.report-system-item {
    display: flex;

    flex-direction: column;

    justify-content: space-between;

    min-height: 4.5rem;

    padding: 0.75rem;

    background-color: var(--surface);

    border: 1px solid var(--border);

    border-radius: 8px;
}

.report-system-label {
    color: var(--text-muted);

    font-size: 0.8rem;
}

.report-system-value {
    margin-top: 0.4rem;

    color: var(--text);

    font-size: 0.95rem;

    font-weight: bold;
}


.report-client {
    justify-content: flex-start;

    gap: 0.5rem;
}

.report-client .report-value {
    text-align: left;
}


/* =========================================
   DOS COLUMNAS DENTRO DE UNA TARJETA
   ========================================= */

.report-two-columns {
    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 0.5rem 1.25rem;
}

.report-two-columns .report-row {
    border-bottom: none;
}


/* =========================================
   ESTADOS DEL REPORTE
   ========================================= */

.report-status {
    font-weight: bold;
}

.report-status.ok {
    color: var(--green);
}

.report-status.issue {
    color: var(--red);
}

.report-status.info {
    color: var(--blue);
}

.report-status.warning {

    color: var(--yellow);

}


/* =========================================
   INCIDENCIAS / INFORMACIÓN ADICIONAL
   ========================================= */

.report-detail {
    margin-top: 0.75rem;

    padding-top: 0.75rem;

    border-top: 1px solid var(--border);

    color: var(--text-muted);

    font-size: 0.9rem;
}

.report-detail strong {
    color: var(--text);
}


/* =========================================
   SERVICIO SIGUIENTE Y NOTA PREVENTIVA
   ========================================= */

.report-final-row {
    grid-column: 1 / -1;

    display: grid;

    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 1.25rem;
}

.report-final-row .report-card {
    margin: 0;
}

.report-note-card {
    display: flex;

    align-items: center;
}

.report-note-card #report-note {
    color: var(--text-muted);

    font-size: 0.8rem;

    font-style: italic;

    line-height: 1.5;
}



/* =========================================
   OBSERVACIONES FINALES
   ========================================= */

.report-observations {
    min-height: 3rem;

    white-space: pre-wrap;

    color: var(--text);
}


/* =========================================
   SIGUIENTE SERVICIO
   ========================================= */

.report-next-service {
    color: var(--navy);

    font-size: 1.1rem;

    font-weight: bold;

    text-align: center;
}


/* =========================================
   NOTA PREVENTIVA
   ========================================= */

.report-note {
    color: var(--text-muted);

    font-size: 0.85rem;

    line-height: 1.6;
}


/* =========================================
   ACCIONES DEL REPORTE
   ========================================= */

.report-actions {
    grid-column: 1 / -1;

    display: flex;

    justify-content: center;

    gap: 1rem;

    margin-top: 0.5rem;
}

.report-actions button {
    padding: 0.75rem 1.25rem;

    border: none;
    border-radius: 6px;

    font-family: inherit;
    font-size: 0.95rem;
    font-weight: bold;

    cursor: pointer;
}

#back-to-capture {
    background-color: var(--neutral);

    color: var(--neutral-text);

    border: 1px solid var(--border);
}

#back-to-capture:hover {
    background-color: var(--border);
}

#print-report {
    background-color: var(--navy);

    color: #FFFFFF;
}

#print-report:hover {
    background-color: var(--navy-dark);
}


/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 700px) {

    #report-preview {
        margin: 1rem auto;
    }

    .report-container {
        grid-template-columns: 1fr;
    }

    .report-card.report-full {
        grid-column: auto;
    }

    .report-two-columns {
        grid-template-columns: 1fr;
    }

    .report-actions {
        flex-direction: column;
    }

    .report-actions button {
        width: 100%;
    }
}

/* =========================================
   IMPRESIÓN / PDF · FORMATO CARTA
   ========================================= */
/* =========================================
   IMPRESIÓN / PDF · FORMATO CARTA
   ========================================= */

@media print {

    @page {
        size: Letter;
        margin: 0.5in;
    }


    /* Ocultar la interfaz de captura */

    body > * {
        display: none !important;
    }


    /* Mostrar únicamente el reporte */

    #report-preview {
        display: block !important;

        max-width: none;

        margin: 0;
    }


    /* Ocultar botones del reporte */

    .report-actions {
        display: none !important;
    }


    /* =========================================
       DISTRIBUCIÓN DEL REPORTE
       ========================================= */





.report-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 0.75rem;
}


/* Mantener las tarjetas principales a todo el ancho */

.report-card {
    grid-column: 1 / -1;
}


/* 06 y 07 en paralelo */

.report-card:has(#report-section-06),
.report-card:has(#report-section-07) {
    grid-column: auto;
}







    /* Mantener dos columnas solamente
       donde el contenido lo necesita */

    .report-two-columns {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }


    /* Evitar cortar una tarjeta entre páginas */

    .report-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }


        /* =========================================
       COMPACTAR CONTENIDO DEL REPORTE
       ========================================= */

    .report-card {
        padding: 0.9rem;
    }

    .report-row {
        padding: 0.25rem 0;
    }

    .report-container {
        gap: 0.5rem;
    }

    .report-detail {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
    }


    /* Permitir que las tarjetas finales ocupen
   el espacio restante de la página */

.report-next-service-card,
.report-note-card {
    break-inside: auto;
    page-break-inside: auto;
}


/* =========================================
   BLOQUE FINAL DEL REPORTE
   ========================================= */

.report-final-row {
    grid-column: 1 / -1;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    gap: 0.5rem;

    break-inside: avoid;
    page-break-inside: avoid;
}

.report-final-row .report-card {
    grid-column: auto;

    break-inside: avoid;
    page-break-inside: avoid;
}


}