/* =====================================================
   LA ROJA x LA CASERA - Pack Oficial
   Hoja de estilos principal
   ===================================================== */

/* ---- Variables de marca ---- */
:root {
    --color-rojo: #DD0629;          /* Rojo principal del fondo */
    --color-granate: #9F0329;       /* Topbar y footer (rojo oscuro) */
    --color-dorado: #F9D060;        /* Amarillo dorado: textos, labels, bordes */
    --color-dorado-hover: #FFE08A;  /* Hover/focus elementos dorados */
    --color-beige: #E2C4AC;         /* Beige del botón ENVIAR SOLICITUD */
    --color-beige-hover: #D4B398;   /* Hover del botón */
    --color-blanco: #ffffff;
    --color-error: #FFD0D0;         /* Rosa claro para errores sobre rojo */
    --color-input-bg: rgba(0, 0, 0, 0.10);   /* Fondo translúcido oscuro de inputs */

    --fuente-principal: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --radio: 6px;
    --radio-boton: 10px;

    --ancho-card: 720px;
}

/* ---- Reset ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    background: var(--color-rojo);
}

body {
    font-family: var(--fuente-principal);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-blanco);
    background-color: var(--color-rojo);
    background-image: url('../img/bg-pattern.jpg');
    background-repeat: repeat;
    background-size: 1400px auto;       /* Mantiene el patrón a tamaño legible y se repite */
    background-position: top center;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =====================================================
   TOPBAR (granate, full-width)
   ===================================================== */
.topbar {
    background: var(--color-granate);
    width: 100%;
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1320px;
    margin: 0 auto;
    padding: 8px 32px;
    min-height: 64px;
}

.topbar__logo {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.topbar__logo img {
    height: 56px;
    width: auto;
}

.topbar__contact {
    color: var(--color-dorado);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0.2px;
    transition: opacity 0.2s ease;
}

.topbar__contact:hover {
    opacity: 0.85;
}

/* =====================================================
   LANDING (zona del formulario, sobre el patrón rojo)
   ===================================================== */
.landing {
    flex: 1;
    width: 100%;
    padding: 48px 24px 60px;
}

.landing__inner {
    max-width: var(--ancho-card);
    margin: 0 auto;
}

/* =====================================================
   TARJETA TRANSLÚCIDA
   ===================================================== */
.card {
    background: rgba(0, 0, 0, 0.13);   /* Sutil oscurecimiento sobre el patrón */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
}

.card__header {
    line-height: 0;
}

.card__header-img {
    width: 100%;
    height: auto;
    display: block;
}

.card__body {
    padding: 36px 48px 44px;
}

/* =====================================================
   TÍTULO E INTRO
   ===================================================== */
.heading {
    font-size: clamp(26px, 4vw, 34px);
    font-weight: 700;
    color: var(--color-dorado);
    text-align: center;
    margin-bottom: 18px;
    line-height: 1.15;
}

.intro {
    text-align: center;
    margin-bottom: 38px;
    color: var(--color-dorado);
}

.intro p {
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 14px;
}

.intro__lead {
    font-weight: 700;
    font-size: 15px;
}

.intro p:last-child {
    margin-bottom: 0;
}

/* =====================================================
   FORMULARIO
   ===================================================== */
.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
}

.field__label {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-blanco);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.field__required {
    color: var(--color-blanco);
    font-weight: 700;
    margin-left: 2px;
}

.field__optional {
    color: var(--color-blanco);
    font-weight: 400;
    font-size: 13px;
    margin-left: 4px;
    opacity: 0.85;
}

/* Hint pequeño entre label y campo */
.field__hint {
    font-size: 12.5px;
    color: var(--color-blanco);
    margin-bottom: 8px;
    line-height: 1.5;
    font-weight: 400;
    opacity: 0.95;
}

/* Inputs translúcidos con borde dorado */
.field__input {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--fuente-principal);
    font-size: 15px;
    color: var(--color-blanco);
    background: var(--color-input-bg);
    border: 1px solid var(--color-dorado);
    border-radius: var(--radio);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.field__input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.field__input:hover {
    border-color: var(--color-dorado-hover);
}

.field__input:focus {
    outline: none;
    border-color: var(--color-dorado-hover);
    background: rgba(0, 0, 0, 0.18);
    box-shadow: 0 0 0 3px rgba(249, 208, 96, 0.25);
}

/* Auto-fill: forzar texto blanco y borde dorado en navegadores */
.field__input:-webkit-autofill,
.field__input:-webkit-autofill:hover,
.field__input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--color-blanco);
    -webkit-box-shadow: 0 0 0px 1000px rgba(0, 0, 0, 0.25) inset;
    border-color: var(--color-dorado);
    transition: background-color 5000s ease-in-out 0s;
}

/* Select con chevron dorado */
.field__input--select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F9D060' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

.field__input--select option {
    background: var(--color-granate);
    color: var(--color-blanco);
}

