/* ========================================
   NEW TOP NAVIGATION - DARK/LIGHT MODE SUPPORT
   ======================================== */

/* CSS Variables for Light Mode (Default) */
:root {
    --nav-bg: rgba(255, 255, 255, 0.98);
    --nav-text: #2d3748;
    --nav-text-secondary: #4a5568;
    --nav-border: rgba(0, 0, 0, 0.08);
    --nav-hover-bg: rgba(139, 90, 60, 0.08);
    --nav-active-bg: rgba(139, 90, 60, 0.12);
    --nav-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    --nav-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
    --dropdown-bg: #ffffff;
    --dropdown-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    --primary-color: #8B5A3C;
    --primary-hover: #7A4D33;
    --badge-bg: #ef4444;
    --badge-text: #ffffff;
    --mobile-menu-bg: #ffffff;
    --search-bg: rgba(249, 250, 251, 0.8);
    --search-focus-bg: #ffffff;
    --icon-color: #4a5568;
    --overlay-bg: rgba(0, 0, 0, 0.5);
}

/* CSS Variables for Dark Mode */
[data-theme="dark"],
.dark {
    --nav-bg: rgba(20, 20, 20, 0.98);
    --nav-text: #f7fafc;
    --nav-text-secondary: #e2e8f0;
    --nav-border: rgba(255, 255, 255, 0.08);
    --nav-hover-bg: rgba(139, 90, 60, 0.15);
    --nav-active-bg: rgba(139, 90, 60, 0.22);
    --nav-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
    --nav-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.4);
    --dropdown-bg: #1a1a1a;
    --dropdown-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    --primary-color: #D4A574;
    --primary-hover: #8B5A3C;
    --badge-bg: #dc2626;
    --badge-text: #ffffff;
    --mobile-menu-bg: #1a1a1a;
    --search-bg: rgba(30, 30, 30, 0.8);
    --search-focus-bg: #1e1e1e;
    --icon-color: #e2e8f0;
    --overlay-bg: rgba(0, 0, 0, 0.7);
}

/* Smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Top Navigation Container */
.top-navigation {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: var(--nav-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.top-navigation.scrolled {
    box-shadow: var(--nav-shadow-hover);
}

.top-navigation.hidden {
    transform: translateY(-100%);
}

/* Navigation Wrapper */
.nav-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Brand/Logo */
.nav-brand {
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
    transition: transform 0.3s ease, color 0.3s ease;
}

.brand-link:hover {
    transform: scale(1.05);
    color: var(--primary-hover);
}

.brand-link i {
    font-size: 1.75rem;
}

.brand-name {
    display: inline-block;
}

/* Desktop Navigation Links */
.desktop-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    color: var(--nav-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--nav-hover-bg);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.nav-link.active {
    background: var(--nav-active-bg);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-link i {
    font-size: 1rem;
}

.nav-link .fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

/* Dropdown Container */
.nav-dropdown {
    position: relative;
}

.nav-dropdown.active .fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 240px;
    background: var(--dropdown-bg);
    border: 1px solid var(--nav-border);
    border-radius: 0.75rem;
    box-shadow: var(--dropdown-shadow);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    z-index: 100;
}

.nav-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu-right {
    left: auto;
    right: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--nav-text);
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--nav-hover-bg);
    color: var(--primary-color);
    transform: translateX(4px);
}

.dropdown-item i {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

.dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--nav-border);
    margin-bottom: 0.5rem;
}

.dropdown-header strong {
    display: block;
    color: var(--nav-text);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.dropdown-header small {
    display: block;
    color: var(--nav-text-secondary);
    font-size: 0.8rem;
}

.dropdown-divider {
    height: 1px;
    background: var(--nav-border);
    margin: 0.5rem 0;
}

.dropdown-form {
    margin: 0;
}

/* Search Bar */
.nav-search {
    flex: 1;
    max-width: 500px;
}

.search-form {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1.25rem;
    border: 1px solid var(--nav-border);
    border-radius: 2rem;
    background: var(--search-bg);
    color: var(--nav-text);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    background: var(--search-focus-bg);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 90, 60, 0.1);
}

.search-input::placeholder {
    color: var(--nav-text-secondary);
}

.search-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: 50%;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-button:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(139, 90, 60, 0.3);
}

