/* ============================================
   BOMAtlas Premium Header System
   Bloomberg Terminal-Inspired Design
   ============================================ */

/* Header Container */
.bomatlas-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 14, 20, 0.92);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(255, 160, 40, 0.12);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 160, 40, 0.1);
    transition: box-shadow 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.bomatlas-header.scrolled {
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.6),
        0 0 1px rgba(255, 160, 40, 0.2),
        inset 0 -1px 0 rgba(255, 160, 40, 0.1);
}

.bomatlas-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 160, 40, 0.3) 50%,
        transparent 100%
    );
    opacity: 0.6;
}

.bomatlas-header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Logo */
.bomatlas-logo {
    color: #F8FAFC;
    text-decoration: none;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.01em;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 2px;
    transition: transform 180ms ease, background 180ms ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bomatlas-logo:hover {
    transform: scale(1.02);
}

/* Product switcher styling */
.bomatlas-product-switcher {
    margin-right: auto;
}

.bomatlas-product-switcher .bomatlas-logo {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    background: none;
    font-family: inherit;
}

.bomatlas-product-switcher .bomatlas-logo:hover {
    background: rgba(255, 160, 40, 0.08);
}

.bomatlas-logo-chevron {
    font-size: 10px;
    margin-left: 4px;
    color: #64748B;
    transition: transform 180ms ease;
}

.bomatlas-product-switcher .bomatlas-nav-dropdown-trigger[aria-expanded="true"] .bomatlas-logo-chevron {
    transform: rotate(180deg);
}

/* Hide duplicate CSS triangle on product switcher (already has HTML chevron) */
.bomatlas-product-switcher .bomatlas-nav-dropdown-trigger::after {
    display: none;
}

/* Product dropdown items */
.bomatlas-nav-dropdown-item strong {
    display: block;
    color: #F8FAFC;
    font-size: 14px;
    margin-bottom: 2px;
}

.bomatlas-nav-dropdown-item-text {
    line-height: 1.4;
}

.bomatlas-logo-accent {
    background: linear-gradient(135deg, #FFA028 0%, #FFB85C 50%, #FF8C00 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Navigation Container */
.bomatlas-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Navigation Links */
.bomatlas-nav-link {
    position: relative;
    color: #CBD5E1;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.02em;
    padding: 8px 14px;
    border-radius: 6px;
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bomatlas-nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 160, 40, 0.15),
        transparent
    );
    transition: left 0.5s ease;
}

.bomatlas-nav-link:hover::before {
    left: 100%;
}

.bomatlas-nav-link:hover {
    background: rgba(255, 160, 40, 0.08);
    color: #F8FAFC;
    transform: translateY(-1px);
    box-shadow: 0 0 8px rgba(255, 160, 40, 0.15);
}

.bomatlas-nav-link.active {
    background: rgba(255, 160, 40, 0.15);
    color: #FFA028;
    border-bottom: 2px solid #FFA028;
}

.bomatlas-nav-link:focus-visible {
    outline: 2px solid rgba(255, 160, 40, 0.5);
    outline-offset: 2px;
}

/* External Link Icon */
.bomatlas-external-icon {
    width: 12px;
    height: 12px;
    opacity: 0.6;
    transition: opacity 180ms ease;
}

.bomatlas-nav-link:hover .bomatlas-external-icon {
    opacity: 1;
}

/* Auth link styling - orange accent */
.bomatlas-nav-link-auth {
    color: #FFA028 !important;
    font-weight: 600;
}

.bomatlas-nav-link-auth:hover {
    color: #FFB85C !important;
    background: rgba(255, 160, 40, 0.1);
}

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

.bomatlas-nav-dropdown-trigger {
    position: relative;
    color: #CBD5E1;
    background: none;
    border: none;
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.02em;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bomatlas-nav-dropdown-trigger::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 4px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #CBD5E1;
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
                border-top-color 180ms ease;
}

.bomatlas-nav-dropdown:hover .bomatlas-nav-dropdown-trigger,
.bomatlas-nav-dropdown:focus-within .bomatlas-nav-dropdown-trigger {
    background: rgba(255, 160, 40, 0.08);
    color: #F8FAFC;
}

.bomatlas-nav-dropdown:hover .bomatlas-nav-dropdown-trigger::after,
.bomatlas-nav-dropdown:focus-within .bomatlas-nav-dropdown-trigger::after {
    transform: rotate(180deg);
    border-top-color: #FFA028;
}

/* Dropdown Menu */
.bomatlas-nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: #0A0E14;
    border: 1px solid rgba(255, 160, 40, 0.2);
    border-radius: 8px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 220ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 160, 40, 0.15);
    z-index: 1001;
}

.bomatlas-nav-dropdown:hover .bomatlas-nav-dropdown-menu,
.bomatlas-nav-dropdown:focus-within .bomatlas-nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown Items */
.bomatlas-nav-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    color: #CBD5E1;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all 180ms ease;
    border-left: 2px solid transparent;
}

.bomatlas-nav-dropdown-item:hover {
    background: linear-gradient(90deg,
        rgba(255, 160, 40, 0.12) 0%,
        rgba(255, 160, 40, 0.06) 100%
    );
    color: #F8FAFC;
    transform: translateX(4px);
    border-left-color: #FFA028;
}

.bomatlas-nav-dropdown-item.active {
    color: #FFA028;
    background: rgba(255, 160, 40, 0.1);
}

/* Entity Count Badge */
.bomatlas-nav-entity-count {
    color: #94A3B8;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    background: rgba(255, 160, 40, 0.08);
    border-radius: 10px;
}

.bomatlas-nav-dropdown-item:hover .bomatlas-nav-entity-count {
    background: rgba(255, 160, 40, 0.15);
    color: #FFA028;
}

