/* =========================================================
   CONFIGURACIÓN GENERAL
   ========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 20px;

    font-family: Arial, Helvetica, sans-serif;

    background: #f1f3f5;

    color: #222;
}


/* =========================================================
   CONTENEDOR
   ========================================================= */

.contenedor {
    width: 100%;
    max-width: 1100px;

    margin: auto;

    background: white;

    border-radius: 15px;

    overflow: hidden;

    box-shadow: 0 5px 25px rgba(0,0,0,0.12);
}


/* =========================================================
   ENCABEZADO
   ========================================================= */

.encabezado {
    min-height: 120px;

    background: #111;

    color: white;

    display: grid;

    grid-template-columns: 180px 1fr 180px;

    align-items: center;

    padding: 20px 35px;
}


.logo {
    display: flex;

    align-items: center;
}


.logo img {
    max-width: 150px;

    max-height: 70px;

    width: auto;

    height: auto;

    object-fit: contain;
}


.logo-izquierdo {
    justify-content: flex-start;
}


.logo-derecho {
    justify-content: flex-end;
}


/* =========================================================
   TÍTULO
   ========================================================= */

.titulo {
    text-align: center;
}


.titulo h1 {
    margin: 0;

    font-size: 28px;

    letter-spacing: 1px;
}


.titulo p {
    margin: 8px 0 0;

    font-size: 18px;
}


/* =========================================================
   CONTENIDO
   ========================================================= */

main {
    padding: 20px;
}


.seccion {
    margin-bottom: 15px;

    padding: 15px;

    border: 1px solid #ddd;

    border-radius: 8px;

    background: #fff;
}


.seccion h2 {
    margin: 0 0 12px;

    font-size: 18px;

    border-bottom: 2px solid #222;

    padding-bottom: 6px;
}


.instruccion {
    margin-top: 0;

    font-size: 13px;

    color: #555;
}


/* =========================================================
   FORMULARIO
   ========================================================= */

.formulario {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 12px 20px;
}


.campo {
    display: flex;

    flex-direction: column;
}


.campo label {
    margin-bottom: 5px;

    font-size: 13px;

    font-weight: bold;
}


input[type="text"],
input[type="date"] {
    width: 100%;

    height: 38px;

    padding: 8px;

    border: 1px solid #aaa;

    border-radius: 5px;

    font-size: 14px;
}


input:focus,
textarea:focus {
    outline: none;

    border-color: #111;
}


/* =========================================================
   PREGUNTAS
   ========================================================= */

.pregunta {
    padding: 10px;

    margin-bottom: 8px;

    border: 1px solid #e0e0e0;

    border-radius: 6px;

    background: #fafafa;
}


.pregunta p {
    margin: 0 0 7px;

    font-size: 14px;

    font-weight: bold;
}


/* =========================================================
   ESTRELLAS
   ========================================================= */

.estrellas {
    display: flex;

    gap: 5px;
}


.estrellas input {
    display: none;
}


.estrellas label {
    font-size: 30px;

    color: #bbb;

    cursor: pointer;

    transition: 0.2s;
}


.estrellas label:hover {
    color: #f5b301;
}


.estrellas input:checked + label {
    color: #f5b301;
}


/* =========================================================
   RECOMENDACIÓN
   ========================================================= */

.recomendacion {
    display: flex;

    justify-content: space-between;

    align-items: center;
}


.recomendacion p {
    margin: 0;

    font-weight: bold;
}


.opciones {
    display: flex;

    gap: 25px;
}


.opciones label {
    font-size: 15px;

    cursor: pointer;
}


.opciones input {
    transform: scale(1.2);

    margin-right: 5px;
}


/* =========================================================
   COMENTARIOS
   ========================================================= */

textarea {
    width: 100%;

    min-height: 100px;

    resize: vertical;

    padding: 10px;

    font-family: Arial, Helvetica, sans-serif;

    font-size: 14px;

    border: 1px solid #aaa;

    border-radius: 5px;
}


/* =========================================================
   BOTONES
   ========================================================= */

.botones {
    display: flex;

    justify-content: center;

    gap: 15px;

    margin: 20px 0;
}


.botones button {
    padding: 12px 22px;

    border: none;

    border-radius: 6px;

    background: #111;

    color: white;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;
}


.botones button:hover {
    opacity: 0.85;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
    padding: 20px;

    text-align: center;

    background: #f2f2f2;

    font-size: 13px;
}


footer p {
    margin: 4px;
}


/* =========================================================
   TABLETA
   ========================================================= */

