/* Reto gratis — fase 13.
   Diseño dark con acento verde para diferenciarlo del checkout de pago. */

:root {
    --rg-bg: #0a0f0c;
    --rg-bg-grad-1: #0c1f15;
    --rg-bg-card: #11181480;
    --rg-bg-card-solid: #111814;
    --rg-bg-input: #0f1612;
    --rg-bg-input-focus: #14211a;
    --rg-border: rgba(255, 255, 255, 0.08);
    --rg-border-strong: rgba(255, 255, 255, 0.18);
    --rg-green-1: #4ade80;
    --rg-green-2: #22c55e;
    --rg-green-3: #16a34a;
    --rg-green-soft: rgba(74, 222, 128, 0.18);
    --rg-text: #f5f5f7;
    --rg-text-muted: #a8a8b0;
    --rg-text-dim: #6e6e76;
    --rg-danger-bg: rgba(229, 57, 53, 0.10);
    --rg-danger-border: #e53935;
    --rg-danger-text: #ff8a85;
    --rg-radius: 12px;
    --rg-radius-sm: 8px;
    --rg-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
    --rg-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html { font-size: 16px; }

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(ellipse at top, var(--rg-bg-grad-1) 0%, var(--rg-bg) 60%) no-repeat fixed var(--rg-bg);
    color: var(--rg-text);
    font-family: var(--rg-font);
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}

a { color: var(--rg-green-1); }
a:hover { color: var(--rg-green-2); }

.rg-page {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem 3.5rem;
    align-items: start;
}

.rg-brand {
    text-align: center;
    grid-column: 1 / -1;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rg-brand__home { text-decoration: none; }

.rg-brand__logo {
    width: 96px;
    max-height: 72px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.rg-brand__badge {
    display: inline-block;
    inline-size: fit-content;
    margin: 0.25rem 0 0.75rem;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    background: linear-gradient(45deg, var(--rg-green-3), var(--rg-green-2));
    border: 1px solid var(--rg-green-1);
    color: #052e16;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.rg-brand__title {
    margin: 0.5rem 0 0.75rem;
    font-size: clamp(1.6rem, 4.5vw, 2.25rem);
    color: var(--rg-text);
    letter-spacing: -0.015em;
    font-weight: 700;
    line-height: 1.15;
}

.rg-brand__lede {
    margin: 0 auto;
    color: var(--rg-text-muted);
    font-size: 1.05rem;
    max-width: 36rem;
}

.rg-brand__lede strong { color: var(--rg-green-1); }

.rg-main { width: 100%; }

.rg-card {
    position: relative;
    background: var(--rg-bg-card-solid);
    border: 1px solid var(--rg-border);
    border-radius: var(--rg-radius);
    padding: clamp(1.5rem, 3.5vw, 2rem);
    box-shadow: var(--rg-shadow);
    overflow: hidden;
}

.rg-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at top right, rgba(74, 222, 128, 0.08), transparent 50%);
}

.rg-card > * { position: relative; z-index: 1; }

.rg-card__header {
    margin: 0 0 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--rg-border);
}

.rg-card__title {
    margin: 0 0 0.45rem;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    letter-spacing: -0.005em;
}

.rg-card__title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 1.2rem;
    background: linear-gradient(180deg, var(--rg-green-1), var(--rg-green-3));
    border-radius: 2px;
}

.rg-card__lede {
    margin: 0;
    color: var(--rg-text-muted);
    font-size: 0.95rem;
}

.rg-form { margin: 0; }

.rg-field {
    display: flex;
    flex-direction: column;
    margin: 0 0 0.85rem;
}

.rg-field label {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--rg-text-muted);
    letter-spacing: 0.01em;
}

.rg-field__error {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--rg-danger-text);
}

.rg-field__error[hidden] { display: none; }

.rg-form input[type="text"],
.rg-form input[type="email"],
.rg-form input[type="tel"] {
    width: 100%;
    background: var(--rg-bg-input);
    border: 1px solid var(--rg-border-strong);
    color: var(--rg-text);
    padding: 0.7rem 0.85rem;
    border-radius: var(--rg-radius-sm);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.4;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.rg-form input::placeholder { color: var(--rg-text-dim); }

.rg-form input:focus-visible {
    outline: none;
    border-color: var(--rg-green-2);
    background: var(--rg-bg-input-focus);
    box-shadow: 0 0 0 3px var(--rg-green-soft);
}

/* Rojo solo tras interacción del usuario o marca explícita desde backend. */
.rg-form input:user-invalid,
.rg-form input[aria-invalid="true"] {
    border-color: var(--rg-danger-border);
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.18);
}

.rg-form input:user-invalid:focus-visible,
.rg-form input[aria-invalid="true"]:focus-visible {
    border-color: var(--rg-danger-border);
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.25);
}

