/**
 * Premium Header & Navbar Enhancements
 * Elegant, modern design for navigation
 */

/* ==========================================
   PREMIUM HEADER STYLES
   ========================================== */

.gh-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 72px; /* Slightly taller for premium feel */
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.98) 0%,
        rgba(255, 255, 255, 0.95) 100%
    );
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow:
        0 1px 3px 0 rgba(0, 0, 0, 0.05),
        0 1px 2px 0 rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .gh-header {
    background: linear-gradient(180deg,
        rgba(15, 23, 42, 0.98) 0%,
        rgba(15, 23, 42, 0.95) 100%
    );
    border-bottom-color: rgba(51, 65, 85, 0.8);
}

.gh-header.scrolled {
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.08),
        0 2px 4px -1px rgba(0, 0, 0, 0.04);
    height: 64px;
}

/* Header Inner Container */
.gh-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    gap: 2rem;
}

/* ==========================================
   LOGO / BRAND AREA
   ========================================== */

.gh-header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.gh-header-logo {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.gh-header-logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.1) 0%,
        rgba(6, 182, 212, 0.1) 100%
    );
    border-radius: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gh-header-logo:hover::before {
    opacity: 1;
}

.gh-header-logo img {
    height: 40px;
    width: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.gh-header-logo:hover img {
    transform: scale(1.05) rotate(-2deg);
}

.gh-header-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg,
        #6366f1 0%,
        #06b6d4 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    transition: all 0.3s ease;
}

.gh-header-title:hover {
    background: linear-gradient(135deg,
        #4f46e5 0%,
        #0891b2 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================
   NAVIGATION MENU
   ========================================== */

.gh-header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
}

.gh-header-nav nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.gh-header-nav nav a {
    position: relative;
    padding: 0.625rem 1rem;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: 0.625rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
}

.gh-header-nav nav a::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.08) 0%,
        rgba(6, 182, 212, 0.08) 100%
    );
    border-radius: 0.625rem;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-header-nav nav a:hover::before {
    opacity: 1;
    transform: scale(1);
}

.gh-header-nav nav a:hover {
    color: #6366f1;
}

.gh-header-nav nav a.active {
    color: #6366f1;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.12) 0%,
        rgba(6, 182, 212, 0.12) 100%
    );
}

.gh-header-nav nav a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background: linear-gradient(90deg,
        #6366f1 0%,
        #06b6d4 100%
    );
    border-radius: 2px;
}

/* ==========================================
   ACTION BUTTONS (Search & Theme Toggle)
   ========================================== */

.gh-search-toggle,
.gh-theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 0.625rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-search-toggle::before,
.gh-theme-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.08) 0%,
        rgba(6, 182, 212, 0.08) 100%
    );
    border-radius: 0.625rem;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-search-toggle:hover::before,
.gh-theme-toggle:hover::before {
    opacity: 1;
    transform: scale(1);
}

.gh-search-toggle:hover,
.gh-theme-toggle:hover {
    color: #6366f1;
}

.gh-search-toggle svg,
.gh-theme-toggle svg {
    position: relative;
    z-index: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-search-toggle:hover svg {
    transform: scale(1.1);
}

.gh-theme-toggle:hover svg {
    transform: rotate(180deg) scale(1.1);
}

/* Mobile Menu Toggle */
.gh-mobile-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 0.625rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-mobile-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.08) 0%,
        rgba(6, 182, 212, 0.08) 100%
    );
    border-radius: 0.625rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gh-mobile-toggle:hover::before {
    opacity: 1;
}

.gh-mobile-toggle:hover {
    color: #6366f1;
}

/* ==========================================
   ENHANCED SIDEBAR
   ========================================== */

.gh-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid #e2e8f0;
    background: linear-gradient(180deg,
        #ffffff 0%,
        #f8fafc 100%
    );
    overflow-y: auto;
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .gh-sidebar {
    background: linear-gradient(180deg,
        #0f172a 0%,
        #1e293b 100%
    );
    border-right-color: #334155;
}

.gh-sidebar-inner {
    padding: 1.5rem 1rem;
}

/* Custom Scrollbar */
.gh-sidebar::-webkit-scrollbar {
    width: 6px;
}

.gh-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.gh-sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
        #cbd5e1 0%,
        #94a3b8 100%
    );
    border-radius: 3px;
    transition: background 0.3s ease;
}

.gh-sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg,
        #94a3b8 0%,
        #64748b 100%
    );
}

/* Sidebar Section Titles */
.gh-nav-section-title {
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #94a3b8;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gh-nav-section-title:hover {
    color: #6366f1;
}

