/* Navigation */
.navbar {
    background-color: var(--card-bg);
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease;
    backdrop-filter: blur(10px);
    background-color: rgba(22, 33, 62, 0.95);
}

.navbar.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.navbar.hidden {
    transform: translateY(-100%);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.logo a {
    color: var(--primary-color);
    text-decoration: none;
}

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

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.nav-link:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--primary-color);
}

.username {
    color: var(--text-secondary);
    margin-right: 0.5rem;
}

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

.dropdown-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1rem;
}

.dropdown-toggle:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.nav-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: 1002;
    overflow: hidden;
}

.nav-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: rgba(99, 102, 241, 0.1);
    transform: translateX(4px);
}

.dropdown-item-active {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--primary-color);
    pointer-events: none;
    opacity: 0.7;
}

.dropdown-item-active .dropdown-title {
    color: var(--primary-color);
}

.dropdown-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
}

.dropdown-content {
    flex: 1;
}

.dropdown-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.dropdown-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Nav right section */
.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

/* Default avatar */
.default-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1a6fbf 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    user-select: none;
    position: relative;
}

.default-avatar:hover {
    box-shadow: 0 0 12px rgba(43, 135, 218, 0.5);
    transform: scale(1.05);
}

.default-avatar.avatar-large {
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
    cursor: default;
}

.default-avatar.avatar-large:hover {
    transform: none;
    box-shadow: none;
}

/* Avatar dropdown */
.avatar-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.avatar-dropdown .dropdown-menu {
    right: 0;
    left: auto;
    min-width: 220px;
}

.avatar-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.avatar-username {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
}

.dropdown-icon-sm {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

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

.dropdown-logout:hover {
    color: var(--danger-color);
}

/* Avatar status dot */
.avatar-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary, #0f1724);
    z-index: 1;
}

.avatar-status-dot.status-online,
.status-indicator.status-online {
    background: var(--success-color, #22c55e);
}

.avatar-status-dot.status-away,
.status-indicator.status-away {
    background: #f59e0b;
}

.avatar-status-dot.status-offline,
.status-indicator.status-offline {
    background: #666;
}

/* Status selector in dropdown */
.status-selector {
    display: flex;
    gap: 2px;
    padding: 0.5rem 0.75rem;
}

.status-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.status-option:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.status-option.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Burger menu button - hidden on desktop */
.nav-top-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Mobile: show sound toggle next to burger; Desktop: hide it (desktop one is in nav-right) */
.nav-top-right .sound-toggle-btn {
    display: none;
}

/* Desktop: show sound toggle in nav-right; hide on mobile */
.sound-toggle-desktop {
    display: flex;
}

@media (max-width: 1024px) {
    .nav-top-right .sound-toggle-btn {
        display: flex;
    }
    .sound-toggle-desktop {
        display: none !important;
    }
}

.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    z-index: 1003;
}

.burger-line {
    display: block;
    width: 24px;
    height: 2.5px;
    background-color: var(--text-primary, #fff);
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
}

.burger-btn.active .burger-line:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.burger-btn.active .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-btn.active .burger-line:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

.nav-overlay {
    display: none;
}

body.nav-open {
    overflow: hidden;
    touch-action: none;
}
html.nav-open {
    overflow: hidden;
}

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

    .nav-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        background-color: var(--card-bg);
        border-left: 2px solid var(--border-color);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        flex: none;
        padding: 5rem 1.5rem 2rem;
        gap: 0.25rem;
        z-index: 1002;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
        will-change: transform;
    }

    .nav-links.mobile-open {
        transform: translateX(0);
    }

    .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1.05rem;
        border-radius: 8px;
        width: 100%;
    }

    .nav-right {
        margin-left: 0;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        width: 100%;
    }

    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: transparent;
        z-index: 1001;
        touch-action: none;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-overlay.active {
        display: block;
    }

    .avatar-dropdown .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--border-color);
        margin-top: 0.5rem;
        min-width: auto;
        display: block;
    }

    .avatar-dropdown .avatar-toggle {
        display: none;
    }

    .nav-dropdown .dropdown-menu {
        position: static;
        min-width: auto;
        box-shadow: none;
        border: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }
}

/* ===== Play Dropdown ===== */
/* Desktop nav links: centered between logo and nav-right */
.desktop-nav-links-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.desktop-nav-link {
    display: inline-flex;
    align-items: center;
}

/* Mobile nav links: show individual links on mobile */
.mobile-nav-link {
    display: none;
}

.mobile-nav-icon {
    vertical-align: -3px;
    margin-right: 0.4rem;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .desktop-nav-links-center {
        display: none !important;
    }

    .mobile-nav-link {
        display: flex;
        align-items: center;
    }
}

/* ===== Daily Quests (navbar) ===== */
.quest-nav-wrap {
    position: relative;
}

.sound-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.sound-toggle-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.quest-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--text-color, #e2e8f0);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
}

.quest-nav-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.quest-btn-label {
    font-weight: 500;
    white-space: nowrap;
}

.quest-badge {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--primary-color);
    color: #fff;
    border-radius: 10px;
    padding: 0.15rem 0.5rem;
    line-height: 1.3;
}

.quest-badge-all-done {
    background: var(--primary-color);
}

/* Quest dropdown */
.quest-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 320px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: 1002;
    overflow: hidden;
}

.quest-nav-wrap.quest-open .quest-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quest-dd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quest-dd-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.quest-dd-timer {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.quest-dd-item {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.quest-dd-item:last-child {
    border-bottom: none;
}

.quest-dd-item.quest-done {
    opacity: 0.6;
}

.quest-dd-cat {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.quest-dd-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.quest-dd-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quest-dd-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.quest-dd-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: width 0.5s ease;
}

.quest-dd-bar-fill.quest-bar-done {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

.quest-dd-progress {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 28px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quest-dd-xp {
    font-size: 0.65rem;
    font-weight: 700;
    color: #a78bfa;
    white-space: nowrap;
}

.quest-dd-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.quest-dd-info {
    flex: 1;
    min-width: 0;
}

.quest-dd-play {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    font-size: 0.7rem;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}

.quest-dd-play:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    transform: scale(1.1);
}

/* Quest toast animation */
@keyframes questToastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Mobile quest adjustments */
@media (max-width: 1024px) {
    .quest-dropdown {
        position: static;
        width: 100%;
        margin-top: 0.5rem;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        transition: opacity 0.3s ease, max-height 0.3s ease, visibility 0.3s;
    }

    .quest-nav-wrap.quest-open .quest-dropdown {
        opacity: 1;
        visibility: visible;
        max-height: 340px;
        overflow-y: auto;
        transform: none;
    }

    .quest-nav-btn {
        justify-content: center;
    }
}
