/* ===== NAV ===== */
.site-nav {
    background: var(--nav-bg, rgba(255, 255, 255, 0.8));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 10000;
    border-bottom: 1px solid var(--nav-border, #e2e8f0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: background 0.3s, border 0.3s;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    max-width: 1536px;
    margin: 0 auto;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.nav-logo-icon {
    color: #F6BC00;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-logo-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--nav-text, #1e293b);
    line-height: 1;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.nav-links-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 1;
}

.nav-utils-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--nav-border, #e2e8f0);
    margin-left: 0.25rem;
    flex-shrink: 0;
}

.nav-link {
    color: var(--text-p, #475569);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.4rem 0.65rem;
    border-radius: 9999px;
    transition: all 0.25s;
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-link:hover {
    color: #4f46e5;
    background: #eef2ff;
    border-color: #c7d2fe;
}

.nav-link.active {
    color: #4f46e5;
    background: #eef2ff;
    border-color: #c7d2fe;
    font-weight: 600;
}

/* Theme Toggle Btn */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--nav-border, #e2e8f0);
    color: var(--nav-text, #1e293b);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    width: 38px;
    height: 38px;
}

.theme-toggle-btn:hover {
    background: var(--pill-bg, rgba(0, 0, 0, 0.05));
    transform: scale(1.1);
}

/* ===== HAMBURGER MENU ===== */
.hamburger-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 101;
}

.hamburger-btn span {
    width: 24px;
    height: 2px;
    background: var(--nav-text, #1e293b);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-btn.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== RESPONSIVE NAV ===== */
@media (max-width: 1280px) {
    .nav-inner {
        padding: 0.75rem 0.75rem;
    }

    .nav-links {
        gap: 0.35rem;
    }

    .nav-links-group {
        gap: 0.2rem;
    }

    .nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }

    .nav-logo-text {
        font-size: 1.1rem;
    }
}

/* ===== BACKDROP OVERLAY ===== */
.nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 1100px) {
    .hamburger-btn {
        display: flex;
    }

    .nav-inner {
        flex-wrap: nowrap;
        position: relative;
    }

    .nav-links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        background: var(--nav-bg, rgba(255, 255, 255, 0.98));
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--nav-border, #e2e8f0);
        box-shadow: 0 20px 30px -5px rgba(0, 0, 0, 0.15), 0 10px 15px -5px rgba(0, 0, 0, 0.08);
        padding: 1rem 1.25rem 1.5rem;
        gap: 0.5rem;
        max-height: calc(100vh - 70px);
        max-height: calc(100dvh - 70px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1001;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-12px);
        transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s;
    }

    .nav-links.open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .nav-links-group {
        flex-direction: column;
        width: 100%;
        gap: 0.4rem;
        align-items: stretch;
    }

    .nav-utils-group {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
        border-top: 1px solid var(--nav-border, #e2e8f0);
        padding-top: 1rem;
        margin-top: 0.75rem;
        gap: 0.75rem;
    }

    .nav-link {
        width: 100%;
        text-align: left;
        padding: 0.7rem 1rem;
        border-radius: 0.75rem;
        font-size: 0.92rem;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .btn-quiz-nav span:last-child {
        display: none;
    }

    .btn-quiz-nav::after {
        content: 'Quiz';
    }
}

/* ===== DARK MODE NAV OVERRIDES ===== */
body.dark-mode .nav-logo-icon svg {
    color: #ffffff;
}

body.dark-mode .nav-logo-text {
    color: #ffffff;
}

body.dark-mode .nav-link:hover {
    color: #c7d2fe;
    background: rgba(79, 70, 229, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
}

body.dark-mode .theme-toggle-btn {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== FOOTER PADRONIZADO ===== */
.site-footer {
    background: transparent;
    border-top: 1px solid var(--nav-border, #e2e8f0);
    margin-top: 2rem;
    padding: 2rem 0;
    transition: background 0.3s, border 0.3s;
}

.site-footer-inner {
    text-align: center;
    padding: 0 1rem;
}

.site-footer-brand {
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.site-footer-brand a {
    color: var(--accent-gold, #D4AF37);
    text-decoration: none;
    font-weight: 600;
}

.site-footer-copy {
    color: var(--text-muted, #64748b);
    font-size: 0.7rem;
    margin: 0;
}

/* ===== FOOTER REF ===== */
.footer-ref {
    max-width: 600px;
    margin: 4rem auto 0 auto;
    padding: 1.5rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.footer-ref:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.3);
}

.footer-ref strong {
    color: #D4AF37;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.footer-ref strong::before,
.footer-ref strong::after {
    content: '';
    height: 1px;
    width: 24px;
    background: rgba(212, 175, 55, 0.3);
}

.footer-ref em {
    color: #f8fafc;
    font-style: italic;
    font-weight: 500;
}

/* ===== BUTTONS (Quiz, Memoria) ===== */
.btn-quiz-nav,
.btn-mem-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 1.25rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
}

.btn-quiz-nav:hover,
.btn-mem-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
    color: white;
}

/* Dark Mode Overrides for Buttons */
body.dark-mode .btn-quiz-nav,
body.dark-mode .btn-mem-nav {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

body.dark-mode .btn-quiz-nav:hover,
body.dark-mode .btn-mem-nav:hover {
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

/* Dark Mode Variables for Nav */
body.dark-mode {
    --nav-bg: rgba(11, 15, 26, 0.9);
    --nav-text: #f1f5f9;
    --nav-border: rgba(255, 255, 255, 0.1);
    --text-p: #cbd5e1;
}

body.dark-mode .hamburger-btn span {
    background: var(--nav-text);
}

/* ===== DROPDOWN NAV NATIVO ===== */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.nav-dropdown-btn svg {
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    min-height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    transition: transform 0.2s ease;
    display: inline-block;
    vertical-align: middle;
}

.nav-dropdown:hover .nav-dropdown-btn svg,
.nav-dropdown.open .nav-dropdown-btn svg {
    transform: rotate(180deg);
}

/* Ponte transparente de hover para Desktop */
@media (min-width: 1101px) {
    .nav-dropdown::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: 14px;
    }

    .nav-dropdown-menu {
        position: absolute !important;
        top: calc(100% + 6px) !important;
        right: 0 !important;
        left: auto !important;
        transform: none !important;
        display: none;
        flex-direction: column;
        background: #0f172a !important;
        border: 1px solid rgba(245, 158, 11, 0.3) !important;
        border-radius: 0.75rem;
        padding: 0.4rem;
        min-width: 190px;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.8) !important;
        z-index: 99999 !important;
    }

    .nav-dropdown:hover .nav-dropdown-menu {
        display: flex !important;
    }
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #f59e0b !important;
    text-decoration: none !important;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
}

.nav-dropdown-item.active {
    background: rgba(245, 158, 11, 0.25) !important;
    color: #fbbf24 !important;
}

.nav-dropdown-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #f59e0b;
    flex-shrink: 0;
}

/* Modo Escuro */
body.dark-mode .nav-dropdown-menu {
    background: #0b0f19 !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

/* Dropdown Mobile (Telas ≤ 1100px) */
@media (max-width: 1100px) {
    .nav-dropdown {
        width: 100%;
        text-align: left;
    }

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

    .nav-dropdown-menu {
        position: static !important;
        width: 100% !important;
        box-shadow: none !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        background: rgba(15, 23, 42, 0.85) !important;
        margin-top: 0.4rem;
        border-radius: 0.75rem;
        padding: 0.35rem;
        display: none;
        flex-direction: column;
        gap: 0.25rem;
    }

    .nav-dropdown.open .nav-dropdown-menu {
        display: flex !important;
    }

    .nav-dropdown-item {
        justify-content: flex-start;
        padding: 0.6rem 0.8rem;
    }
}