:root {
    --dia-red: #D81A24;
    --white: #FFFFFF;
    --bg-grey: #F2F2F2;
    --text-dark: #333;
    --text-grey-medium: #666;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--white);
    color: var(--text-dark);
    overflow-x: hidden;
}

/* --- ESTRUCTURA: HEADERS Y CONTENIDO --- */
.main-header {
    background: var(--dia-red);
    height: 65px;
    display: flex;
    align-items: center;
    padding: 0 15px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1100;
}

.sub-header {
    background: var(--white);
    height: 35px;
    display: flex;
    align-items: center;
    position: fixed;
    top: 65px; /* Justo debajo del main-header */
    width: 100%;
    z-index: 1000;
    padding: 0 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.main-content { padding-top: 100px; } /* 65px + 35px */

/* --- COMPONENTES DE MARCA (HEADER) --- */
.header-inner { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.brand-box svg { height: 38px; width: auto; display: block; }
.brand-box svg path { fill: var(--white) !important; stroke: none !important; }

.header-actions { display: flex; gap: 20px; }
.header-actions svg { height: 23px; width: 23px; display: block; }
.header-actions svg path, 
.header-actions svg circle, 
.header-actions svg polyline, 
.header-actions svg rect {
    fill: none !important;
    stroke: var(--white) !important;
    stroke-width: 2px;
}
.action-btn { background: none; border: none; padding: 0; cursor: pointer; }

/* --- SUB-HEADER CONTENT --- */
.sub-header-content { display: flex; align-items: center; gap: 8px; }
.txt-exclusive {
    color: var(--text-grey-medium);
    font-weight: 500; font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.4px;
}
#ofert-icon-container svg {
    width: 17px; height: 17px;
    color: var(--dia-red) !important;
    stroke: var(--dia-red) !important;
}

/* --- SECCIONES DEL INDEX (Banner, Cards, Tabs) --- */
.banner-img { width: 100%; height: auto; display: block; }

.msg-section-white { padding: 25px 15px; }
.msg-card-grey {
    background: var(--bg-grey); padding: 20px;
    border-radius: 12px; text-align: center;
}
.msg-card-grey h2 { font-size: 1.15rem; color: var(--dia-red); font-weight: 800; margin-bottom: 5px; }
.msg-card-grey p { font-size: 0.82rem; color: var(--text-grey-medium); font-weight: 500; line-height: 1.5; }

.white-container { padding: 10px 10px 30px; }
.segmented-tabs {
    display: flex; background: var(--white);
    border: 1px solid #eee; border-radius: 10px;
    margin-bottom: 20px; overflow: hidden;
}
.tab-btn {
    flex: 1; padding: 12px 5px;
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; font-size: 0.7rem; font-weight: 700; cursor: pointer;
}
.tab-btn.active { background: var(--bg-grey); color: var(--dia-red); }
.tab-btn.inactive { color: var(--text-grey-medium); }
.tab-svg-container svg { width: 18px; height: 18px; }

.promo-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.promo-card-grey {
    background: var(--bg-grey); padding: 15px 10px;
    border-radius: 15px; display: flex; flex-direction: column;
    align-items: center; text-decoration: none; color: inherit; min-height: 220px;
}
.badge-tienda {
    background: #222; color: white; font-size: 8px;
    padding: 3px 10px; border-radius: 5px; align-self: flex-start;
    margin-bottom: 12px; font-weight: 800;
}
.logo-wrap { height: 45px; width: 100%; display: flex; justify-content: center; align-items: center; margin-bottom: 10px; }
.logo-wrap svg { max-height: 100%; max-width: 80%; }
.promo-val { font-size: 1.5rem; font-weight: 800; color: var(--dia-red); }
.promo-tope { font-size: 0.75rem; font-weight: 700; color: var(--text-dark); margin: 4px 0; text-align: center; }
.promo-cond { font-size: 0.65rem; color: var(--text-grey-medium); font-weight: 500; text-align: center; }

/* --- FOOTER --- */
.main-footer { padding: 40px 15px; border-top: 1px solid #eee; text-align: center; background: white; }
.footer-logo svg { height: 35px; margin-bottom: 20px; }
.footer-logo svg path { fill: var(--dia-red) !important; }
.phone-link { font-size: 1.2rem; font-weight: 800; color: var(--dia-red); text-decoration: none; display: block; margin-bottom: 20px; }
.footer-socials { display: flex; justify-content: center; gap: 20px; margin-bottom: 25px; }
.footer-socials svg { width: 22px; height: 22px; color: #999; }
.footer-legal p { font-size: 0.65rem; color: #ccc; }

/* --- MÓDULO: FORMULARIO PRO (Integrado) --- */
.form-wrapper { max-width: 480px; margin: 0 auto; padding: 20px 20px 80px; }

.bank-promo-header { text-align: center; margin-bottom: 25px; }
.bank-logo-box { height: 55px; margin-bottom: 15px; display: flex; justify-content: center; align-items: center; }
.bank-logo-box svg { max-height: 100%; width: auto; }

.progress-container { height: 6px; background: #eee; border-radius: 10px; margin: 15px 0; overflow: hidden; }
.progress-fill { height: 100%; background: var(--dia-red); width: 33%; transition: width 0.4s ease; }

.form-step { display: none; }
.form-step.active { display: block; animation: slideIn 0.3s ease-out; }

.step-label { font-size: 0.65rem; font-weight: 800; color: var(--dia-red); letter-spacing: 1px; margin-bottom: 5px; }
.form-step h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 10px; }
.step-desc { font-size: 0.8rem; color: var(--text-grey-medium); margin-bottom: 20px; line-height: 1.4; }

.input-group { margin-bottom: 18px; position: relative; }
.input-group label { display: block; font-size: 0.7rem; font-weight: 700; margin-bottom: 6px; color: var(--text-dark); padding-left: 5px; }

/* --- ESTILOS DE INPUTS (CAMBIO: BLANCO = ACTIVO) --- */

.input-group input {
    width: 100%; 
    height: 52px; 
    
    /* CAMBIO: Fondo Blanco (Antes era gris) */
    background: #FFFFFF; 
    
    /* CAMBIO: Borde gris suave para que se note el óvalo */
    border: 1px solid #D9D9D9; 
    
    border-radius: 15px; 
    padding: 0 18px; 
    font-size: 0.95rem; 
    font-family: inherit;
    
    /* Texto Negro al escribir (Alto contraste) */
    color: #111111; 
    
    transition: all 0.2s ease-in-out;
    -webkit-appearance: none;
}

/* Estado: FOCUS (Cuando tocas para escribir) */
.input-group input:focus { 
    border-color: var(--dia-red); 
    background: #FFFFFF; 
    outline: none; 
    /* Sombra roja suave para resaltar */
    box-shadow: 0 4px 10px rgba(216, 26, 36, 0.08); 
}

/* Estado: PLACEHOLDER (Texto de ejemplo "Juan Perez") */
::placeholder { color: #BBBBBB !important; opacity: 1; }
:-ms-input-placeholder { color: #BBBBBB !important; }
::-ms-input-placeholder { color: #BBBBBB !important; }

/* Estado: READONLY (Datos fijos / Bloqueados) */
.input-group input[readonly] {
    /* Fondo Gris -> Indica que NO se toca */
    background-color: #F4F4F4 !important; 
    
    /* Borde casi invisible */
    border: 1px solid #EBEBEB !important; 
    
    /* Texto Gris Medio */
    color: #666666 !important; 
    
    cursor: default;
    pointer-events: none;
    box-shadow: none !important;
}

.form-button {
    width: 100%; height: 55px; border-radius: 15px;
    border: none; font-weight: 800; font-size: 1rem;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; gap: 10px; transition: transform 0.1s;
}
.form-button.main-btn { background: var(--dia-red); color: white; }
.form-button:disabled { background: #ccc; cursor: not-allowed; }

.nav-buttons { display: flex; gap: 12px; margin-top: 25px; }
.form-row { display: flex; gap: 10px; } /* Fila para Vencimiento/CVV */

.error-hint { color: var(--dia-red); font-size: 0.65rem; font-weight: 600; margin-top: 4px; display: none; }

/* REGLA CONSOLIDADA PARA SPINNER */
.spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,0.3); border-radius: 50%;
    border-top-color: white; animation: spin 0.8s linear infinite;
    display: none;
}

/* KEYFRAMES UNIFICADOS */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }

/* --- VALIDACIÓN VISUAL --- */
.input-group input.invalid {
    border-color: var(--dia-red) !important;
    background-color: #fff5f5 !important; /* Resalte leve */
}

/* Fuerza la visibilidad del mensaje de error solo si el input es .invalid */
.input-group input.invalid ~ .error-hint {
    display: block !important;
}
/* --- COMPLEMENTO DE VALIDACIÓN PROFESIONAL --- */

/* Contenedor del icono de marca dentro del input de tarjeta */
.card-input-wrapper { position: relative; width: 100%; }
.card-brand-icon {
    position: absolute; right: 15px; top: 50%;
    transform: translateY(-50%); width: 35px;
    height: 25px; pointer-events: none; transition: all 0.2s;
}
.card-brand-icon svg { width: 100%; height: auto; display: block; }

/* Estilo de Mensajes de Error */
.error-hint {
    color: var(--dia-red);
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 6px;
    padding-left: 12px;
    display: none; /* Oculto por defecto */
    animation: slideDownError 0.25s ease-out;
}

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

/* Estado de Error en Inputs */
.input-group input.invalid {
    border: 2px solid var(--dia-red) !important;
    background-color: #FFF8F8 !important; /* Rojo muy tenue */
}

/* Ajuste para inputs bloqueados pero visibles */
.input-group input[readonly] {
    background-color: #F8F8F8 !important;
    border: 2px solid #EEE !important;
    color: var(--text-grey-medium);
    cursor: not-allowed;
    pointer-events: none;
}
/* --- ESTILOS PÁGINA DE GRACIAS (FINAL PRO) --- */
.success-wrapper { 
    padding: 20px 15px 80px; 
    display: flex; 
    justify-content: center; 
}

.success-card {
    background: var(--white);
    width: 100%;
    max-width: 400px;
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* 1. ICONO DE ÉXITO (VERDE APROBADO) */
.success-icon-box {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.success-icon-box svg {
    width: 100%;
    height: 100%;
    display: block;
    stroke: #22C55E !important; /* <--- VERDE VIBRANTE */
    stroke-width: 2px;
    filter: drop-shadow(0 4px 6px rgba(34, 197, 94, 0.2));
}

.success-card h2 { color: var(--text-dark); font-weight: 800; margin-bottom: 10px; }
.success-msg { font-size: 0.85rem; color: var(--text-grey-medium); line-height: 1.5; margin-bottom: 25px; }

/* 2. QR CONTAINER (SOPORTE PARA IMG Y SVG) */
.qr-container {
    background: #FFFFFF;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 25px;
    display: inline-block;
    border: 2px dashed #ccc;
    min-height: 210px;
    display: flex;       /* Centrado perfecto */
    align-items: center;
    justify-content: center;
}

/* Si es el QR real (Imagen PNG) */
.qr-container img { 
    width: 180px; height: 180px; display: block; border-radius: 10px; 
}

/* Si es tu QR Fake (SVG inyectado) */
.qr-container svg {
    width: 180px; height: 180px; display: block;
}

/* 3. BOTÓN DESCARGAR (SIEMPRE VISIBLE) */
#download-qr-btn {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transition: none !important;
}

.redirect-box { margin-top: 25px; font-size: 0.75rem; color: #999; }
#countdown { font-weight: 800; color: var(--dia-red); }
