/* public/assets/css/main.css */
/* Fonts loaded via <link> in header.php for better performance */

/* ====== CSS VARIABLES ====== */
:root {
    /* Brand colors — deep cobalt + warm gold academic palette */
    --primary:       #2952cc;
    --primary-dark:  #1e3ea8;
    --primary-light: #e8eeff;
    --primary-glow:  rgba(41, 82, 204, 0.15);

    /* Accent — warm academic gold */
    --accent:        #c8871a;
    --accent-light:  #fef3e2;
    --accent-glow:   rgba(200, 135, 26, 0.2);

    /* Backgrounds — warm cream paper feel */
    --bg:            #f5f2ed;
    --bg-warm:       #ede9e2;
    --surface:       #ffffff;
    --surface-warm:  #faf8f5;
    --border:        #ddd8d0;
    --border-light:  #edeae5;

    /* Text — deep ink */
    --text:          #1a1a2a;
    --text-muted:    #5c5e72;
    --text-light:    #9196ab;

    /* Status */
    --success:       #1a7a4a;
    --success-light: #e8f8ef;
    --error:         #c42b2b;
    --error-light:   #fef0f0;

    /* Dark surfaces */
    --header-bg:     #0e1c38;
    --footer-bg:     #0e1c38;
    --dark:          #0e1c38;

    /* Radius */
    --radius-xs:   0.3rem;
    --radius-sm:   0.5rem;
    --radius:      0.875rem;
    --radius-lg:   1.25rem;
    --radius-xl:   1.75rem;
    --radius-full: 9999px;

    /* Shadows — warmer, softer */
    --shadow-xs: 0 1px 3px rgba(20,20,40,0.07);
    --shadow-sm: 0 2px 8px rgba(20,20,40,0.08);
    --shadow:    0 4px 20px rgba(20,20,40,0.10);
    --shadow-lg: 0 12px 40px rgba(20,20,40,0.14);
    --shadow-xl: 0 20px 60px rgba(20,20,40,0.20);

    --header-h:  68px;
    --transition: 0.18s ease;

    /* Typography */
    --font-display: 'Plus Jakarta Sans', system-ui, sans-serif; /* headings */
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
}

/* ====== RESET & BASE ====== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-padding-top: var(--header-h);
    background-color: #0e1c38; /* = color del header/footer: cualquier flash se funde con ellos */
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}


a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ====== STICKY FOOTER LAYOUT ====== */
.main-header,
.main-footer {
    flex-shrink: 0;
}

.main-content {
    flex: 1 0 auto;
    padding-top: var(--header-h);
}

/* ====== CONTAINER ====== */
.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ====== HEADER ====== */
.main-header {
    background-color: var(--header-bg);
    color: #f0eee8;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 24px rgba(0,0,0,0.3);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 0.4rem 0;
}

/* Logo */
.logo-img {
    height: 62px;
    width: auto;
    display: block;
}

@media (max-width: 768px) {
    .logo-img {
        height: 48px;
    }
}

.logo a {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #f0eee8;
    display: flex;
    align-items: center;
    gap: 0.05em;
    line-height: 1;
}

.logo-accent {
    color: #e8a53a;
}

/* Nav */
.main-nav {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
    gap: 0.15rem;
    margin-left: 1.5rem;
}

.main-nav a {
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(240,238,232,0.75);
    transition: color var(--transition), background-color var(--transition);
    letter-spacing: 0.01em;
}

.main-nav a:hover {
    background-color: rgba(240,238,232,0.1);
    color: #f0eee8;
}

/* Active nav link */
.main-nav a.is-active {
    background-color: rgba(232,165,58,0.18);
    color: #e8a53a;
    font-weight: 600;
}

.main-nav a.is-active:hover {
    background-color: rgba(232,165,58,0.25);
}

/* Separador visual entre nav links y acciones de usuario */
.nav-divider {
    width: 1px;
    height: 1.25rem;
    background: rgba(240,238,232,0.15);
    margin: 0 0.5rem;
    flex-shrink: 0;
}

