/* Registro de Visitantes de Abril IA por WhatsApp - estilos (prefijo rv-, no choca con Bootstrap 3 ni con style.css).
   Celular primero: hoja a pantalla completa; desde 768 px, tarjeta centrada. Paleta del sitio: #293867 (azul), #2bb5c5 (turquesa). */

:root {
    --rv-azul: #293867;
    --rv-turquesa: #2bb5c5;
    --rv-verde: #25d366;
    --rv-verde-osc: #128c4a;
    --rv-texto: #1f2937;
    --rv-suave: #6b7280;
    --rv-linea: #d9dee8;
    --rv-error: #b3261e;
    --rv-error-bg: #fdecea;
    --rv-ok: #1b7f4b;
    --rv-vh: 100dvh;                      /* lo actualiza el JS con visualViewport (teclado en iOS) */
}

/* ---------- Icono flotante ---------- */
.rv-fab {
    position: fixed;
    right: 16px;
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 1025;                        /* sobre el contenido, bajo la barra fija (1030) y los modales de Bootstrap (1050) */
    display: none;                        /* el JS lo muestra cuando el registro esta configurado */
    align-items: center;
    gap: 10px;
    min-height: 56px;
    min-width: 56px;
    padding: 0 18px 0 0;
    border: 0;
    border-radius: 28px;
    background: var(--rv-verde);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .28);
    cursor: pointer;
    transition: transform .15s ease, background-color .15s ease, bottom .2s ease;
    -webkit-tap-highlight-color: transparent;
}
.rv-fab.rv-fab--on { display: inline-flex; }
.rv-fab:hover, .rv-fab:focus { background: var(--rv-verde-osc); color: #fff; outline: none; }
.rv-fab:focus-visible { outline: 3px solid var(--rv-azul); outline-offset: 2px; }
.rv-fab:active { transform: scale(.96); }
.rv-fab__icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; font-size: 32px; }
.rv-fab__txt { display: none; white-space: nowrap; }
.rv-fab--off { background: #9aa3b2; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.rv-fab--off:hover, .rv-fab--off:focus { background: #8a93a3; }
@media (min-width: 768px) {
    .rv-fab__txt { display: inline; }
}
@media (max-width: 767px) {
    .rv-fab { padding: 0; border-radius: 50%; }
}

/* ---------- Capa y hoja ---------- */
html.rv-open, html.rv-open body { overflow: hidden; }
.rv-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 2000;
    display: none;
    background: rgba(20, 28, 52, .62);
    -webkit-overflow-scrolling: touch;
}
.rv-overlay.rv-overlay--on { display: block; }

.rv-sheet {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100vh;                        /* respaldo */
    height: var(--rv-vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    color: var(--rv-texto);
    text-align: left;                     /* body del sitio es text-align:center */
    font-size: 16px;
    line-height: 1.4;
    overflow: hidden;
}
.rv-sheet *, .rv-sheet *::before, .rv-sheet *::after { box-sizing: border-box; }

.rv-head {
    flex: 0 0 auto;
    padding: 12px 8px 10px 16px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--rv-linea);
    background: #fff;
}
.rv-head__row { display: flex; align-items: center; gap: 8px; }
.rv-title {
    flex: 1 1 auto;
    margin: 0;
    font-family: "stilu-regular", inherit;
    font-size: 20px;
    font-weight: bold;
    line-height: 1.2;
    color: var(--rv-azul);
}
.rv-close {
    flex: 0 0 auto;
    width: 44px; height: 44px;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--rv-azul);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.rv-close:hover, .rv-close:focus { background: #eef1f7; outline: none; }
.rv-close:focus-visible { outline: 3px solid var(--rv-turquesa); }

/* Indicador de 3 pasos */
.rv-steps { list-style: none; display: flex; gap: 6px; margin: 10px 8px 0 0; padding: 0; }
.rv-steps li { flex: 1 1 0; min-width: 0; margin: 0; padding: 0; text-align: left; }
.rv-steps li::before { content: ""; display: block; height: 4px; margin-bottom: 4px; border-radius: 2px; background: var(--rv-linea); }
.rv-steps li span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--rv-suave); }
.rv-steps li.rv-done::before { background: var(--rv-turquesa); }
.rv-steps li.rv-now::before { background: var(--rv-azul); }
.rv-steps li.rv-now span { color: var(--rv-azul); font-weight: 600; }

/* Paneles */
.rv-pane { flex: 1 1 auto; min-height: 0; display: none; flex-direction: column; }
.rv-pane.rv-pane--on { display: flex; }
.rv-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; }
.rv-actions {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--rv-linea);
    background: #fff;
}
.rv-actions .rv-btn { flex: 1 1 140px; }
.rv-actions .rv-btn--full { flex: 1 1 100%; }
.rv-title:focus { outline: none; }

.rv-lead { margin: 0 0 14px; color: var(--rv-suave); font-size: 15px; }

