/* Base Navbar Styles */
:root {
    --nav-height: 64px;
    --primary-color: #2563eb;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    /* Use a solid-ish background reference or just specific values in classes */
    --bg-color: #fafafa;
    --border-color: #e2e8f0;
}

/* Ensure content doesn't hide behind fixed navbar */
body {
    padding-top: 64px !important;
}

/* Ensure fixed positioning overrides any sticky styles from other files */
.top-nav {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(250, 250, 250, 0.85);
    /* Slightly more opaque */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-container {
    width: 100%;
    max-width: 1480px;
    /* Sync with container-wide */
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (min-width: 1600px) {
    .nav-container {
        max-width: 1600px;
    }
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.logo:hover {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--primary-color);
}

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

.login-btn {
    text-decoration: none;
    color: white;
    background: #0f172a;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    border-radius: 0.4rem;
    transition: all 0.2s;
}

.login-btn:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* User Profile */
.user-profile {
    position: relative;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Primary Create Button */
.create-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: #0f172a;
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.create-btn:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.create-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

/* User Info Container - 整个容器作为按钮 */
.user-info-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.user-info-container:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.nav-user-icon {
    color: #000000;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Points Display - 纯信息显示 */
.nav-points-display {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding-left: 0.5rem;
    border-left: 1px solid #e2e8f0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #000000;
}

.points-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.nav-points-display span {
    color: #000000;
}


.hidden {
    display: none !important;
}

/* User Profile Dropdown/Popover */
.profile-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1002;
}

.profile-popover.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.popover-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.popover-item.danger {
    color: #ef4444;
}

.popover-item.danger:hover {
    background: rgba(239, 68, 68, 0.05);
}

.popover-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --- Mobile Responsive Styles --- */

/* Default: Hide Mobile Elements on Desktop */
.mobile-menu-btn,
.mobile-menu-dropdown {
    display: none;
}

@media (max-width: 768px) {

    /* Hide Desktop Elements */
    .nav-links,
    .nav-right {
        display: none !important;
    }

    /* Adjust Container */
    .nav-container {
        padding: 0 1rem;
    }

    /* Show Mobile Toggle */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: #000;
        cursor: pointer;
        padding: 0.5rem;
    }

    .mobile-menu-btn svg {
        width: 24px;
        height: 24px;
    }

    /* Mobile Dropdown Menu */
    .mobile-menu-dropdown {
        display: none;
        /* Initially hidden, toggled via JS */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        z-index: 999;
    }

    .mobile-menu-dropdown.show {
        display: flex;
    }

    /* Mobile Links */
    .mobile-nav-link {
        display: block;
        padding: 0.75rem 1rem;
        color: var(--text-primary);
        text-decoration: none;
        font-weight: 500;
        border-radius: 0.5rem;
        transition: background 0.2s;
        border: none;
        background: transparent;
        width: 100%;
        text-align: left;
    }

    .mobile-nav-link:hover {
        background: #f1f5f9;
    }

    .mobile-nav-link.active {
        color: var(--primary-color);
        background: #eff6ff;
    }

    .mobile-divider {
        height: 1px;
        background: var(--border-color);
        margin: 0.5rem 0;
        border: none;
    }

    /* Mobile Auth Items */
    .mobile-auth-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 0.8rem;
        background: #000;
        color: white;
        text-decoration: none;
        border-radius: 0.6rem;
        font-weight: 600;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .mobile-points-link {
        background: #f8fafc !important;
        margin-bottom: 0.5rem;
    }

    .mobile-points-link:hover {
        background: #f1f5f9 !important;
    }

    .mobile-logout-btn {
        width: 100%;
        text-align: left;
        color: #ef4444;
        margin-top: 0.25rem;
    }

    .mobile-logout-btn:hover {
        background: #fef2f2;
    }
}

/* My Designs Dropdown */
.my-designs-dropdown {
    position: relative;
}

.my-designs-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: white;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-weight: 400;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.my-designs-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.my-designs-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.my-designs-dropdown.open .my-designs-btn svg {
    transform: rotate(180deg);
}

.designs-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 250px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1002;
}

.my-designs-dropdown.open .designs-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.design-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.15s;
}

.design-item:hover {
    background: #f8fafc;
}

.design-item span:first-child {
    font-weight: 400;
    color: #0f172a;
}

.design-date {
    font-size: 0.75rem;
    color: #64748b;
}

/* Mobile Designs Dropdown */
.mobile-designs-dropdown {
    width: 100%;
    margin-top: 0.5rem;
    border-top: 1px solid #f1f5f9;
}

.mobile-designs-toggle-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1rem;
    background: transparent;
    border: none;
    color: #0f172a;
    font-weight: 400;
    cursor: pointer;
}

.mobile-designs-toggle-btn svg {
    transition: transform 0.2s;
}

.mobile-designs-dropdown.open .mobile-designs-toggle-btn svg {
    transform: rotate(180deg);
}

.mobile-designs-list {
    display: none;
    flex-direction: column;
    background: #f8fafc;
    border-radius: 0.5rem;
    margin: 0 0.5rem 0.5rem 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.mobile-designs-dropdown.open .mobile-designs-list {
    display: flex;
}

.mobile-design-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

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

.mobile-design-item:active {
    background: #f1f5f9;
}