/* Nav primary button — mismo aspecto que el resto de enlaces del nav */
.btn-nav-primary {
    background: transparent !important;
    color: rgba(240,238,232,0.82) !important;
    font-weight: 500 !important;
    padding: 0.45rem 1.1rem !important;
    border-radius: var(--radius-full) !important;
    transition: background var(--transition), color var(--transition) !important;
    letter-spacing: 0.01em !important;
}

.btn-nav-primary:hover {
    background: rgba(240,238,232,0.09) !important;
    color: rgba(240,238,232,0.98) !important;
    transform: none !important;
}

/* ====== NAV DROPDOWN ====== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full);
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(240, 238, 232, 0.82);
    letter-spacing: 0.01em;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}

.nav-dropdown-trigger:hover,
.nav-dropdown.is-open .nav-dropdown-trigger,
.nav-dropdown-trigger:focus-visible {
    background-color: rgba(240, 238, 232, 0.1);
    color: #f0eee8;
}

.nav-dropdown.is-active .nav-dropdown-trigger {
    background-color: rgba(232, 165, 58, 0.18);
    color: #e8a53a;
}

.nav-dropdown-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    opacity: 0.75;
}

.nav-dropdown.is-open .nav-dropdown-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    min-width: 240px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
    z-index: 200;
    /* Animation */
    opacity: 0;
    transform: translateX(-50%) translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.nav-dropdown.is-open .nav-dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.nav-dropdown-item {
    display: block;
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text) !important;
    background: transparent;
    text-decoration: none;
    border-radius: 0;
    transition: background var(--transition), color var(--transition), padding-left var(--transition);
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary-dark) !important;
    padding-left: 1.4rem;
}

/* Item de cerrar sesión en el dropdown */
.nav-dropdown-item--logout {
    color: #c42b2b !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-dropdown-item--logout:hover {
    background: #fef0f0 !important;
    color: #a01f1f !important;
    padding-left: 1.4rem;
}

.nav-dropdown-item.is-current {
    color: var(--primary) !important;
    font-weight: 600;
    background: var(--primary-light);
}

/* Separador visual entre items */
.nav-dropdown-menu li + li .nav-dropdown-item {
    border-top: 1px solid var(--border-light);
}

/* ── Responsive: dropdown en móvil ── */
@media (max-width: 768px) {
    .nav-dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--border-light);
        border-radius: var(--radius);
        min-width: unset;
        width: 100%;
        margin-top: 0.25rem;
    }

    .nav-dropdown.is-open .nav-dropdown-menu {
        transform: none;
    }

    .nav-dropdown-trigger {
        width: 100%;
        justify-content: space-between;
    }
}

/* ====== BUTTONS ====== */
.btn-primary,
.btn-secondary,
.btn-dark,
.btn-danger,
.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    border: none;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(41,82,204,0.35);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(41,82,204,0.42);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--surface-warm);
    border-color: #c8c4bc;
    transform: translateY(-1px);
}

.btn-dark {
    background-color: var(--dark);
    color: #f0eee8;
}

.btn-dark:hover {
    background-color: #182f5e;
    transform: translateY(-1px);
}

.btn-danger {
    background: #c42b2b;
    color: #fff;
    box-shadow: 0 2px 8px rgba(196,43,43,0.3);
}

