.navbar {
    width: 100%;
    height: var(--nav-height);
    position: fixed;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 3rem;
    background: linear-gradient(
        to bottom,
        rgba(9, 9, 11, 0.9) 0%,
        rgba(9, 9, 11, 0) 100%
    );
    transition: background 0.3s;
}

.navbar.scrolled {
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-brand {
    font-weight: 900;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    letter-spacing: -0.5px;
    min-width: 200px;
    color: white;
    text-decoration: none;
    cursor: pointer;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-icon img {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.nav-center {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-button {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-button:hover {
    color: white;
}
.nav-button.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-wrapper {
    position: relative;
    width: 300px;
    z-index: 2000;
}
.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    border-radius: 99px;
    color: white;
    font-family: inherit;
    transition: 0.2s;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary-glow);
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-text-secondary);
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    border-radius: 99px;
    color: white;
    font-family: inherit;
    transition: 0.2s;
}

.search-input:focus {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary-glow);
    border-radius: 12px 12px 0 0;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-text-secondary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 15, 18, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 0.5rem;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-height: 400px;
    overflow-y: auto;
}

.nav-user {
    position: relative;
    display: flex;
    align-items: center;
}

.user-avatar-btn {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.user-avatar-btn:hover {
    transform: scale(1.05);
}

#nav-avatar {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    background: var(--color-bg-elevated);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 0 var(--color-primary-glow);
}

.user-avatar-btn:hover #nav-avatar {
    box-shadow: 0 0 0 4px var(--color-primary-glow);
    border-color: #a78bfa;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border: 2px solid var(--color-bg-base);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: rgba(18, 18, 21, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0;
    min-width: 260px;
    display: none;
    flex-direction: column;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(139, 92, 246, 0.1);
    z-index: 9999;
    overflow: hidden;
    animation: dropdownSlide 0.2s ease-out;
}

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

.nav-dropdown.active {
    display: flex;
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(139, 92, 246, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--color-primary);
    background: var(--color-bg-elevated);
}

.dropdown-user-info {
    flex: 1;
    overflow: hidden;
}

.dropdown-username {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.dropdown-status {
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown-status::before {
    content: "";
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.dropdown-item svg {
    flex-shrink: 0;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    padding-left: 20px;
}

.dropdown-item:hover svg {
    color: var(--color-primary);
    transform: translateX(2px);
}

.dropdown-item:active {
    transform: scale(0.98);
}

.logout-item {
    color: #ef4444;
    margin-top: 4px;
}

.logout-item svg {
    color: #ef4444;
}

.logout-item:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.logout-item:hover svg {
    color: #f87171;
    transform: translateX(2px);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.search-results.active {
    display: flex;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-poster {
    width: 40px;
    height: 56px;
    border-radius: 4px;
    object-fit: cover;
    background: #222;
}

.search-info {
    flex: 1;
    overflow: hidden;
}

.search-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text-primary);
}

.search-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.rating-pill {
    color: #4ade80;
    font-weight: 700;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}
.search-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
        height: 60px;
        gap: 0.5rem;

        z-index: 1002;
        background: rgba(9, 9, 11, 0.95);
    }

    .nav-brand {
        min-width: auto;
        font-size: 0;
    }

    .brand-icon {
        width: 32px;
        height: 32px;
    }

    .search-wrapper {
        flex: 1;
        width: auto;
    }

    .search-input {
        padding: 0.5rem 1rem 0.5rem 2.2rem;
        font-size: 0.9rem;
    }

    .search-icon {
        left: 10px;
    }

    #nav-avatar {
        width: 32px;
        height: 32px;
    }

    .nav-center {
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;

        display: flex;
        background: rgba(9, 9, 11, 0.98);
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        padding: 0.5rem 1rem;

        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
        gap: 0.5rem;

        -ms-overflow-style: none;
        scrollbar-width: none;
        z-index: 1001;

        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

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

    .nav-button {
        flex-shrink: 0;
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-button.active {
        background: var(--color-primary);
        border-color: var(--color-primary);
    }

    .search-results {
        position: fixed;
        top: 110px;
        left: 0;
        right: 0;
        width: 100vw;
        border-radius: 0;
        max-height: calc(100vh - 120px);
    }

    .nav-dropdown {
        position: fixed;
        top: 70px;
        right: 1rem;
        left: 1rem;
        width: auto;
        min-width: auto;
        z-index: 9999;
    }
}