@media screen and (max-width: 800px) {

    body {
        padding: 10px;
    }

    .encabezado {
        grid-template-columns: 100px 1fr 100px;

        padding: 15px;

        min-height: 100px;
    }

    .logo img {
        max-width: 80px;

        max-height: 55px;
    }

    .titulo h1 {
        font-size: 21px;
    }

    .titulo p {
        font-size: 14px;
    }

    main {
        padding: 10px;
    }

    .formulario {
        grid-template-columns: 1fr;
    }

    .recomendacion {
        flex-direction: column;

        align-items: flex-start;

        gap: 10px;
    }
}


/* =========================================================
   IMPRESIÓN - CARTA - UNA SOLA HOJA
   ========================================================= */

@media print {

    @page {
        size: Letter portrait;
        margin: 5mm;
    }


    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;

        box-sizing: border-box;
    }


    html,
    body {
        width: 100%;

        height: auto;

        margin: 0 !important;

        padding: 0 !important;

        background: white !important;

        font-size: 9px;
    }


    .contenedor {
        width: 100% !important;

        max-width: none !important;

        margin: 0 !important;

        padding: 0 !important;

        border-radius: 0 !important;

        box-shadow: none !important;

        overflow: visible !important;
    }


    /* ENCABEZADO */

    .encabezado {

        width: 100% !important;

        height: 68px !important;

        min-height: 68px !important;

        display: grid !important;

        grid-template-columns: 105px 1fr 105px !important;

        align-items: center !important;

        padding: 6px 10px !important;

        background: #111 !important;

        color: white !important;

        page-break-inside: avoid !important;
    }


    .logo {
        display: flex !important;

        align-items: center !important;
    }


    .logo img {
        max-width: 78px !important;

        max-height: 40px !important;

        object-fit: contain !important;
    }


    .logo-izquierdo {
        justify-content: flex-start !important;
    }


    .logo-derecho {
        justify-content: flex-end !important;
    }


    .titulo {
        text-align: center !important;
    }


    .titulo h1 {
        margin: 0 !important;

        font-size: 17px !important;

        color: white !important;
    }


    .titulo p {
        margin: 2px 0 0 !important;

        font-size: 9px !important;

        color: white !important;
    }


    /* CONTENIDO */

    main {
        padding: 5px !important;
    }


    .seccion {
        margin-bottom: 4px !important;

        padding: 5px !important;

        border: 1px solid #aaa !important;

        border-radius: 3px !important;

        page-break-inside: avoid !important;

        break-inside: avoid !important;
    }


    .seccion h2 {
        margin: 0 0 4px !important;

        padding-bottom: 2px !important;

        font-size: 10px !important;
    }


    .instruccion {
        margin: 1px 0 3px !important;

        font-size: 8px !important;
    }


    /* DATOS DEL CLIENTE */

    .formulario {

        display: grid !important;

        grid-template-columns: repeat(2, 1fr) !important;

        gap: 3px 7px !important;
    }


    .campo label {
        margin-bottom: 1px !important;

        font-size: 7px !important;
    }


    input[type="text"],
    input[type="date"] {

        height: 19px !important;

        padding: 2px 4px !important;

        font-size: 8px !important;

        border: 1px solid #999 !important;

        border-radius: 2px !important;
    }


    /* PREGUNTAS */

    .pregunta {

        margin-bottom: 2px !important;

        padding: 3px !important;

        page-break-inside: avoid !important;

        break-inside: avoid !important;
    }


    .pregunta p {

        margin: 0 0 1px !important;

        font-size: 8px !important;
    }


    /* ESTRELLAS */

    .estrellas {

        gap: 1px !important;
    }


    .estrellas label {

        font-size: 15px !important;
    }


    /* RECOMENDACIÓN */

    .recomendacion {

        display: flex !important;

        justify-content: space-between !important;

        align-items: center !important;
    }


    .recomendacion p {

        font-size: 8px !important;
    }


    .opciones {

        gap: 12px !important;
    }


    .opciones label {

        font-size: 8px !important;
    }


    /* COMENTARIOS */

    textarea {

        width: 100% !important;

        height: 32px !important;

        min-height: 32px !important;

        padding: 3px !important;

        font-size: 8px !important;

        resize: none !important;
    }


    /* OCULTAR BOTONES */

    .botones,
    button {

        display: none !important;
    }


    /* FOOTER */

    footer {

        margin: 2px 0 0 !important;

        padding: 4px !important;

        font-size: 7px !important;

        background: #f2f2f2 !important;

        page-break-inside: avoid !important;
    }


    footer p {

        margin: 1px !important;
    }


    /* EVITAR SALTOS */

    .encabezado,
    .seccion,
    .formulario,
    .pregunta,
    footer {

        page-break-before: auto !important;

        page-break-after: auto !important;

        page-break-inside: avoid !important;

        break-before: auto !important;

        break-after: auto !important;

        break-inside: avoid !important;
    }
}