.btn-danger:hover {
    background: #9e1f1f;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(196,43,43,0.38);
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-outline {
    border: 1.5px solid var(--border);
    background-color: transparent;
    color: var(--text-muted);
}

.btn-outline:hover {
    background-color: var(--surface-warm);
    border-color: #a09890;
}

.btn-outline.disabled {
    cursor: default;
    opacity: 0.6;
    pointer-events: none;
}

/* ====== HERO (global base) ====== */
.hero {
    padding: 4rem 0 3rem;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 0.85rem;
    letter-spacing: -0.02em;
    line-height: 1.18;
}

.hero p {
    max-width: 600px;
    margin-bottom: 1.75rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* ====== FEATURES ====== */
.features {
    padding: 3rem 0 4rem;
}

.features-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.feature-card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.feature-card h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.65;
}

/* ====== FOOTER ====== */
.main-footer {
    background-color: var(--footer-bg);
    color: rgba(240,238,232,0.6);
    font-size: 0.875rem;
    padding: 1.5rem 0;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.footer-copy {
    color: rgba(240,238,232,0.4);
    font-size: 0.8rem;
}

.footer-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-nav a {
    color: rgba(240,238,232,0.5);
    font-size: 0.8rem;
    transition: color var(--transition);
}

.footer-nav a:hover {
    color: rgba(240,238,232,0.9);
}

/* ── Contáctanos ─────────────────────────────────────── */
.footer-contact {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.footer-contact-label {
    color: rgba(240,238,232,0.5);
    font-size: 0.8rem;
    white-space: nowrap;
}

.footer-contact-icons {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(240,238,232,0.15);
    background: rgba(240,238,232,0.07);
    color: rgba(240,238,232,0.55);
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    text-decoration: none;
    padding: 0;
}

.footer-icon-btn svg {
    width: 17px;
    height: 17px;
    display: block;
}

.footer-icon-btn:hover {
    background: rgba(200,135,26,0.18);
    border-color: rgba(200,135,26,0.45);
    color: #e8a53a;
}

/* ── Popup contacto email ─────────────────────────────── */
#contact-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9990;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#contact-overlay.is-visible {
    display: flex;
}

#contact-modal {
    background: #fff;
    border-radius: 14px;
    width: min(95vw, 460px);
    padding: 1.75rem 1.5rem 1.5rem;
    box-shadow: 0 20px 56px rgba(0,0,0,.22);
    position: relative;
    max-height: 92vh;
    overflow-y: auto;
}

#contact-modal-close {
    position: absolute;
    top: 0.9rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

#contact-modal-close:hover { color: #374151; }

#contact-modal h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.25rem;
}

#contact-modal h2 svg {
    width: 20px;
    height: 20px;
    color: #2952cc;
    flex-shrink: 0;
}

.contact-modal-subtitle {
    font-size: 0.82rem;
    color: #6b7280;
    margin: 0 0 1.25rem;
}

.contact-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.9rem;
}

.contact-form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #374151;
}

