@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600;700&family=Source+Sans+3:wght@400;500;600;700&display=swap");

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    color-scheme: light dark;
    --font-heading: "Playfair Display", "Times New Roman", serif;
    --font-body: "Source Sans 3", "Segoe UI", sans-serif;
    --bg: #f5f2ea;
    --bg-accent: #e5dfd5;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --text: #1f2a2e;
    --muted: #5d6b71;
    --brand: #1b6f5f;
    --brand-strong: #145447;
    --border: rgba(31, 42, 46, 0.12);
    --shadow: 0 18px 45px rgba(17, 24, 28, 0.12);
    --glow: 0 0 0 3px rgba(27, 111, 95, 0.25);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1416;
        --bg-accent: #182022;
        --surface: rgba(25, 33, 36, 0.9);
        --surface-strong: #1f2a2e;
        --text: #eef3f5;
        --muted: #b1bcc2;
        --brand: #5bd6b2;
        --brand-strong: #3bbf99;
        --border: rgba(238, 243, 245, 0.12);
        --shadow: 0 20px 45px rgba(0, 0, 0, 0.5);
        --glow: 0 0 0 3px rgba(91, 214, 178, 0.25);
    }
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    color: var(--text);
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 45%),
        radial-gradient(circle at bottom right, rgba(27, 111, 95, 0.15), transparent 40%),
        linear-gradient(140deg, var(--bg) 0%, var(--bg-accent) 100%);
}

h1 {
    text-align: center;
    margin: 8px 0 18px;
    font-family: var(--font-heading);
    font-size: clamp(2rem, 3vw, 2.6rem);
    color: var(--text);
    letter-spacing: 0.5px;
}

form {
    display: flex;
    justify-content: center;
    margin: 20px 0 8px;
    flex-wrap: nowrap;
    gap: 0;
}

input[type="text"] {
    padding: 14px 18px;
    margin-right: 0px;
    border: 1px solid var(--border);
    border-top-left-radius: 20px;
    border-bottom-left-radius: 20px;
    border-top-right-radius: 0; 
    border-bottom-right-radius: 0;
    width: 100%;
    max-width: 600px;
    font-size: 16px;
    background-color: var(--surface-strong);
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input[type="text"]:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: var(--glow);
}

input[type="submit"] {
    padding: 10px 15px;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    max-width: 150px;
}

input[type="submit"]:hover {
    background-color: #4cae4c;
}

.button {
    padding: 12px 18px;
    background-color: var(--brand);
    border: 1px solid var(--brand);
    color: white;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 150px;
    font-size: 18px;
    cursor: pointer;
}

.button:hover {
    background-color: var(--brand-strong);
    color: #fff;
}

.button:focus {
    outline: none;
    box-shadow: var(--glow);
}

.button:active {
    transform: scale(0.95);
}

/* Estilos de la tabla */
#resultsTable {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0;
    background-color: var(--surface-strong);
    max-height: 400px;
    border-radius: 10px;
    font-size: 16px;
    text-align: left;
    overflow: hidden;
    border: 1px solid var(--border);
}

#resultsTable th, #resultsTable td {
    padding: 12px 15px;
    border: 1px solid var(--border);
}

#resultsTable th {
    background-color: rgba(27, 111, 95, 0.12);
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.4px;
}

#resultsTable tr:nth-child(even) {
    background-color: rgba(27, 111, 95, 0.05);
}

#resultsTable tr:hover {
    background-color: rgba(27, 111, 95, 0.12);
}

/* Ocultar la tabla inicialmente */
.hidden {
    display: none;
}


.title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.title-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.scroll-to-top {
    position: fixed;
    bottom: 90px; /* Ajustar para que esté encima del botón de WhatsApp */
    right: 20px;
    background-color: rgba(27, 111, 95, 0.85);
    border-radius: 50%;
    padding: 10px;
    width: 60px; /* Mismo tamaño que el botón de WhatsApp */
    height: 60px; /* Mismo tamaño que el botón de WhatsApp */
    display: none;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    z-index: 1000;
}

.scroll-to-top img {
    height: 30px;
    width: 30px;
    filter: brightness(0) invert(1);
}

