/* ============================================
   HEADER.CSS - Header and navigation styles
   ============================================ */

header {
    background: var(--brand-primary, #c41e3a);
    padding: 0.75rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

.header-content {
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.5px;
    margin-left: 1rem;
}

.header-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.header-nav a {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
}

/* Header search box (used in filing viewer) */
.header-search-box {
    flex: 1;
    max-width: 400px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
}

.header-search-box input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 3px;
    font-size: 0.9rem;
}

.header-search-box input::placeholder {
    color: var(--text-muted, #999);
}

/* Header suggestions dropdown */
.header-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white, white);
    border: 1px solid var(--border-color, #ddd);
    border-top: none;
    border-radius: 0 0 3px 3px;
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1));
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    margin-top: 2px;
}

.header-suggestions.active {
    display: block;
}

.header-suggestion-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light, #f0f0f0);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-suggestion-item:last-child {
    border-bottom: none;
}

.header-suggestion-item:hover {
    background: var(--bg-gray, #fafafa);
}

.header-suggestion-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-suggestion-ticker {
    font-weight: 600;
    color: var(--brand-primary, #c41e3a);
    font-size: 0.9rem;
    min-width: 50px;
}

.header-suggestion-name {
    color: var(--text-primary, #333);
    font-size: 0.85rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .header-nav {
        gap: 1rem;
    }

    .header-nav a {
        font-size: 0.85rem;
    }

    .header-search-box {
        display: none;
    }
}

/* ============================================
   NAVIGATION LINKS & DROPDOWN
   ============================================ */

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link:hover {
    color: #fff;
}

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

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: white;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    padding: 0.5rem 0;
    min-width: 220px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
}

.dropdown-container:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(5px);
}

/* Invisible bridge to prevent menu closing */
.dropdown-container::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 15px;
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary, #333);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-gray, #fafafa);
}

.dropdown-item span {
    color: var(--text-muted, #999);
    font-size: 0.8rem;
    display: block;
    margin-top: 2px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light, #f0f0f0);
    margin: 0.35rem 0;
}

.arrow-icon {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
    opacity: 0.7;
}

.dropdown-container:hover .arrow-icon {
    transform: rotate(180deg);
}

/* Separator */
.header-separator {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   AUTH BUTTONS
   ============================================ */

.user-email {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-login {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.btn-login:hover {
    color: #fff;
}

.btn-signup {
    background: white;
    color: var(--brand-primary, #c41e3a);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s, transform 0.2s;
}

.btn-signup:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
}

.btn-signout {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-signout:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}

/* Hide elements based on auth state - JS will toggle these */
.auth-logged-in { display: none; }
.auth-logged-out { display: flex; gap: 1rem; align-items: center; }

body.logged-in .auth-logged-in { display: flex; gap: 1rem; align-items: center; }
body.logged-in .auth-logged-out { display: none; }

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */

@media (max-width: 768px) {
    .header-right {
        gap: 0.75rem;
    }

    .nav-link.desktop-only,
    .dropdown-container {
        display: none;
    }

    .header-separator {
        display: none;
    }

    .btn-signup, .btn-signout {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
}
