/**
 * Archivo CSS principal del sistema
 * Diseño moderno, responsive y adaptable.
 * Creado por: RobGe
 * Actualización: 2026
 */

/* ========================================
   VARIABLES Y RESET
======================================== */

:root {
    --primary: #635bff;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;

    --secondary: #0f172a;
    --background: #f8fafc;
    --surface: #ffffff;

    --text: #1e293b;
    --text-muted: #64748b;

    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;

    --shadow-sm: 0 2px 8px rgba(15, 23, 42, .05);
    --shadow-md: 0 8px 25px rgba(15, 23, 42, .08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, .14);

    --transition: all .25s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

/* ========================================
   NAVEGACIÓN
======================================== */

nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 999;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, .8);
    box-shadow: var(--shadow-sm);
}

nav .container {
    width: 100%;
    max-width: 1280px;
    min-height: 76px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

nav .logo {
    display: flex;
    align-items: center;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -.5px;
}

.logo img {
    display: block;
    max-width: 150px;
    max-height: 55px;
    object-fit: contain;
}

nav .menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

nav .menu a {
    position: relative;
    padding: 10px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

nav .menu a:hover {
    color: var(--primary);
    background: var(--primary-light);
}

nav .hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}

nav .hamburger div {
    width: 100%;
    height: 2px;
    background: var(--secondary);
    border-radius: 5px;
    transition: var(--transition);
}

/* ========================================
   HEADER / HERO
======================================== */

header {
    position: relative;
    overflow: hidden;
    margin: 76px 0 0;
    padding: 100px 24px 85px;
    color: white;
    text-align: center;
    background:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,.15), transparent 30%),
        radial-gradient(circle at 85% 80%, rgba(255,255,255,.12), transparent 30%),
        linear-gradient(135deg, #4f46e5 0%, #635bff 50%, #2563eb 100%);
}

header h1 {
    max-width: 900px;
    margin: 0 auto;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1.5px;
}

header p {
    max-width: 650px;
    margin: 20px auto 0;
    color: rgba(255, 255, 255, .85);
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.7;
}

/* ========================================
   CONTENIDO PRINCIPAL
======================================== */

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 40px 24px;
}

section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
}

/* ========================================
   FORMULARIOS
======================================== */

.form {
    display: flex;
    width: 100%;
    max-width: 700px;
    margin: 0 auto 30px;
    gap: 10px;
}

.form input[type="email"] {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    font-size: 1rem;
    transition: var(--transition);
}

.form input[type="email"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 91, 255, .12);
}

.form input::placeholder {
    color: #94a3b8;
}

.form button {
    padding: 14px 25px;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(99, 91, 255, .2);
}

.form button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(99, 91, 255, .3);
}

.form button:active {
    transform: translateY(0);
}

/* ========================================
   LOADING
======================================== */

.loading-message {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
}

.loading-spinner {
    width: 55px;
    height: 55px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   MODALES
======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, .75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow-y: auto;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    padding: 32px;
    overflow-y: auto;
    text-align: center;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modalAppear .25s ease;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: translateY(15px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#pin-input {
    display: block;
    width: 100%;
    margin: 20px 0;
    padding: 14px 16px;
    color: var(--text);
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 4px;
    transition: var(--transition);
}

#pin-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 91, 255, .12);
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px 18px;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: .95rem;
    font-weight: 700;
    transition: var(--transition);
}

.modal-buttons button:first-child {
    background: var(--success);
}

.modal-buttons button:last-child {
    background: var(--danger);
}

.modal-buttons button:hover {
    filter: brightness(.92);
    transform: translateY(-2px);
}

/* ========================================
   VISTA PREVIA DE CORREO
======================================== */

.email-preview {
    width: 100%;
    margin-top: 25px;
    padding: 24px;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.email-preview p {
    color: var(--danger);
}

/* ========================================
   FOOTER
======================================== */

footer {
    width: 100%;
    min-height: 65px;
    padding: 18px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: #cbd5e1;
    background: #0f172a;
    text-align: center;
    font-size: .9rem;
}

footer a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

footer a:hover {
    color: white;
    text-decoration: underline;
}

/* ========================================
   RESPONSIVE: TABLETS
======================================== */

@media (max-width: 900px) {
    nav .container {
        padding: 12px 20px;
    }

    nav .menu {
        gap: 2px;
    }

    nav .menu a {
        padding: 9px 11px;
        font-size: .9rem;
    }

    header {
        padding: 85px 20px 70px;
    }

    main {
        padding: 30px 18px;
    }
}

/* ========================================
   RESPONSIVE: MÓVILES
======================================== */

@media (max-width: 768px) {

    nav .container {
        min-height: 66px;
    }

    nav .hamburger {
        display: flex;
    }

    nav .menu {
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        padding: 15px 20px 20px;
        background: rgba(255, 255, 255, .98);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
    }

    nav .menu.active {
        display: flex;
        animation: menuAppear .2s ease;
    }

    nav .menu a {
        width: 100%;
        padding: 13px 15px;
        font-size: .95rem;
    }

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

    header {
        margin-top: 66px;
        padding: 75px 20px 65px;
    }

    header h1 {
        font-size: clamp(2rem, 8vw, 2.8rem);
        letter-spacing: -.8px;
    }

    header p {
        margin-top: 15px;
        font-size: 1rem;
    }

    main {
        padding: 25px 15px;
    }

    section {
        padding: 0 5px;
    }

    .form {
        flex-direction: column;
        gap: 12px;
    }

    .form input[type="email"],
    .form button {
        width: 100%;
        min-height: 48px;
    }

    .modal-content {
        padding: 25px 20px;
    }
}

/* ========================================
   RESPONSIVE: MÓVILES PEQUEÑOS
======================================== */

@media (max-width: 480px) {

    nav .container {
        padding: 10px 16px;
    }

    .logo img {
        max-width: 125px;
        max-height: 45px;
    }

    header {
        padding: 60px 18px 55px;
    }

    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: .95rem;
    }

    main {
        padding: 20px 12px;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .modal-buttons button {
        width: 100%;
        min-height: 45px;
    }

    .email-preview {
        padding: 18px 14px;
    }

    footer {
        padding: 16px 12px;
        font-size: .82rem;
    }
}

/* ========================================
   ACCESIBILIDAD
======================================== */

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(99, 91, 255, .45);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
