/* ================= VARIABLES ================= */
:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-gradient: linear-gradient(135deg, #EEF2FF 0%, #C7D2FE 100%);
    --text-main: #111827;
    --text-muted: #6B7280;
    --white: #FFFFFF;
    --radius-lg: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

a {
    text-decoration: none;
}

/* ================= BASE ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    /* ✅ CORRECCIÓN MÓVIL: Usar dvh para viewport dinámico */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ================= HEADER ================= */
header {
    padding: 1.5rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    position: relative;
    z-index: 10;
    /* ✅ Evitar que el header empuje el contenido en móviles */
    flex-shrink: 0;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
    cursor: pointer;
    user-select: none;
}

/* ================= HERO / MAIN ================= */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    /* ✅ Asegurar centrado vertical correcto en todos los dispositivos */
    min-height: 0;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 2.5rem;
    font-weight: 300;
    line-height: 1.6;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ================= BOTONES ================= */
.btn {
    padding: 0.875rem 2rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.btn-primary:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: var(--white);
    color: var(--text-main);
    box-shadow: var(--shadow-soft);
    border: 1px solid #E5E7EB;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-block { width: 100%; margin-top: 1.5rem; }

/* ================= MODALES ================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
    opacity: 0; visibility: hidden;
    transition: var(--transition);
    padding: 1rem;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-card {
    background: var(--white);
    width: 100%; max-width: 480px;
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: var(--transition);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 95vh; overflow-y: auto;
}

.modal-overlay.active .modal-card { transform: scale(1) translateY(0); }

.close-btn {
    position: absolute; top: 1rem; right: 1.5rem;
    font-size: 1.75rem; color: var(--text-muted);
    cursor: pointer; transition: var(--transition);
    line-height: 1; width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}
.close-btn:hover { color: var(--text-main); background: #F3F4F6; }

.modal-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; text-align: center; }
.modal-subtitle { font-size: 0.875rem; color: var(--text-muted); text-align: center; margin-bottom: 2rem; }

/* ================= FORMULARIOS ================= */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block; font-size: 0.875rem; font-weight: 600;
    margin-bottom: 0.5rem; color: var(--text-main);
}

.form-control, .form-select {
    width: 100%; padding: 0.75rem 1rem;
    border: 2px solid #E5E7EB; border-radius: var(--radius-sm);
    font-size: 1rem; transition: var(--transition);
    background: #F9FAFB; font-family: inherit;
}

.form-control:focus, .form-select:focus {
    outline: none; border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 1rem center;
    background-size: 16px 12px; padding-right: 2.5rem; cursor: pointer;
}

.pin-input {
    letter-spacing: 0.75rem; font-weight: 600;
    text-align: center; font-size: 1.25rem;
}

.switch-modal {
    text-align: center; margin-top: 1.5rem;
    font-size: 0.875rem; color: var(--text-muted);
}
.switch-modal a {
    color: var(--primary); text-decoration: none; font-weight: 600;
}
.switch-modal a:hover { text-decoration: underline; color: var(--primary-hover); }

/* ================= ALERTAS ================= */
.alert-custom {
    position: fixed; top: 1rem; right: 1rem;
    z-index: 1100; max-width: 350px;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.form-help { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; display: block; }

/* ================= SCROLLBAR ================= */
.modal-card::-webkit-scrollbar { width: 6px; }
.modal-card::-webkit-scrollbar-track { background: #F1F5F9; border-radius: 3px; }
.modal-card::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

/* ================= RESPONSIVE ================= */
@media (min-width: 1440px) { 
    main { padding: 3rem 5%; } 
    .hero-title { font-size: clamp(3rem, 4vw, 5rem); } 
}

@media (max-width: 768px) { 
    header { padding: 1rem 5%; } 
    .logo { font-size: 1.5rem; } 
    .modal-card { padding: 2rem 1.5rem; }
    /* ✅ Ajuste específico para móviles: reducir margen superior del main */
    main { padding-top: 1rem; padding-bottom: 1rem; }
}

@media (max-width: 480px) { 
    .btn-group { flex-direction: column; width: 100%; max-width: 320px; } 
    .btn { width: 100%; }
    /* ✅ Asegurar que el título no se corte en pantallas muy pequeñas */
    .hero-title { font-size: clamp(2rem, 8vw, 3rem); }
    .hero-subtitle { font-size: 1rem; margin-bottom: 2rem; }
}

@media (prefers-reduced-motion: reduce) { 
    *, *::before, *::after { 
        animation-duration: 0.01ms !important; 
        transition-duration: 0.01ms !important; 
    } 
}