/* ============================================
   SECCIÓN 1: RESET Y BODY
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Albert Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #EBEBEB;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-weight: 300;
}

/* ============================================
   SECCIÓN 2: GRADIENTE DE FONDO (EFECTO M2)
   ============================================ */
.gradient-background {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Mismo tamaño que el container */
    max-width: 700px;
    width: calc(100% - 40px);
    min-height: 600px;
    height: auto;
    
    /* Border radius ligeramente mayor */
    border-radius: 26px;
    
    /* El efecto de gradiente */
    background: 
        radial-gradient(circle at 0% 0%, #3b82f6, transparent 50%),
        radial-gradient(circle at 100% 0%, #BBF266, transparent 50%),
        radial-gradient(circle at 0% 100%, #1e40af, transparent 50%),
        radial-gradient(circle at 100% 100%, #BBF266, transparent 50%);
    
    /* Animaciones */
    animation: 
        gradient-shift 6s ease-in-out infinite,
        glow-pulse 4s ease-in-out alternate infinite;
    background-size: 300% 300%;
    
    /* Blur para el efecto glow */
    filter: blur(12px);
    
    /* Posicionamiento */
    z-index: -1;
    pointer-events: none;
}

/* Elemento adicional para el borde más definido */
.gradient-background::before {
    content: "";
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 26px;
    background: 
        radial-gradient(circle at 0% 0%, #3b82f6, transparent 40%),
        radial-gradient(circle at 100% 0%, #00a6ff, transparent 40%),
        radial-gradient(circle at 0% 100%, #1e40af, transparent 40%),
        radial-gradient(circle at 100% 100%, #2563eb, transparent 40%);
    animation: gradient-shift 6s ease-in-out infinite;
    background-size: 300% 300%;
    filter: blur(2px);
    z-index: 1;
}

/* ============================================
   SECCIÓN 3: CONTAINER PRINCIPAL (LIMPIO)
   ============================================ */
.container {
    position: relative;
    background: #ffffff !important; /* FORZAR fondo blanco */
    border-radius: 24px;
    max-width: 800px;
    width: 100%;
    overflow: hidden;
    min-height: 600px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.08),
        0 8px 25px rgba(0, 0, 0, 0.04);
    z-index: 2; /* Por encima del gradiente */
}

/* ELIMINAR todos los ::before y ::after del container para evitar conflictos */
/* El gradiente ahora está en .gradient-background */

/* ============================================
   SECCIÓN 4: ANIMACIONES DEL GRADIENTE
   ============================================ */
@keyframes gradient-shift {
    0% { 
        background-position: 0% 0%, 100% 0%, 0% 100%, 100% 100%;
    }
    25% { 
        background-position: 100% 0%, 100% 100%, 0% 0%, 100% 100%;
    }
    50% { 
        background-position: 100% 100%, 0% 100%, 100% 0%, 0% 100%;
    }
    75% { 
        background-position: 0% 100%, 0% 0%, 100% 100%, 0% 0%;
    }
    100% { 
        background-position: 0% 0%, 100% 0%, 0% 100%, 100% 100%;
    }
}

@keyframes glow-pulse {
    0% {
        filter: blur(12px);
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        filter: blur(16px);
        transform: translate(-50%, -50%) scale(1.01);
    }
    100% {
        filter: blur(12px);
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ============================================
   SECCIÓN 5: STEPS Y CONTENIDO
   ============================================ */
.step {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 60px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: transparent; /* Transparente para mostrar el fondo blanco del container */
    opacity: 0;
    visibility: hidden;
    transform: translateX(100px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    overflow: hidden;
}

.step.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    z-index: 2;
}

.step h1 {
    font-size: 1.5em;
    color: #1e293b;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.step h2 {
    font-size: 2em;
    color: #334155;
    margin-bottom: 30px;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.step p {
    font-size: 1.2em;
    color: #64748b;
    margin-bottom: 40px;
    line-height: 1.6;
    font-weight: 300;
}

/* ============================================
   SECCIÓN 6: RADIO BUTTONS
   ============================================ */
.question-container {
    margin-bottom: 40px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.radio-container {
    --main-color: #4E5F8F;
    --main-color-opacity: #4E5F8F1c;
    --total-radio: 6;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-left: 1rem;
}

.radio-container input {
    cursor: pointer;
    appearance: none;
    position: absolute;
    opacity: 0;
}

.radio-container .glider-container {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: linear-gradient(
        0deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(148, 163, 184, 0.3) 50%,
        rgba(0, 0, 0, 0) 100%
    );
    width: 1px;
}

.radio-container .glider-container .glider {
    position: relative;
    height: calc(100% / var(--total-radio));
    width: 100%;
    background: linear-gradient(
        0deg,
        rgba(0, 0, 0, 0) 0%,
        var(--main-color) 50%,
        rgba(0, 0, 0, 0) 100%
    );
    transition: transform 0.5s cubic-bezier(0.37, 1.95, 0.66, 0.56);
}

.radio-container .glider-container .glider::before {
    content: "";
    position: absolute;
    height: 60%;
    width: 300%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--main-color);
    filter: blur(10px);
}

.radio-container .glider-container .glider::after {
    content: "";
    position: absolute;
    left: 0;
    height: 100%;
    width: 150px;
    background: linear-gradient(
        90deg,
        var(--main-color-opacity) 0%,
        rgba(0, 0, 0, 0) 100%
    );
}

.radio-container label {
    cursor: pointer;
    padding: 1.2rem;
    position: relative;
    color: #64748b;
    transition: all 0.3s ease-in-out;
    font-weight: 300;
    font-size: 1.1em;
    text-align: left;
}

.radio-container input:checked + label {
    color: var(--main-color);
    font-weight: 400;
}

.radio-container input:nth-of-type(1):checked ~ .glider-container .glider { transform: translateY(0); }
.radio-container input:nth-of-type(2):checked ~ .glider-container .glider { transform: translateY(100%); }
.radio-container input:nth-of-type(3):checked ~ .glider-container .glider { transform: translateY(200%); }
.radio-container input:nth-of-type(4):checked ~ .glider-container .glider { transform: translateY(300%); }
.radio-container input:nth-of-type(5):checked ~ .glider-container .glider { transform: translateY(400%); }
.radio-container input:nth-of-type(6):checked ~ .glider-container .glider { transform: translateY(500%); }

/* ============================================
   SECCIÓN 7: BOTONES Y ELEMENTOS UI
   ============================================ */
.cta-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border: none;
    padding: 18px 36px;
    border-radius: 16px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 400;
    margin: 20px auto;
    display: block;
    font-family: 'Albert Sans', sans-serif;
    position: relative;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.cta-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(59, 130, 246, 0.25),
        0 4px 12px rgba(59, 130, 246, 0.15);
}

.cta-btn:hover::before {
    transform: translateX(100%);
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 3px 0;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.step-indicator {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 20px;
    border-radius: 20px;
    font-weight: 400;
    color: #3b82f6;
    font-size: 0.9em;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.back-btn {
    position: absolute;
    top: 24px;
    left: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 400;
    color: #4E5F8F;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    z-index: 10;
}

/* ============================================
   SECCIÓN 8: AI RESPONSE Y FORMULARIOS
   ============================================ */

/* Step5 con scroll inteligente restaurado */
#step5 {
    justify-content: flex-start !important;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 40px 40px 80px 40px;
}

/* Contenedor interno del resultado para mejor control */
.result-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    gap: 20px;
    min-height: 100%;
}

.ai-response {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    padding: 32px;
    border-radius: 20px;
    margin: 20px 0;
    text-align: left;
    box-shadow: 
        0 12px 32px rgba(59, 130, 246, 0.2),
        0 4px 12px rgba(59, 130, 246, 0.1);
    font-weight: 300;
    line-height: 1.6;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 600px;
    min-height: 150px;
    max-height: none;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.ai-response::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* Botón de solución con posicionamiento mejorado */
#solutionBtn {
    margin-top: 24px;
    margin-bottom: 40px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    flex-shrink: 0;
    z-index: 10;
    display: none;
}

#solutionBtn.show {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll personalizado para mejor UX */
#step5::-webkit-scrollbar {
    width: 6px;
}

#step5::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

#step5::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 3px;
    transition: background 0.3s ease;
}

#step5::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* Clase para scroll suave */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* Indicador de scroll */
.scroll-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

.scroll-indicator.show {
    opacity: 1;
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
}

/* Clases para detección de overflow */
.overflow-detector.has-overflow {
    /* Estilos cuando hay overflow */
}

.dynamic-height {
    height: auto !important;
    max-height: 80vh;
}

/* Animación de typing mejorada */
.typing-animation {
    border-right: 2px solid #ffffff;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { border-color: transparent; }
    51%, 100% { border-color: #ffffff; }
}

.modern-form {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --primary-light: rgba(59, 130, 246, 0.1);
    --success: #10b981;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --bg-input: #f8fafc;
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    padding: 32px;
    background: rgba(255, 255, 255, 0.95) !important; /* Forzar fondo blanco semi-transparente */
    border-radius: 20px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 4px 16px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    font-family: 'Albert Sans', sans-serif;
}

.modern-form {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --primary-light: rgba(59, 130, 246, 0.1);
    --success: #10b981;
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --bg-input: #f8fafc;
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    padding: 32px;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 20px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 4px 16px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    font-family: 'Albert Sans', sans-serif;
}

.form-title {
    font-size: 1.8em;
    font-weight: 500;
    color: var(--text-main);
    margin: 0 0 32px;
    text-align: center;
    letter-spacing: -0.02em;
}

.input-group {
    margin-bottom: 20px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 20px;
    font-size: 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
}

.form-input::placeholder {
    color: var(--text-secondary);
    font-weight: 300;
}

.form-input:hover {
    border-color: #cbd5e1;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.submit-button {
    position: relative;
    width: 100%;
    height: 48px;
    margin-top: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Albert Sans', sans-serif;
    letter-spacing: -0.01em;
}

.submit-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(59, 130, 246, 0.25),
        0 4px 12px rgba(59, 130, 246, 0.15);
}

.submit-button:hover .button-glow {
    transform: translateX(100%);
}

.submit-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-input:not(:placeholder-shown):valid {
    border-color: var(--success);
}

.form-input:not(:placeholder-shown):invalid {
    border-color: #ef4444;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Spinner para botones de carga */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   SECCIÓN 9: LOADING SCREEN
   ============================================ */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #24378C 0%, #2C73B9 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.loading-screen.show {
    display: flex;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 450px;
    padding: 40px;
    animation: slideInUp 0.5s ease;
}

.loading-gif {
    width: 400px;
    height: 400px;
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

/* ============================================
   SECCIÓN 10: ANIMACIONES GENERALES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Responsive optimizado para scroll */
@media (max-width: 768px) {
    .gradient-background {
        width: calc(100% - 20px);
        min-height: 90vh;
        filter: blur(8px);
    }
    
    .container {
        margin: 10px;
        border-radius: 20px;
        min-height: 90vh;
    }
    
    .step {
        padding: 40px 24px;
    }
    
    .step h1 {
        font-size: 1.5em;
    }
    
    .step h2 {
        font-size: 1.6em;
    }
    
    /* Step5 móvil con scroll mejorado */
    #step5 {
        padding: 30px 24px 80px 24px;
    }
    
    .ai-response {
        padding: 24px;
        font-size: 1em;
        line-height: 1.6;
        margin: 16px 0;
        max-height: 50vh;
    }
    
    #solutionBtn {
        margin-top: 20px;
        margin-bottom: 40px;
        padding: 16px 32px;
        font-size: 1.1em;
    }
}

@media screen and (min-width: 768px) and (max-width: 1024px) {
    .gradient-background {
        width: 90%;
        min-height: 80vh;
        filter: blur(14px);
    }
    
    .container {
        max-width: 90%;
        min-height: 80vh;
    }
    
    .step {
        padding: 50px 80px;
    }
    
    .step h1 {
        font-size: 2.5em;
    }
    
    .step h2 {
        font-size: 2.4em;
    }
    
    /* Step5 iPad con scroll optimizado */
    #step5 {
        padding: 40px 60px 100px 60px;
    }
    
    .ai-response {
        padding: 40px;
        font-size: 1.1em;
        line-height: 1.7;
        max-height: 60vh;
    }
    
    #solutionBtn {
        padding: 22px 44px;
        font-size: 1.4em;
        margin-top: 32px;
        margin-bottom: 60px;
    }
}