/* navbar.css */

/* Root variables */
:root {
    --navbar-height: 80px; /* base navbar height */
    --transition-speed: 0.3s;
}

/* Responsive navbar height */
@media (max-width: 768px) {
    :root {
        --navbar-height: 100px;
    }
}

/* Navbar container */
.navbar {
    width: 100%;
    background-color: #000;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
    height: var(--navbar-height);
    overflow: visible; /* Keep this as visible for dropdown */
}

/* Logo image */
.navbar-logo {
    height: calc(var(--navbar-height) - 20px);
    width: auto;
    cursor: pointer;
}

/* Left side link */
.navbar-left a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* Search container */
.navbar-search-container {
    flex-grow: 1;
    margin: 0 20px;
    position: relative;
}

/* Improved Search bar */
.navbar-search {
    width: 100%;
    padding: 10px 15px;
    font-size: 16px;
    border: none;
    border-radius: 30px;
    background-color: #f0f2f5;
    color: #000;
    transition: box-shadow var(--transition-speed) ease, background-color var(--transition-speed) ease;
}
.navbar-search:focus {
    outline: none;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
}

/* Improved Suggestions container */
.navbar-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1010;
    /* --- CHANGE HERE: Enable vertical scrolling --- */
    overflow-y: auto;
    /* --- Keep existing max-height --- */
    max-height: 400px; /* Adjust if needed */
    padding: 0;
    margin: 0;
    list-style: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-speed) ease, transform var(--transition-speed) ease;
    /* Ensure it's initially hidden until 'show' class is added */
    display: none; /* Start hidden, rely on .show to display */
}

/* When showing, fade/slide in */
.navbar-suggestions.show {
    opacity: 1;
    transform: translateY(0);
    display: block; /* Make visible */
}

/* Suggestion items */
.navbar-suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.navbar-suggestion-item:last-child {
    border-bottom: none;
}
/* --- IMPROVEMENT: Added focus style for keyboard navigation --- */
.navbar-suggestion-item:hover,
.navbar-suggestion-item:focus {
    background-color: #f5f5f5;
    outline: none; /* Remove default focus outline if desired, rely on background */
}


/* Suggestion content layout */
.suggestion-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Logo in suggestions */
.suggestion-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #fff;
    border: 1px solid #ccc;
}

/* Text block in suggestion */
.suggestion-text {
    display: flex;
    flex-direction: column;
}
.suggestion-description {
    font-size: 14px;
}
.suggestion-symbol {
    font-size: 12px;
    opacity: 0.9;
}

/* Exchange label */
.suggestion-exchange {
    margin-left: auto;
    font-size: 14px;
    color: #777;
}

/* Hide exchange label on mobile */
@media (max-width: 768px) {
    .suggestion-exchange {
        display: none;
    }
    /* Potentially adjust max-height for smaller screens if 400px is too much */
    /* .navbar-suggestions {
        max-height: 300px;
    } */
}

/* Right-side nav links (desktop) */
.navbar-right {
    display: none;
}
.navbar-right a {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    margin-left: 15px;
}
.navbar-right a:hover {
    text-decoration: underline;
    color: #ddd;
}

/* Hamburger menu (mobile) */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    cursor: pointer;
    z-index: 1001;
    margin-left: auto;
}
.hamburger span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #fff;
    transition: all 0.3s ease;
}

/* Mobile slide-out menu */
.navbar-menu {
    position: fixed;
    top: 0;
    right: -300px;
    height: 100vh;
    width: 300px;
    background-color: #000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    box-sizing: border-box;
    z-index: 999;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    padding-top: var(--navbar-height);
}
.navbar-menu.active {
    right: 0;
}
.navbar-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    margin: 10px 0;
}
.navbar-menu a:hover {
    text-decoration: underline;
}

/* Mobile menu additional styling for sidebar items */
.navbar-menu .mobile-menu-items {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.navbar-menu .mobile-menu-items a {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 18px;
    text-decoration: none;
    color: #fff;
}
.navbar-menu .mobile-menu-items a .link-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
}

/* Style for the logout container so it stays at the bottom */
.navbar-menu .mobile-menu-logout {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #444;
}

/* Desktop-specific adjustments */
@media (min-width: 769px) {
    .hamburger {
        display: none;
    }
    .navbar-right {
        display: flex;
    }
    .navbar-menu {
        display: none;
    }
}