.contact-form-group input,
.contact-form-group textarea {
    border: 1.5px solid #ddd8d0;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    color: #1f2937;
    background: #faf8f5;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.contact-form-group input:focus,
.contact-form-group textarea:focus {
    border-color: #2952cc;
    background: #fff;
}

.contact-submit {
    width: 100%;
    padding: 0.75rem;
    background: #2952cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 0.25rem;
}

.contact-submit:hover:not(:disabled) { background: #1e3ea8; }
.contact-submit:disabled { opacity: 0.65; cursor: not-allowed; }

.contact-msg {
    font-size: 0.85rem;
    padding: 0.6rem 0.8rem;
    border-radius: 7px;
    margin-bottom: 0.9rem;
}

.contact-msg.hidden {
    display: none;
}

.contact-msg--error {
    background: #fef0f0;
    color: #c42b2b;
    border: 1px solid #f9c0c0;
}

.contact-msg--success {
    background: #e8f8ef;
    color: #1a7a4a;
    border: 1px solid #b0e8cb;
}

/* Responsive footer contact */
@media (max-width: 600px) {
    .footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.75rem;
    }
    .footer-contact {
        flex-direction: column;
        gap: 0.4rem;
    }
}

/* ====== FORM CARD ====== */
.form-page {
    padding: 3rem 0;
}

.form-card {
    max-width: 440px;
    margin: 0 auto;
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.form-card h1 {
    font-family: var(--font-display);
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-family: var(--font-body);
    font-size: 0.9rem;
    background: var(--surface-warm);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
}

.form-helper {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.form-helper a {
    color: var(--primary);
    font-weight: 600;
}

.form-helper a:hover {
    text-decoration: underline;
}

/* ====== ALERTS ====== */
.alert {
    margin-bottom: 1rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    line-height: 1.5;
}

.alert-dismissible {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.alert-dismissible span {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    color: inherit;
    opacity: 0.6;
    flex-shrink: 0;
    margin-top: 0.05rem;
    transition: opacity 0.15s;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background-color: var(--success-light);
    color: #145c38;
    border: 1px solid #b6e8d1;
}

.alert-error {
    background-color: var(--error-light);
    color: #8b1e1e;
    border: 1px solid #f5c0c0;
}

/* ====== LOGOUT MODAL ====== */
.logout-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
    padding: 1rem;
}

.logout-modal-overlay.is-visible {
    display: flex;
}

.logout-modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: min(92vw, 440px);
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border);
}

.logout-modal h2 {
    margin: 0 0 0.5rem;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
}

.logout-modal p {
    margin: 0 0 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.logout-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.logout-modal-actions .btn-primary,
.logout-modal-actions .btn-dark,
.logout-modal-actions .btn-danger,
.logout-modal-actions .btn-secondary,
.logout-modal-actions .btn-outline,
.logout-modal-actions a.btn-primary {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .logout-modal {
        padding: 1.5rem 1.25rem;
    }

    .logout-modal-actions {
        flex-direction: column-reverse;
        gap: 0.6rem;
    }

    .logout-modal-actions .btn-primary,
    .logout-modal-actions .btn-dark,
    .logout-modal-actions .btn-danger,
    .logout-modal-actions .btn-secondary,
    .logout-modal-actions .btn-outline,
    .logout-modal-actions a.btn-primary {
        width: 100%;
        flex: none;
        justify-content: center;
    }
}

/* ====== AUTH MODAL (login/register) ====== */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9100;
    background: rgba(14, 28, 56, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: authOverlayIn 0.2s ease;
}

.auth-modal-overlay.hidden {
    display: none;
}

@keyframes authOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.auth-modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: authModalIn 0.25s ease;
    border: 1px solid var(--border-light);
    position: relative;
}

.auth-modal__close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.auth-modal__close:hover {
    background: var(--bg);
    color: var(--text);
}

@keyframes authModalIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal__brand {
    text-align: center;
}

.auth-modal__logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.auth-modal__logo .logo-accent {
    color: var(--accent);
}

.auth-modal__tabs {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-full);
    padding: 0.25rem;
    gap: 0.25rem;
}

.auth-tab {
    flex: 1;
    padding: 0.55rem 1rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.auth-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.auth-tab:not(.active):hover {
    color: var(--text);
    background: rgba(255,255,255,0.6);
}

.auth-panel {
    display: none;
    flex-direction: column;
    gap: 0.85rem;
}

.auth-panel.active {
    display: flex;
}

.auth-error {
    background: var(--error-light);
    color: #8b1e1e;
    border: 1px solid #f5c0c0;
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.auth-error.hidden {
    display: none;
}

.auth-panel .form-group {
    margin-bottom: 0;
}

.auth-submit {
    width: 100%;
    margin-top: 0.25rem;
}

/* ── Password visibility toggle ─────────────────────────────────── */
.pw-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.pw-wrapper input[type="password"],
.pw-wrapper input[type="text"] {
    width: 100%;
    padding-right: 2.6rem;
}

.pw-toggle {
    position: absolute;
    right: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
}

.pw-toggle:hover { color: var(--text); }
.pw-toggle svg { width: 18px; height: 18px; display: block; }

.auth-hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.auth-hint a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.auth-hint a:hover {
    color: var(--primary-dark);
}

.auth-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.auth-success__icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--success-light);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-success h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.auth-success p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.auth-modal__divider {
    height: 1px;
    background: var(--border-light);
    border: none;
    margin: 0;
}

.auth-small-note {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.5;
}

.auth-small-note a {
    color: var(--text-muted);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .auth-modal {
        padding: 1.5rem 1.25rem;
    }
}

/* ====== COOKIE MODAL ====== */
#cookie-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(14, 28, 56, 0.70);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 1;
    transition: opacity 0.2s ease;
}