.scroll-to-top.show {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-top.hide {
    opacity: 0;
    transform: translateY(20px);
}

.scroll-to-top:hover {
    transform: translateY(-5px);
    background-color: rgba(27, 111, 95, 1);
}

.main-container {
    display: flex;
    flex-wrap: wrap;
    margin-top: 30px;
    padding: 28px clamp(16px, 4vw, 48px) 40px;
    width: 100%;
    height: 100vh;
}

.left-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
}

.form-container {
    box-shadow: var(--shadow);
    border-radius: 18px;
    padding: clamp(20px, 3vw, 32px);
    background-color: var(--surface);
    border: 1px solid var(--border);
    height: 80vh;
    width: 100%;
}

.form-container p {
    margin: 8px 0 0;
}

.imagen-izq {
    width: 100%;
    height: auto;
    max-height: 500px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    object-fit: cover;
}

.right-container {
    margin-left: 20px;
    border-radius: 16px;
    width: 100%;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 45px; /* Mover 35px más hacia arriba */
    overflow: visible;
}

.error-message {
    color: #b42318;
    font-size: 14px;
    font-weight: 600;
    top: -20px;
    left: 0;
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
    background-color: rgba(180, 35, 24, 0.08);
    border: 1px solid rgba(180, 35, 24, 0.3);
    padding: 8px 12px;
    border-radius: 10px;
}

.img-banner {
    width: 100%;
    height: 100%; /* Ajustar la altura para que coincida con el contenedor */
    max-height: 70vh; /* Asegurar que la altura máxima coincida con el contenedor */
    border-radius: 16px;
    box-shadow: var(--shadow);
    object-fit: contain;
    aspect-ratio: 5 / 4;
}

/* Estilos para dispositivos móviles */
@media screen and (max-width: 767px) {
    .main-container {
        flex-direction: column;
        align-items: center;
        height: 100%;
    }

    .left-container {
        width: 100%;
        height: auto;
    }

    .form-container {
        width: 100%;
        height: auto;
        max-height: none;
    }

    .imagen-izq {
        display: none;
    }

    .right-container {
        width: 100%;
        margin-left: 0;
        margin-top: 20px;
        height: auto;
        position: static;
    }

    .img-banner {
        width: 100%;
        height: auto;
        max-height: 750px;
        margin-top: 0;
        max-width: 720px;
        object-fit: contain;
        aspect-ratio: auto;
        border-radius: 16px;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    body {
        overflow-y: scroll;
    }
}

/* Estilos para tabletas */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        align-items: center;
        height: 100%;
    }

    .left-container {
        width: 100%;
        height: auto;
    }

    .form-container {
        width: 100%;
        height: auto;
        max-height: none;
    }

    .right-container {
        margin-left: 0;
        margin-top: 20px;
        width: 100%;
        height: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        position: static;
    }

    .img-banner {
        width: 100%;
        height: auto;
        max-height: 750px;
        margin-top: 0;
        max-width: 720px;
        object-fit: contain;
        aspect-ratio: auto;
        border-radius: 16px;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    body {
        overflow-y: scroll;
    }
}

/* Estilos para pantallas grandes */
@media screen and (min-width: 1025px) {
    .main-container {
        flex-direction: row;
        justify-content: center;
    }

    .left-container {
        width: 66.67%;
        height: auto;
    }

    .form-container {
        width: 100%;
        height: auto;
    }

    .right-container {
        width: 33.33%;
        height: 70vh;
        margin-left: 20px;
        position: sticky;
        top: 45px; /* Mover 35px más hacia arriba */
        overflow: visible;
    }

    .img-banner {
        width: 100%;
        height: 100%; /* Ajustar la altura para que coincida con el contenedor */
        max-height: 70vh; /* Asegurar que la altura máxima coincida con el contenedor */
        border-radius: 16px;
        box-shadow: var(--shadow);
    }

    input[type="text"] {
        max-width: 900px;
    }
}

/* Estilos del botón flotante de WhatsApp */
.whatsapp-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #25d366;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    animation: breathe 2s ease-in-out infinite;
}

.whatsapp-btn i {
    color: #fff;
    font-size: 24px;
    animation: beat 2s ease-in-out infinite;
    text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@keyframes breathe {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
    }
}

@keyframes beat {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}