/* Dropdown Divider */
.bomatlas-nav-dropdown-divider {
    height: 1px;
    background: rgba(203, 213, 225, 0.08);
    margin: 8px 12px;
}

/* Account dropdown header (shows full email) */
.bomatlas-nav-dropdown-header {
    padding: 8px 16px;
    font-size: 12px;
    color: #64748B;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 160, 40, 0.1);
    margin-bottom: 4px;
}

/* Mobile Menu Toggle */
.bomatlas-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 160, 40, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 180ms ease;
    position: relative;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.bomatlas-menu-toggle:hover {
    background: rgba(255, 160, 40, 0.2);
}

.bomatlas-menu-toggle-icon {
    width: 20px;
    height: 2px;
    background: #FFA028;
    position: relative;
    transition: background 180ms ease;
}

.bomatlas-menu-toggle-icon::before,
.bomatlas-menu-toggle-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: #FFA028;
    left: 0;
    transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.bomatlas-menu-toggle-icon::before {
    top: -6px;
}

.bomatlas-menu-toggle-icon::after {
    top: 6px;
}

.bomatlas-menu-toggle.active .bomatlas-menu-toggle-icon {
    background: transparent;
}

.bomatlas-menu-toggle.active .bomatlas-menu-toggle-icon::before {
    transform: rotate(45deg) translateY(6px);
}

.bomatlas-menu-toggle.active .bomatlas-menu-toggle-icon::after {
    transform: rotate(-45deg) translateY(-6px);
}

/* Responsive: Tablet & Mobile */
@media (max-width: 768px) {
    .bomatlas-header-container {
        padding: 10px 16px;
    }

    .bomatlas-logo {
        font-size: 18px;
    }

    /* Product switcher on mobile - keep compact */
    .bomatlas-product-switcher {
        flex-shrink: 0;
    }

    .bomatlas-product-switcher .bomatlas-logo {
        justify-content: flex-start;
        gap: 0;
    }

    /* Auth link prominent on mobile */
    .bomatlas-nav-link-auth {
        background: rgba(255, 160, 40, 0.15);
        border: 1px solid rgba(255, 160, 40, 0.3);
        padding: 10px 16px;
        border-radius: 6px;
        text-align: center;
    }

    .bomatlas-menu-toggle {
        display: flex;
    }

    .bomatlas-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #0A0E14;
        padding: 80px 20px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        transition: right 300ms cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.8);
        z-index: 1000;
        overflow-y: auto;
    }

    .bomatlas-nav.active {
        right: 0;
    }

    .bomatlas-nav-link,
    .bomatlas-nav-dropdown-trigger {
        width: 100%;
        justify-content: flex-start;
        padding: 12px 16px;
        font-size: 15px;
    }

    .bomatlas-nav-dropdown {
        width: 100%;
    }

    .bomatlas-nav-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-top: 4px;
        box-shadow: none;
        border: none;
        background: rgba(255, 160, 40, 0.05);
        border-left: 2px solid #FFA028;
        max-height: 0;
        overflow: hidden;
        transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1);
        padding: 0;
    }

    .bomatlas-nav-dropdown:hover .bomatlas-nav-dropdown-menu,
    .bomatlas-nav-dropdown:focus-within .bomatlas-nav-dropdown-menu,
    .bomatlas-nav-dropdown.active .bomatlas-nav-dropdown-menu {
        max-height: 400px;
        padding: 8px 0;
    }

    /* Mobile overlay */
    body.nav-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 999;
        animation: fadeIn 300ms ease;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    body.nav-open {
        overflow: hidden;
    }
}

/* Responsive: Small Mobile */
@media (max-width: 480px) {
    .bomatlas-logo {
        font-size: 16px;
    }

    .bomatlas-nav {
        width: 100%;
        right: -100%;
    }
}

/* Sidebar Toggle in Header */
.bomatlas-sidebar-toggle {
    position: relative;
    color: #CBD5E1;
    background: rgba(255, 160, 40, 0.08);
    border: 1px solid rgba(255, 160, 40, 0.2);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.02em;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bomatlas-sidebar-toggle:hover {
    background: rgba(255, 160, 40, 0.15);
    border-color: rgba(255, 160, 40, 0.4);
    color: #FFA028;
    transform: translateY(-1px);
    box-shadow: 0 0 8px rgba(255, 160, 40, 0.2);
}

.bomatlas-sidebar-toggle:active {
    transform: translateY(0);
}

.bomatlas-sidebar-toggle.active {
    background: rgba(255, 160, 40, 0.2);
    border-color: rgba(255, 160, 40, 0.5);
    color: #FFB85C;
}

.bomatlas-sidebar-toggle-icon {
    font-size: 16px;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bomatlas-sidebar-toggle.active .bomatlas-sidebar-toggle-icon {
    transform: rotate(90deg);
}

/* Hide text on smaller screens */
@media (max-width: 1024px) {
    .bomatlas-sidebar-toggle-text {
        display: none;
    }

    .bomatlas-sidebar-toggle {
        padding: 8px 12px;
    }
}

/* On mobile, hide header toggle and use floating button */
@media (max-width: 768px) {
    .bomatlas-sidebar-toggle {
        display: none;
    }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    .bomatlas-logo-accent {
        animation: none;
    }

    .bomatlas-nav-link,
    .bomatlas-nav-dropdown-trigger,
    .bomatlas-nav-dropdown-menu,
    .bomatlas-nav-dropdown-item,
    .bomatlas-menu-toggle-icon::before,
    .bomatlas-menu-toggle-icon::after,
    .bomatlas-sidebar-toggle-icon {
        transition: none;
    }
}