.gh-nav-section-title svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-nav-section-title.active svg {
    transform: rotate(90deg);
}

/* Sidebar Links */
.gh-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.625rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.25rem;
}

.gh-nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg,
        #6366f1 0%,
        #06b6d4 100%
    );
    border-radius: 0 2px 2px 0;
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-nav-link:hover {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.06) 0%,
        rgba(6, 182, 212, 0.06) 100%
    );
    color: #1e293b;
    padding-left: 1rem;
}

.gh-nav-link:hover::before {
    height: 60%;
}

.gh-nav-link.active {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.12) 0%,
        rgba(6, 182, 212, 0.08) 100%
    );
    color: #6366f1;
    font-weight: 700;
    padding-left: 1rem;
}

.gh-nav-link.active::before {
    height: 100%;
}

[data-theme="dark"] .gh-nav-link:hover {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.15) 0%,
        rgba(6, 182, 212, 0.1) 100%
    );
    color: #e0e7ff;
}

[data-theme="dark"] .gh-nav-link.active {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.2) 0%,
        rgba(6, 182, 212, 0.15) 100%
    );
    color: #a5b4fc;
}

/* Version Switcher in Sidebar */
.gh-version-switcher {
    margin-bottom: 1.5rem;
}

.gh-version-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.08) 0%,
        rgba(6, 182, 212, 0.08) 100%
    );
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6366f1;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-version-button:hover {
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.12) 0%,
        rgba(6, 182, 212, 0.12) 100%
    );
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.25);
}

/* Navbar extra links */
.gh-header-nav .nav-link {
    color: var(--color-text-secondary, #64748b);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.gh-header-nav .nav-link:hover {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

/* Navbar CTA button */
.gh-nav-cta {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.125rem;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    color: white !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.gh-nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1024px) {
    .gh-header-nav nav a {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}

@media (max-width: 768px) {
    .gh-header {
        height: 64px;
    }

    .gh-header-inner {
        padding: 0 1rem;
        gap: 1rem;
    }

    .gh-header-logo img {
        height: 32px;
    }

    .gh-header-title {
        font-size: 1.25rem;
    }

    .gh-header-nav nav {
        display: none;
    }

    .gh-mobile-toggle {
        display: flex;
    }

    .gh-sidebar {
        position: fixed;
        left: -100%;
        top: 64px;
        height: calc(100vh - 64px);
        z-index: 99;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .gh-sidebar.active {
        left: 0;
    }

    .sidebar-open .gh-sidebar {
        left: 0;
    }

    /* Overlay when sidebar is open */
    .sidebar-open::before {
        content: '';
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        z-index: 98;
    }
}

@media (max-width: 480px) {
    .gh-header-title {
        font-size: 1.125rem;
    }

    .gh-search-toggle,
    .gh-theme-toggle,
    .gh-mobile-toggle {
        width: 36px;
        height: 36px;
    }
}

/* Version Badge (shown when show_version_switcher is enabled) */
.gh-version-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6366f1;
    letter-spacing: 0.01em;
}

/* ==========================================
   SCROLL ANIMATIONS
   ========================================== */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gh-header {
    animation: slideDown 0.4s ease-out;
}

.gh-nav-section {
    animation: slideDown 0.5s ease-out;
    animation-fill-mode: both;
}

.gh-nav-section:nth-child(1) { animation-delay: 0.1s; }
.gh-nav-section:nth-child(2) { animation-delay: 0.2s; }
.gh-nav-section:nth-child(3) { animation-delay: 0.3s; }
.gh-nav-section:nth-child(4) { animation-delay: 0.4s; }
.gh-nav-section:nth-child(5) { animation-delay: 0.5s; }

/* Marketplace polish alignment */
.gh-header-title {
    background: linear-gradient(135deg, #2563eb 0%, #14b8a6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gh-header-nav .nav-link:hover,
.gh-search-toggle:hover,
.gh-theme-toggle:hover,
.gh-mobile-toggle:hover,
.gh-nav-section-title:hover,
.gh-nav-link.active,
.gh-version-badge {
    color: #2563eb;
}

.gh-nav-cta {
    background: linear-gradient(135deg, #2563eb 0%, #14b8a6 100%);
    border-radius: 7px;
    box-shadow: 0 10px 24px -16px rgba(37, 99, 235, 0.9);
}

.gh-nav-cta:hover {
    box-shadow: 0 14px 30px -18px rgba(20, 184, 166, 0.9);
}

.gh-version-badge {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.22);
}