#cookie-overlay.hidden {
    display: none;
}

#cookie-modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    animation: cookieFadeIn 0.25s ease;
    border: 1px solid var(--border-light);
}

@keyframes cookieFadeIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cookie-modal__header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.cookie-modal__icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.cookie-modal__title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.15rem;
    letter-spacing: -0.01em;
}

.cookie-modal__subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.cookie-modal__body {
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--text-muted);
    margin: 0;
}

.cookie-modal__body strong {
    color: var(--text);
}

.cookie-modal__body a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.cookie-modal__body a:hover {
    color: var(--primary-dark);
}

.cookie-modal__benefits {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.65rem;
    padding: 0.75rem 1rem;
}

.cookie-benefit {
    font-size: 0.8rem;
    color: #166534;
    font-weight: 500;
}

.cookie-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cookie-btn-accept {
    width: 100%;
    padding: 0.8rem 1.25rem;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 14px rgba(41,82,204,0.35);
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    letter-spacing: 0.01em;
}

.cookie-btn-accept:hover  { background: var(--primary-dark); box-shadow: 0 4px 18px rgba(41,82,204,0.45); }
.cookie-btn-accept:active { transform: scale(0.98); }

.cookie-btn-essential {
    width: 100%;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 400;
    background: transparent;
    color: var(--text-light);
    transition: color var(--transition);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-btn-essential:hover {
    color: var(--text-muted);
}

.cookie-modal__note {
    font-size: 0.72rem;
    color: var(--text-light);
    text-align: center;
    margin: 0;
}

/* ====== HAMBURGER BUTTON ====== */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s;
}
.nav-hamburger:hover { background: rgba(240,238,232,0.1); }
.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #f0eee8;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.2s;
    transform-origin: center;
}
.nav-hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-active span:nth-child(2) { opacity: 0; }
.nav-hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay oscuro detrás del menú móvil */
.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}
.nav-overlay.is-visible { display: block; }

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .nav-hamburger { display: flex; }

    .header-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 0;
    }

    /* Separador vertical: solo desktop */
    .nav-divider { display: none; }

    /* Menú móvil: panel lateral desde la derecha */
    .main-nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 270px;
        height: 100dvh;
        justify-content: flex-start; /* items arriba, no heredar flex-end del desktop */
        flex: none;                  /* anular el flex:1 del desktop */
        background: #0e1c38;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 4rem 1rem 2rem;
        z-index: 999;
        transition: right 0.28s ease;
        overflow-y: auto;
        box-shadow: -4px 0 24px rgba(0,0,0,0.35);
    }
    .main-nav.is-open { right: 0; }

    /* Badge de racha: primero en el panel móvil */
    .main-nav .streak-badge {
        order: -1;
        margin-bottom: 0.5rem;
        align-self: flex-start;
        font-size: 0.85rem;
    }

    .main-nav a {
        font-size: 1rem;
        padding: 0.75rem 1rem;
        border-radius: 0.5rem;
        color: rgba(240,238,232,0.85);
    }
    .main-nav a:hover { background: rgba(240,238,232,0.08); color: #f0eee8; }
    .main-nav a.is-active { background: rgba(232,165,58,0.15); color: #e8a53a; }

    .btn-nav-primary {
        margin-top: 0.5rem;
        justify-content: center;
        width: 100%;
    }

    /* Dropdown en móvil: se queda en el panel lateral */
    .nav-dropdown-menu {
        position: static !important;
        transform: none !important;
        min-width: unset !important;
        box-shadow: none !important;
        border: none !important;
        background: rgba(255,255,255,0.05) !important;
        border-radius: 0.5rem;
        margin: 0.25rem 0 0 0.5rem;
        padding: 0.25rem 0;
    }
    .nav-dropdown-item {
        color: rgba(240,238,232,0.75) !important;
        font-size: 0.875rem;
        padding: 0.55rem 1rem !important;
        white-space: normal;   /* permite que el texto rompa línea en móvil */
        word-break: break-word;
    }
    .nav-dropdown-item:hover { background: rgba(240,238,232,0.08) !important; color: #f0eee8 !important; }
    .nav-dropdown-trigger { width: 100%; justify-content: space-between; }

    .hero {
        padding: 2.5rem 0 2rem;
        text-align: center;
    }

    .hero p {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-actions .btn-primary,
    .hero-actions .btn-secondary {
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 520px) {
    .container {
        padding: 0 1rem;
    }

    .form-card {
        padding: 1.5rem 1.25rem;
    }

    #cookie-modal {
        padding: 1.5rem 1.25rem;
    }
}

/* ── Fix zoom iOS Safari: inputs con font-size < 16px provocan zoom ── */
@media (max-width: 768px) {
    input, select, textarea,
    .form-group input,
    .form-group select,
    .form-group textarea,
    .auth-modal input,
    .auth-modal select {
        font-size: 16px !important;
    }
}


/* ══════════════════════════════════════════════════════════════
   RACHA DE DÍAS (streak)
   ══════════════════════════════════════════════════════════════ */

/* ── Indicador en el header ─────────────────────────────────── */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    /* Fondo neutro + borde dorado — mismo pill que el nav activo pero color distinto */
    background: rgba(240, 238, 232, 0.08);
    border: 1px solid rgba(232, 165, 58, 0.45);
    color: rgba(240, 238, 232, 0.88);   /* texto blanco cálido */
    font-family: var(--font-display);
    font-size: 0.875rem;                /* idéntico al nav */
    font-weight: 600;
    padding: 0.45rem 1.1rem 0.45rem 0.85rem; /* mismo alto que nav, ligero ajuste izq para el icono */
    border-radius: var(--radius-full);  /* idéntico al nav */
    cursor: default;
    transition: background var(--transition), border-color var(--transition);
    white-space: nowrap;
    line-height: 1;
    letter-spacing: 0.01em;
}
.streak-badge:hover {
    background: rgba(240, 238, 232, 0.13);
    border-color: rgba(232, 165, 58, 0.7);
}
/* Icono en dorado, claramente distinto del texto blanco */
.streak-icon {
    flex-shrink: 0;
    display: block;
    color: #e8a53a;
}
.streak-badge .streak-days {
    letter-spacing: 0.01em;
}

/* ── Popup de hito ──────────────────────────────────────────── */
#streak-milestone-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 40, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    padding: 1rem;
}
#streak-milestone-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}
#streak-milestone-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem 2rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    position: relative;
    animation: streakPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes streakPopIn {
    from { transform: scale(0.75) translateY(20px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
#streak-milestone-card .streak-milestone-emoji {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 0.75rem;
    display: block;
}
#streak-milestone-card h2 {
    font-family: var(--font-display);
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 0.5rem;
}
#streak-milestone-card .streak-milestone-sub {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0 0 1.75rem;
    line-height: 1.5;
}
#streak-milestone-card .streak-milestone-days {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 900;
    border-radius: var(--radius);
    padding: 0.5rem 1.5rem;
    margin-bottom: 1.75rem;
    letter-spacing: -0.02em;
}
#streak-milestone-close {
    display: block;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}
#streak-milestone-close:hover {
    background: #a96d0f;
    transform: translateY(-1px);
}

@media (max-width: 520px) {
    .streak-badge { font-size: 0.77rem; padding: 0.25rem 0.5rem; }
    #streak-milestone-card { padding: 2rem 1.25rem; }
    #streak-milestone-card h2 { font-size: 1.3rem; }
    #streak-milestone-card .streak-milestone-days { font-size: 1.8rem; }
}
