/* ===================================
   Navigation Bar - Financial Premium
   =================================== */

:root {
    --nav-bg: rgba(5, 11, 24, 0.85);
    --nav-border: rgba(255, 255, 255, 0.08);
    --accent-blue: #4A90E2;
    --text-white: #F5F7FA;
    --glass-blur: 15px;
    --ticker-bg: rgba(0, 0, 0, 0.3);
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* Height is determined by content to include ticker */
    background: var(--nav-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--nav-border);
    z-index: 1000;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column; /* Stack Nav and Ticker */
}

/* Scrolled State: Floating Island Effect 
   Matches the "Precision" feel of financial platforms */
.navbar.scrolled {
    top: 15px;
    width: 95%;
    max-width: 1300px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.navbar-container {
    width: 100%;
    max-width: 1400px;
    height: 80px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: height 0.3s ease;
}

.navbar.scrolled .navbar-container {
    height: 65px;
}

/* Logo Section */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    z-index: 1001;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
}

.logo-text {
    color: var(--text-white);
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: -0.5px;
}

.logo-accent {
    color: var(--accent-blue);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Desktop Navigation */
.nav-links {
    display: flex;
    gap: 35px;
    list-style: none;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: 0.3s ease;
    position: relative;
    padding: 8px 0;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent-blue);
}

/* High-end animated underline */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-blue);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px var(--accent-blue);
}

.nav-link:hover::after {
    width: 100%;
}

/* Premium CTA Button */
.cta-button-premium {
    background: white;
    color: #050b18;
    border: none;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.cta-button-premium:hover {
    transform: translateY(-2px);
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
}

/* ===================================
   Integrated Thin Market Bar
   =================================== */

.fixed-market-bar {
    width: 100%;
    height: 32px;
    background: var(--ticker-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.ticker-track {
    display: flex;
    white-space: nowrap;
    animation: ticker-scroll 40s linear infinite;
}

.ticker-content {
    display: flex;
    align-items: center;
}

.ticker-item {
    padding: 0 30px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Inter', sans-serif;
}

.ticker-item .price {
    color: #ffffff;
    margin-left: 6px;
    font-weight: 600;
}

.ticker-item .up { color: #10b981; margin-left: 4px; }
.ticker-item .down { color: #ef4444; margin-left: 4px; }

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ===================================
   Responsive Feature
   =================================== */

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 5px;
}

.mobile-menu-btn span {
    width: 28px;
    height: 2px;
    background: white;
    transition: 0.4s;
    border-radius: 2px;
}

@media (max-width: 992px) {
    .mobile-menu-btn { display: flex; }

    .navbar-container {
        height: 70px;
        padding: 0 25px;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: #050b18;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        gap: 30px;
    }

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

    .nav-link { 
        font-size: 1.5rem; 
        color: white;
    }
    
    .cta-button-premium { display: none; }
    
    .navbar.scrolled {
        width: 100%;
        top: 0;
        border-radius: 0;
    }
}
.nav-logo-img {
    height: 42px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo:hover .nav-logo-img {
    transform: scale(1.05);
}

/* Ensure ticker colors work */
.ticker-item .up { color: #2ecc71 !important; font-weight: bold; }
.ticker-item .down { color: #e74c3c !important; font-weight: bold; }
/* --- Dropdown Logic --- */
.nav-item.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #0a1322; /* Dark professional theme */
    min-width: 200px;
    padding: 15px 0;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    display: none; /* Hidden by default */
    list-style: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.nav-item.dropdown:hover .dropdown-menu {
    display: block;
    animation: navFadeIn 0.3s ease;
}

.dropdown-link {
    padding: 10px 20px;
    display: block;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.3s;
}

.dropdown-link:hover {
    background: rgba(74, 144, 226, 0.1);
    color: #4A90E2;
}

/* --- Mobile Responsiveness --- */
.mobile-close-container {
    display: none; /* Hidden on desktop */
    width: 100%;
    padding: 20px;
    justify-content: flex-end;
}

.close-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
}

@media (max-width: 992px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%; /* Off-screen */
        width: 80%;
        height: 100vh;
        background: #050b18;
        flex-direction: column;
        align-items: flex-start;
        padding: 20px 40px;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2000;
    }

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

    .mobile-close-container {
        display: flex;
    }

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

    .dropdown-menu {
        position: static; /* Stack vertically on mobile */
        background: transparent;
        border: none;
        box-shadow: none;
        padding-left: 20px;
        display: block; /* Always visible in mobile menu or toggle via JS */
    }
}

@keyframes navFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Container for the arrow */
.arrow-icon {
  font-size: 10px;
  margin-left: 5px;
  transition: transform 0.3s ease;
}

.is-open .arrow-icon {
  transform: rotate(180deg);
}

/* Dropdown Menu Styling */
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #0a1322;
  min-width: 200px;
  border-radius: 8px;
  padding: 10px 0;
  
  /* The "Anti-Hide" Logic */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none; /* User can't click it when hidden */
}

/* Shows when class 'is-open' is added via JS OR on hover for desktop */
.nav-item.dropdown:hover .dropdown-menu,
.nav-item.dropdown.is-open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto; /* Allows clicking on buttons */
}

/* Important: Add an invisible bridge so the mouse doesn't "fall" 
   between the link and the menu */
.nav-item.dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 20px; /* Bridge gap */
}

/* Mobile Specific Adjustments */
@media (max-width: 992px) {
  .dropdown-menu {
    position: static; /* Stack inside the mobile drawer */
    opacity: 1;
    visibility: visible;
    display: none; /* Controlled by .is-open on mobile */
    transform: none;
    background: rgba(255,255,255,0.05);
    margin-top: 10px;
  }
  
  .is-open .dropdown-menu {
    display: block;
  }
}