/* Campos */
.rv-grid { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.rv-field { margin: 0 0 14px; }
.rv-field label { display: block; margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--rv-azul); }
.rv-input {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #b8c0d0;
    border-radius: 8px;
    background: #fff;
    color: var(--rv-texto);
    font-family: inherit;
    font-size: 16px;                      /* >=16 px evita el zoom automatico de iOS */
    line-height: 1.3;
    -webkit-appearance: none;
    appearance: none;
}
select.rv-input {
    padding-right: 34px;
    background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}
.rv-input:focus { outline: none; border-color: var(--rv-turquesa); box-shadow: 0 0 0 3px rgba(43, 181, 197, .3); }
.rv-input[aria-invalid="true"] { border-color: var(--rv-error); background: #fffafa; }
.rv-input--code { text-transform: uppercase; letter-spacing: 6px; font-family: Consolas, "Courier New", monospace; font-size: 22px; text-align: center; }
.rv-phone { display: flex; gap: 8px; }
.rv-phone .rv-input:first-child { flex: 0 0 42%; min-width: 0; }
.rv-phone .rv-input:last-child { flex: 1 1 auto; min-width: 0; }

.rv-check { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 14px; font-size: 14px; color: var(--rv-texto); }
.rv-check input { flex: 0 0 auto; width: 24px; height: 24px; margin: 0; accent-color: var(--rv-azul); }
.rv-check label { margin: 0; font-weight: 400; font-size: 14px; color: var(--rv-texto); }
.rv-check a { color: var(--rv-azul); text-decoration: underline; }

.rv-turnstile { min-height: 65px; margin: 0 0 14px; }

/* Avisos */
.rv-alert { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; border-left: 4px solid var(--rv-error); background: var(--rv-error-bg); color: var(--rv-error); font-size: 15px; }
.rv-alert[hidden] { display: none; }
.rv-help { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: #eef7f9; color: #1f4f58; font-size: 14px; }
.rv-help[hidden] { display: none; }

/* Botones */
.rv-btn {
    min-height: 48px;
    padding: 10px 22px;
    border: 2px solid var(--rv-azul);
    border-radius: 100px;
    background: var(--rv-azul);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.rv-btn:hover, .rv-btn:focus { background: #1f2b52; border-color: #1f2b52; color: #fff; outline: none; }
.rv-btn:focus-visible { outline: 3px solid var(--rv-turquesa); outline-offset: 2px; }
.rv-btn--sec { background: #fff; color: var(--rv-azul); }
.rv-btn--sec:hover, .rv-btn--sec:focus { background: #eef1f7; color: var(--rv-azul); border-color: var(--rv-azul); }
.rv-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Paso 2: cuenta regresiva */
.rv-timer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: #f3f5fa; font-size: 15px; }
.rv-timer strong { font-family: Consolas, "Courier New", monospace; font-size: 22px; color: var(--rv-azul); }
.rv-timer.rv-timer--low strong { color: var(--rv-error); }

/* Paso 3 y mensaje */
.rv-center { text-align: center; padding: 24px 8px; }
.rv-check-ok { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; background: var(--rv-ok); color: #fff; font-size: 44px; line-height: 72px; }
.rv-center h3 { margin: 0 0 8px; font-family: "stilu-regular", inherit; font-size: 24px; color: var(--rv-azul); }
.rv-center p { margin: 0 0 8px; color: var(--rv-texto); }

.rv-sheet [hidden] { display: none !important; }
.rv-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ---------- Escritorio / tableta ---------- */
@media (min-width: 480px) {
    .rv-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 768px) {
    .rv-sheet {
        top: 50%; left: 50%;
        width: 520px; max-width: calc(100% - 32px);
        height: auto;
        max-height: 90vh;
        max-height: min(90vh, 760px);
        transform: translate(-50%, -50%);
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    }
    .rv-head { padding-top: 12px; }
    .rv-actions { padding-bottom: 12px; }
}
/* Celular en horizontal: poco alto, el cuerpo se desplaza y las acciones siguen visibles */
@media (max-height: 480px) and (orientation: landscape) {
    .rv-head { padding-top: 6px; padding-bottom: 6px; }
    .rv-steps { margin-top: 6px; }
    .rv-lead { display: none; }
    .rv-center { padding: 8px; }
    .rv-check-ok { width: 48px; height: 48px; line-height: 48px; font-size: 30px; margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .rv-fab { transition: none; }
}
/* 320 px: que nada se salga */
@media (max-width: 359px) {
    .rv-title { font-size: 18px; }
    .rv-body { padding: 12px; }
    .rv-actions { padding-left: 12px; padding-right: 12px; }
    .rv-phone { flex-wrap: wrap; }
    .rv-phone .rv-input:first-child { flex: 1 1 100%; }
    .rv-input--code { letter-spacing: 3px; font-size: 20px; }
}