/* intl-tel-input */
.rg-field--tel .iti { display: block; width: 100%; }
.rg-field--tel .iti--separate-dial-code { width: 100%; }
.rg-field--tel .iti--separate-dial-code .iti__selected-flag {
    background: var(--rg-bg-input);
    border: 1px solid var(--rg-border-strong);
    border-right: none;
    border-radius: var(--rg-radius-sm) 0 0 var(--rg-radius-sm);
    padding: 0 8px 0 12px;
}
.rg-field--tel .iti__selected-dial-code { color: var(--rg-text); }
.rg-field--tel .iti__arrow { border-top-color: var(--rg-text-muted); }
.rg-field--tel .iti input[type="tel"],
.rg-field--tel input.phone-input {
    width: 100% !important;
    padding-left: 96px !important;
    background: var(--rg-bg-input) !important;
    color: var(--rg-text) !important;
    border: 1px solid var(--rg-border-strong) !important;
    border-radius: var(--rg-radius-sm) !important;
    min-height: 44px !important;
}
.rg-field--tel .iti__country-list {
    background: #11181480;
    background-color: #11181d;
    color: var(--rg-text);
    border: 1px solid var(--rg-border-strong);
}
.rg-field--tel .iti__country.iti__highlight {
    background: var(--rg-green-soft);
}

.rg-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--rg-border);
    border-radius: var(--rg-radius-sm);
    margin: 0.75rem 0 0;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.rg-check:hover {
    border-color: var(--rg-border-strong);
    background: rgba(255, 255, 255, 0.04);
}

.rg-check input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    margin: 0.15rem 0 0;
    accent-color: var(--rg-green-2);
    flex-shrink: 0;
}

.rg-check span { font-size: 0.9rem; line-height: 1.5; color: var(--rg-text); }

.rg-check a { text-decoration: underline; text-underline-offset: 2px; }

.rg-submit {
    display: block;
    width: 100%;
    margin: 1.25rem 0 0;
    padding: 0.95rem 1.5rem;
    background: linear-gradient(135deg, var(--rg-green-1), var(--rg-green-3));
    color: #052e16;
    border: none;
    border-radius: var(--rg-radius-sm);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.rg-submit:hover {
    filter: brightness(1.06);
    box-shadow: 0 8px 24px rgba(74, 222, 128, 0.35);
}

.rg-submit:disabled {
    opacity: 0.7;
    cursor: progress;
    transform: none;
}

.rg-secure {
    margin: 0.85rem 0 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--rg-text-dim);
}

/* Resumen de errores (componente compartido) */
.form-errors {
    background: var(--rg-danger-bg);
    border: 1px solid rgba(229, 57, 53, 0.3);
    border-left: 3px solid var(--rg-danger-border);
    border-radius: var(--rg-radius-sm);
    padding: 0.85rem 1rem;
    margin: 0 0 1rem;
    color: var(--rg-danger-text);
}

.form-errors__title {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 600;
}

.form-errors__list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    line-height: 1.45;
}

/* Hero lateral en desktop */
.rg-hero { display: none; }

@media (min-width: 960px) {
    .rg-page {
        grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
        gap: 2rem;
    }
    .rg-brand { 
        text-align: left; 
        align-items: flex-start;
    }
    .rg-brand__lede { margin-left:0px !important; }
    .rg-hero {
        display: block;
        position: sticky;
        top: 2rem;
        align-self: start;
        padding: 1rem 0;
    }
    .rg-hero img {
        display: block;
        width: 100%;
        max-height: 70vh;
        object-fit: contain;
        border: none;
        background: transparent;
        filter: drop-shadow(0 24px 48px rgba(74, 222, 128, 0.25));
    }
}

/* Pantalla de carga */
.load-screen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    color: var(--rg-text);
}
.load-screen[hidden] { display: none; }

.load-text { font-size: 1.1rem; margin-top: 1rem; }

.spinner { width: 5rem; animation: rg-spin 0.9s linear infinite; }

@keyframes rg-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.turnstile-wrap {
    display: flex;
    justify-content: center;
    margin: 1rem 0 0.5rem;
    min-height: 65px;
}

/* Página de éxito reto gratis (mantiene compatibilidad con reto-gratis-exito.html) */
.exito-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.exito-card {
    max-width: 520px;
    width: 100%;
    text-align: center;
    padding: 2rem 1.5rem;
    border-radius: var(--rg-radius);
    background: linear-gradient(145deg, #052e16 0%, #14532d 50%, #052e16 100%);
    border: 2px solid var(--rg-green-1);
    box-shadow: 0 12px 40px rgba(74, 222, 128, 0.15);
}

.exito-card h1 {
    font-size: 1.75rem;
    margin: 0 0 0.75rem;
    color: var(--rg-green-1);
}

.exito-card p {
    font-size: 1.05rem;
    line-height: 1.5;
    margin: 0 0 1.25rem;
}

.btn-comunidad {
    display: inline-block;
    padding: 0.85rem 1.6rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #052e16;
    background: linear-gradient(45deg, var(--rg-green-1), #86efac);
    border: 2px solid white;
    border-radius: var(--rg-radius-sm);
    text-decoration: none;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-comunidad:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    color: #052e16;
}