.field__input--select option:disabled {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.field__input--select:invalid {
    color: rgba(255, 255, 255, 0.65);
}

/* Mensaje de error de validación */
.field__error {
    color: var(--color-dorado);
    background: rgba(0, 0, 0, 0.20);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12.5px;
    margin-top: 6px;
    line-height: 1.4;
    font-weight: 500;
}

/* Input marcado con error desde el backend */
.field__input.is-error {
    border-color: #FFD0D0;
    box-shadow: 0 0 0 3px rgba(255, 208, 208, 0.20);
}

/* Caja de error general (fallo de canjeo: código usado, sin stock, etc.) */
.form-error-box {
    background: rgba(0, 0, 0, 0.30);
    border: 1px solid var(--color-dorado);
    color: var(--color-dorado);
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 28px;
    font-size: 14px;
    line-height: 1.5;
}

.form-error-box strong {
    color: var(--color-dorado);
    display: inline-block;
    margin-bottom: 4px;
}

/* =====================================================
   BOTÓN ENVIAR SOLICITUD
   ===================================================== */
.btn-submit {
    display: block;
    width: 100%;
    max-width: 380px;
    margin: 32px auto 0;
    padding: 16px 24px;
    font-family: var(--fuente-principal);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--color-granate);
    background-color: var(--color-beige);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radio-boton);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.20);
}

.btn-submit:hover {
    background-color: var(--color-beige-hover);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.btn-submit:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.20);
}

.btn-submit:focus-visible {
    outline: 3px solid var(--color-dorado);
    outline-offset: 3px;
}

.btn-submit[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    background: var(--color-granate);
    width: 100%;
}

.footer__links {
    max-width: 1320px;
    margin: 0 auto;
    padding: 18px 32px;
    text-align: center;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.footer__links a {
    color: var(--color-blanco);
    text-decoration: underline;
    text-underline-offset: 3px;
    margin: 0 16px;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.footer__links a:hover {
    opacity: 0.8;
}

/* =====================================================
   MENSAJE DE ÉXITO
   ===================================================== */
.form-success {
    display: none;
    text-align: center;
    padding: 28px 24px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--color-dorado);
    border-radius: var(--radio);
    color: var(--color-dorado);
    margin-top: 24px;
}

.form-success.is-visible {
    display: block;
    animation: fadeIn 0.4s ease;
}

.form-success h2 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--color-dorado);
}

.form-success p {
    color: var(--color-blanco);
    font-size: 14.5px;
    line-height: 1.55;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 720px) {
    .topbar__inner {
        padding: 8px 18px;
        min-height: 56px;
    }

    .topbar__logo img {
        height: 44px;
    }

    .topbar__contact {
        font-size: 12.5px;
    }

    .landing {
        padding: 28px 14px 40px;
    }

    .card__body {
        padding: 28px 22px 36px;
    }

    .intro p {
        font-size: 13.5px;
    }

    .btn-submit {
        font-size: 15px;
        letter-spacing: 1px;
    }

    .footer__links {
        padding: 16px 18px;
        font-size: 12px;
    }

    .footer__links a {
        margin: 0 8px;
    }
}

@media (max-width: 420px) {
    .topbar__contact {
        font-size: 11.5px;
    }

    .heading {
        font-size: 24px;
    }
}

/* =====================================================
   ACCESIBILIDAD
   ===================================================== */
/* =====================================================
   MODAL TEXTOS LEGALES
   ===================================================== */
.modal-legal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-legal.is-open {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}

.modal-legal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.modal-legal__dialog {
    position: relative;
    background: var(--color-fondo, #fcf8f1);
    color: #1A2A47;
    border-radius: 12px;
    width: 100%;
    max-width: 760px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: modalScaleIn 0.25s ease;
}

.modal-legal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(26, 42, 71, 0.12);
    background: var(--color-granate);
    color: #ffffff;
    flex-shrink: 0;
}

.modal-legal__title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin: 0;
    color: var(--color-dorado);
}

.modal-legal__close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.modal-legal__close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.modal-legal__close:focus-visible {
    outline: 2px solid var(--color-dorado);
    outline-offset: 2px;
}

.modal-legal__body {
    padding: 28px 32px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.6;
    font-size: 14.5px;
    color: #1A2A47;
}

/* Estilos del HTML que devuelve el WS (puede traer h1, h2, p, ul, etc.) */
.modal-legal__body h1,
.modal-legal__body h2,
.modal-legal__body h3 {
    color: var(--color-granate);
    margin: 18px 0 10px;
    font-weight: 700;
}

.modal-legal__body h1 { font-size: 22px; }
.modal-legal__body h2 { font-size: 18px; }
.modal-legal__body h3 { font-size: 16px; }

.modal-legal__body h1:first-child,
.modal-legal__body h2:first-child,
.modal-legal__body h3:first-child {
    margin-top: 0;
}

.modal-legal__body p {
    margin: 0 0 14px;
}

.modal-legal__body ul,
.modal-legal__body ol {
    margin: 0 0 14px;
    padding-left: 22px;
}

.modal-legal__body li {
    margin-bottom: 6px;
}

.modal-legal__body a {
    color: var(--color-rojo);
    text-decoration: underline;
}

.modal-legal__body strong {
    color: var(--color-granate);
}

.modal-legal__loading,
.modal-legal__error {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-style: italic;
}

.modal-legal__error {
    color: #b91c1c;
    font-style: normal;
}

/* Bloquear el scroll del body cuando el modal está abierto */
body.modal-open {
    overflow: hidden;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalScaleIn {
    from { transform: scale(0.96); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

@media (max-width: 520px) {
    .modal-legal {
        padding: 12px;
    }
    .modal-legal__dialog {
        max-height: 92vh;
    }
    .modal-legal__header {
        padding: 14px 18px;
    }
    .modal-legal__title {
        font-size: 16px;
    }
    .modal-legal__body {
        padding: 20px 22px;
        font-size: 14px;
    }
}

/* =====================================================
   ACCESIBILIDAD
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
