/* Unified Header Navigation System */

/* Combined Header with Navigation */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-sizing: border-box;
    contain: layout style;
}

[data-theme="dark"] .header {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Top row - Brand and controls - Using flexbox like the category nav */
.nav-container {
    width: 100%;
    margin: 0;
    padding: 0 0.5rem; /* Match category nav exactly */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    contain: layout style; /* CSS containment for better performance */
    min-height: 64px;
    position: relative;
    box-sizing: border-box;
}

/* Brand section alignment - push to left edge with padding */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: auto;
    margin-left: 0.5rem; /* Add padding from left edge */
    flex-shrink: 0;
}

/* Center navigation */
.nav-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* Controls section alignment - push to right edge */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    margin-right: 0.5rem; /* Add padding from right edge */
    flex-shrink: 0;
}

/* Bottom row - Navigation (compact nav integrated) */
.compact-nav {
    background: transparent;
    border: none;
    box-shadow: none;
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    z-index: auto;
}

/* Hide on home page, show on other pages */
body:not(.home-page) .compact-nav {
    display: block;
}

body.home-page .compact-nav {
    display: none;
}

/* Adjust main content padding for unified header */
body:not(.home-page) .main-content {
    padding-top: 130px; /* Account for unified header height */
}

body.home-page .main-content {
    padding-top: 0; /* No padding needed - hero section starts right under header */
}

/* Compact Nav Container */
.compact-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* Collapsible Menu Toggle */
.nav-menu-toggle {
    display: none; /* Hidden by default, shown on mobile */
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-menu-toggle:hover {
    background: var(--bg-tertiary);
}

/* Horizontal Pill Navigation */
.nav-pills {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: 12px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

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

.nav-pill {
    padding: 0.2rem 0.3rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.nav-pill:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: translateY(-1px);
    outline: none;
    border: none;
    overflow: hidden; /* Ensure content stays within border-radius */
}

.nav-pill:focus {
    outline: none;
    border: none;
}

.nav-pill.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-pill-icon {
    font-size: 1rem;
    opacity: 0.8;
}

.nav-pill.active .nav-pill-icon {
    opacity: 1;
}

/* Quick Actions */
.nav-quick-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.quick-search {
    position: relative;
}

.quick-search-input {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    width: 200px;
    transition: all 0.2s ease;
}

.quick-search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    width: 250px;
}

.quick-search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Enhanced Search Dropdown Styles */
.search-dropdown {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    max-height: 400px;
    overflow-y: auto;
    z-index: 2000;
    min-width: 400px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .search-dropdown {
    background: rgba(15, 23, 42, 0.95);
    border-color: var(--border-dark);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.search-header {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-category {
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.15s ease;
    background: transparent;
}

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

.search-result-item:hover,
.search-result-item.focused {
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-primary);
}

.search-result-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.search-result-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.3;
    display: block;
    position: relative;
}

.search-result-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 2rem; /* Space for popular indicator */
}

.search-result-popular {
    position: absolute;
    right: 0;
    top: 0;
    font-size: 0.7rem;
    opacity: 0.8;
}

.search-result-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.search-result-category {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    padding: 0.0625rem 0.375rem;
    border-radius: 8px;
    font-weight: 400;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid var(--border-light);
}

.search-result-match {
    color: var(--accent-primary);
    font-weight: 500;
}

.search-no-results {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.search-no-results-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.search-no-results-text {
    font-size: 0.9rem;
}

/* Scrollbar styling for search dropdown */
.search-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.search-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.search-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Dropdown Navigation (Mobile/Tablet) */
.nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 70vh;
    overflow-y: auto;
}

.nav-dropdown.show {
    display: block;
}

.nav-dropdown-section {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-light);
}

.nav-dropdown-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.nav-dropdown-items {
    display: grid;
    gap: 0.25rem;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-dropdown-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.nav-dropdown-item-icon {
    font-size: 1.25rem;
    opacity: 0.8;
}

.nav-dropdown-item-text {
    flex: 1;
}

.nav-dropdown-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* Floating Action Button (Mobile) */
.fab-nav {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
}

.fab-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-button:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.fab-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.fab-menu.show {
    display: flex;
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.2s ease;
    animation: slideInRight 0.3s ease forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fab-menu-item:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-lg);
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    padding: 1rem 2rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    margin-top: 60px; /* Account for fixed header */
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 1400px;
    margin: 0 auto;
    font-size: 0.875rem;
}

.breadcrumb-item {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item:hover {
    color: var(--accent-primary);
}

.breadcrumb-separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .compact-nav {
    background: rgba(15, 23, 42, 0.95);
}

[data-theme="dark"] .nav-pills {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .nav-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    border: none;
    overflow: hidden; /* Ensure content stays within border-radius */
}

[data-theme="dark"] .quick-search-input {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .quick-search-input:focus {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .nav-dropdown {
    background: rgba(15, 23, 42, 0.98);
}

[data-theme="dark"] .breadcrumb-nav {
    background: rgba(255, 255, 255, 0.02);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .nav-pills {
        display: none;
    }
    
    .nav-menu-toggle {
        display: block;
    }
    
    .quick-search {
        display: none;
    }
    
    .compact-nav-container {
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 768px) {
    .compact-nav {
        display: none !important;
    }
    
    .fab-nav {
        display: block;
    }
    
    body:not(.home-page) .main-content {
        padding-top: 60px; /* Only account for main header */
    }
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 0.1s linear;
    z-index: 1001;
}

/* Navigation stays consistent - no changes on scroll */