/* ============================== */
/* UNIFIED TOP NAVIGATION BAR     */
/* ============================== */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light mode */
body.light .top-nav {
    background: rgba(245, 245, 247, 0.9);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* --- LEFT: Logo --- */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-logo img {
    width: 36px;
    height: 36px;
    filter: drop-shadow(0 0 12px rgba(100, 180, 255, 0.3));
}

.nav-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.02em;
}

body.light .nav-logo-text {
    color: #1a1a1a;
}

/* --- CENTER: Nav Links --- */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
    padding: 6px 14px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 20px;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.nav-links a:hover {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.08);
}

.nav-links a.active {
    color: white;
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.35), rgba(156, 39, 176, 0.35));
}

body.light .nav-links a {
    color: rgba(0, 0, 0, 0.5);
}

body.light .nav-links a:hover {
    color: rgba(0, 0, 0, 0.9);
    background: rgba(0, 0, 0, 0.06);
}

body.light .nav-links a.active {
    color: #1a1a1a;
    background: rgba(124, 77, 255, 0.12);
}

/* --- RIGHT GROUP --- */
.nav-right-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* --- Language Dropdown --- */
.nav-lang-dropdown {
    position: relative;
}

.nav-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
}

.nav-lang-trigger:hover,
.nav-lang-trigger.open {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.25);
}

.nav-lang-current-flag {
    font-size: 1.1rem;
    line-height: 1;
}

.nav-lang-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.nav-lang-trigger.open .nav-lang-arrow {
    transform: rotate(180deg);
}

.nav-lang-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 150px;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html[dir="rtl"] .nav-lang-menu {
    right: auto;
    left: 0;
}

.nav-lang-menu.open {
    display: flex;
    flex-direction: column;
}

.nav-lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    width: 100%;
    text-align: left;
}

html[dir="rtl"] .nav-lang-option {
    text-align: right;
}

.nav-lang-option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-lang-option.active {
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.3), rgba(156, 39, 176, 0.3));
    color: white;
    font-weight: 600;
}

.nav-lang-flag {
    font-size: 1rem;
    line-height: 1;
}

/* --- Auth Area --- */
.nav-auth {
    flex-shrink: 0;
}

.nav-login-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 18px;
    background: linear-gradient(135deg, #E91E63, #9C27B0);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.nav-login-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
}

/* Logged-in user info */
.nav-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 4px 4px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    cursor: default;
}

html[dir="rtl"] .nav-user-info {
    padding: 4px 4px 4px 14px;
}

.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(233, 30, 99, 0.5);
}

.nav-user-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

/* User dropdown */
.nav-user-dropdown {
    position: relative;
}

.nav-user-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px 4px 4px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    transition: background 0.2s;
}
html[dir="rtl"] .nav-user-trigger {
    padding: 4px 4px 4px 14px;
}
.nav-user-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
}

.nav-user-arrow {
    width: 12px;
    height: 12px;
    opacity: 0.5;
    transition: transform 0.2s;
}

.nav-user-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: rgba(20, 20, 35, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 0;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
html[dir="rtl"] .nav-user-menu {
    right: auto;
    left: 0;
}

.nav-user-menu.open {
    display: block;
}

.nav-user-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.88rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: start;
    font-family: inherit;
    transition: background 0.15s;
}
.nav-user-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nav-user-logout {
    color: #ef5350;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
    padding-top: 12px;
}

/* Light theme overrides */
body.light .nav-user-trigger {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}
body.light .nav-user-trigger:hover {
    background: rgba(0, 0, 0, 0.08);
}
body.light .nav-user-menu {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
body.light .nav-user-menu-item {
    color: #1a1a1a;
}
body.light .nav-user-menu-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
body.light .nav-user-logout {
    color: #d32f2f;
    border-top-color: rgba(0, 0, 0, 0.08);
}

/* --- Mobile hamburger --- */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: rgba(255, 255, 255, 0.8);
}

body.light .nav-hamburger {
    color: rgba(0, 0, 0, 0.7);
}

.nav-hamburger svg {
    width: 22px;
    height: 22px;
}

/* --- Body padding to account for fixed nav --- */
body.has-top-nav {
    padding-top: 60px;
}

/* ============================== */
/* RESPONSIVE                      */
/* ============================== */
@media (max-width: 900px) {
    .nav-links a {
        font-size: 0.78rem;
        padding: 5px 10px;
    }

    .nav-logo-text {
        display: none;
    }
}

@media (max-width: 700px) {
    .nav-hamburger {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(10, 10, 15, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding: 12px 16px;
        gap: 4px;
    }

    body.light .nav-links {
        background: rgba(245, 245, 247, 0.97);
        border-bottom-color: rgba(0, 0, 0, 0.08);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 10px 16px;
        font-size: 0.9rem;
        border-radius: 10px;
    }

    .nav-lang-menu {
        right: auto;
        left: 0;
    }

    html[dir="rtl"] .nav-lang-menu {
        left: auto;
        right: 0;
    }

    .nav-login-btn {
        padding: 5px 12px;
        font-size: 0.75rem;
    }

    .nav-user-name {
        display: none;
    }

    .nav-user-info {
        padding: 3px;
    }

    .nav-user-trigger {
        padding: 3px;
        gap: 4px;
    }

    .nav-user-arrow {
        display: none;
    }

    .nav-user-menu {
        right: -10px;
    }
    html[dir="rtl"] .nav-user-menu {
        right: auto;
        left: -10px;
    }
}

/* ============================== */
/* LOGIN MODAL (injected by nav)  */
/* ============================== */
.nav-login-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10001;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nav-login-overlay.show {
    display: flex;
}

.nav-login-modal {
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 36px 32px;
    width: 90%;
    max-width: 380px;
    position: relative;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: white;
}

body.light .nav-login-modal {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
}

.nav-login-modal h3 {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.nav-login-subtitle {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.6;
    margin-bottom: 24px;
}

.nav-login-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    line-height: 1;
}

html[dir="rtl"] .nav-login-close {
    right: auto;
    left: 16px;
}

.nav-login-close:hover {
    opacity: 1;
}

.nav-login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    font-size: 0.8rem;
    opacity: 0.5;
}

.nav-login-divider::before,
.nav-login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: currentColor;
    opacity: 0.3;
}

.nav-login-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    text-align: start;
    color: white;
    font-size: 0.95rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin-bottom: 12px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.nav-login-input:focus {
    border-color: #7C4DFF;
}

body.light .nav-login-input {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.03);
    color: #1a1a1a;
}

.nav-login-btn {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    box-sizing: border-box;
}

.nav-login-btn:hover {
    opacity: 0.9;
}

.nav-login-btn:active {
    transform: scale(0.98);
}

.nav-login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-login-btn-google {
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.nav-login-btn-google svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-login-btn-submit {
    background: linear-gradient(135deg, #7C4DFF, #9C27B0);
    color: #fff;
}

.nav-login-error {
    color: #ef5350;
    font-size: 0.82rem;
    text-align: center;
    margin-top: 8px;
    min-height: 20px;
}

.nav-login-noaccount {
    text-align: center;
    margin-top: 16px;
    font-size: 0.82rem;
    opacity: 0.6;
}

.nav-login-noaccount a {
    color: #7C4DFF;
    text-decoration: underline;
}