/* Action Buttons */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.action-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--nav-border);
    color: var(--icon-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.action-btn:hover {
    background: var(--nav-hover-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 90, 60, 0.15);
}

.action-btn i {
    font-size: 1.1rem;
}

/* Theme Toggle Button */
.theme-toggle {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle .dark-icon {
    display: block;
}

.theme-toggle .light-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .dark-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .light-icon {
    display: block;
}

/* --------------------------------------------------------------------------
   Force readable, light text & icon colors for top navigation in dark mode
   This ensures any specificity elsewhere doesn't leave nav text/icons dark.
   -------------------------------------------------------------------------- */
[data-theme="dark"] .top-navigation,
[data-theme="dark"] .nav-wrapper,
[data-theme="dark"] .nav-brand,
[data-theme="dark"] .brand-link,
[data-theme="dark"] .brand-link i,
[data-theme="dark"] .desktop-nav,
[data-theme="dark"] .nav-link,
[data-theme="dark"] .nav-link i,
[data-theme="dark"] .nav-link .fa-chevron-down,
[data-theme="dark"] .dropdown-item,
[data-theme="dark"] .dropdown-item i,
[data-theme="dark"] .nav-actions,
[data-theme="dark"] .action-btn,
[data-theme="dark"] .action-btn i,
[data-theme="dark"] .search-input,
[data-theme="dark"] .search-button,
[data-theme="dark"] .mobile-nav-link,
[data-theme="dark"] .mobile-nav-link i,
[data-theme="dark"] .mobile-menu-title,
[data-theme="dark"] .mobile-menu-close {
    color: var(--nav-text) !important;
}

[data-theme="dark"] .nav-link i,
[data-theme="dark"] .action-btn i,
[data-theme="dark"] .dropdown-item i,
[data-theme="dark"] .mobile-nav-link i,
[data-theme="dark"] .brand-link i {
    color: inherit !important;
}

/* Badge */
.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 1.25rem;
    height: 1.25rem;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--badge-bg);
    color: var(--badge-text);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    border: 2px solid var(--nav-bg);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* User Menu Button */
.user-menu-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-color: transparent;
    color: white;
}

.user-menu-btn:hover {
    border-color: transparent;
    color: white;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: var(--mobile-menu-bg);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--nav-border);
}

.mobile-menu-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--nav-text);
}

.mobile-menu-close {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--nav-border);
    color: var(--icon-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: var(--nav-hover-bg);
    color: var(--primary-color);
}

.mobile-menu-content {
    padding: 1rem;
}

.mobile-search {
    margin-bottom: 1.5rem;
}

.mobile-search form {
    position: relative;
}

.mobile-search-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 1px solid var(--nav-border);
    border-radius: 0.75rem;
    background: var(--search-bg);
    color: var(--nav-text);
    font-size: 1rem;
    outline: none;
}

.mobile-search-button {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--nav-text);
    text-decoration: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.mobile-nav-link:hover {
    background: var(--nav-hover-bg);
    color: var(--primary-color);
}

.mobile-nav-link i {
    font-size: 1.25rem;
    width: 1.5rem;
}

.mobile-nav-dropdown .mobile-nav-link {
    justify-content: space-between;
}

.mobile-nav-link-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-nav-dropdown .fa-chevron-down {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
}

.mobile-nav-dropdown.active .fa-chevron-down {
    transform: rotate(180deg);
}

.mobile-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 2.5rem;
}

.mobile-nav-dropdown.active .mobile-dropdown-menu {
    max-height: 500px;
}

.mobile-dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--nav-text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.mobile-dropdown-item:hover {
    background: var(--nav-hover-bg);
    color: var(--primary-color);
}

.mobile-menu-divider {
    height: 1px;
    background: var(--nav-border);
    margin: 1rem 0;
}

.logout-btn {
    color: #ef4444 !important;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-wrapper {
        gap: 1rem;
    }
    
    .nav-search {
        max-width: 300px;
    }
}

@media (max-width: 768px) {
    .nav-wrapper {
        padding: 0.75rem 1rem;
    }
    
    .desktop-nav {
        display: none;
    }
    
    .nav-search {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-actions {
        gap: 0.5rem;
    }
    
    .action-btn {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .action-btn i {
        font-size: 1rem;
    }
    
    .brand-link {
        font-size: 1.25rem;
    }
    
    .brand-link i {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .nav-wrapper {
        padding: 0.625rem 0.75rem;
    }
    
    .nav-actions {
        gap: 0.375rem;
    }
    
    .action-btn {
        width: 2.25rem;
        height: 2.25rem;
        border: none;
    }
    
    .brand-name {
        display: none;
    }
}
