/* ==========================================================================
   Header Component — Top Bar + Main Header + Search Dropdown
   ========================================================================== */

/* ===== TOP BAR ===== */
.gm-topbar {
    background: var(--gm-primary);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    line-height: 1;
}

.gm-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
}

.gm-topbar-left,
.gm-topbar-right {
    display: flex;
    align-items: center;
    gap: 0;
}

.gm-topbar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.gm-topbar-item svg {
    opacity: 0.6;
    flex-shrink: 0;
}

.gm-topbar-link {
    transition: color var(--gm-transition);
    cursor: pointer;
}

.gm-topbar-link:hover {
    color: #fff;
}

.gm-topbar-divider {
    width: 1px;
    height: 14px;
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

/* Language Button */
.gm-topbar-lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--gm-transition);
}

.gm-topbar-lang:hover {
    color: #fff;
}

.gm-topbar-lang .gm-lang-flag {
    width: 18px;
    height: 13px;
    border-radius: 2px;
    object-fit: cover;
}

.gm-topbar-lang svg {
    opacity: 0.5;
}

/* ===== MAIN HEADER ===== */
.gm-header {
    background: var(--gm-bg);
    border-bottom: 1px solid var(--gm-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow var(--gm-transition), border-color var(--gm-transition);
}

.gm-header.is-scrolled {
    border-color: var(--gm-border);
}

.gm-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--gm-header-h);
    gap: var(--gm-gap-md);
}

/* ===== LOGO ===== */
.gm-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.gm-logo img {
    height: 36px;
    width: auto;
}

.gm-logo-text {
    display: flex;
    align-items: center;
    gap: var(--gm-gap-xs);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--gm-text);
    letter-spacing: -0.02em;
}

.gm-logo-badge {
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-light) 100%);
    color: #fff;
    font-weight: 900;
    font-size: 1rem;
    padding: 6px 12px;
    border-radius: var(--gm-radius-sm);
    line-height: 1;
}

/* ===== DESKTOP NAVIGATION ===== */
.gm-header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.gm-nav-list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.gm-nav-list li {
    position: relative;
}

.gm-nav-list li a,
.gm-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gm-text);
    border-radius: var(--gm-radius-sm);
    transition: color var(--gm-transition), background var(--gm-transition);
    white-space: nowrap;
}

.gm-nav-list li a:hover,
.gm-nav-link:hover {
    color: var(--gm-primary);
    background: var(--gm-primary-subtle);
}

.gm-nav-list li.current-menu-item > a,
.gm-nav-list li.current_page_item > a {
    color: var(--gm-primary);
    font-weight: 600;
    background: var(--gm-primary-subtle);
}

/* ===== HEADER RIGHT (actions) ===== */
.gm-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Icon Buttons (search, favorites) */
.gm-header-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--gm-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gm-text);
    background: transparent;
    position: relative;
    transition: background var(--gm-transition), color var(--gm-transition);
}

.gm-header-icon-btn:hover {
    background: var(--gm-bg-light);
    color: var(--gm-primary);
}

.gm-header-icon-btn:focus-visible {
    outline: none;
    box-shadow: var(--gm-focus-ring);
}

/* Favorites Badge */
.gm-header-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--gm-danger);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 4px;
}

/* Profile Button */
.gm-header-profile {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gm-primary) 0%, var(--gm-primary-light) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--gm-transition), transform var(--gm-transition);
}

.gm-header-profile:hover {
    opacity: 0.85;
    color: #fff;
    transform: scale(1.05);
}

.gm-header-profile:focus-visible {
    outline: none;
    box-shadow: var(--gm-focus-ring);
}

/* CTA Button */
.gm-header-cta {
    border-radius: var(--gm-radius-full);
    padding: 10px 22px;
    font-size: 0.875rem;
    margin-left: 4px;
}

/* Mobile Menu Toggle */
.gm-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    color: var(--gm-text);
    border-radius: var(--gm-radius-sm);
    transition: color var(--gm-transition), background var(--gm-transition);
}

.gm-menu-toggle:hover {
    color: var(--gm-primary);
    background: var(--gm-bg-light);
}

/* ===== SEARCH DROPDOWN ===== */
.gm-header-search-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--gm-bg);
    border-bottom: 1px solid var(--gm-border);
    box-shadow: var(--gm-shadow-lg);
    padding: var(--gm-gap-md) 0;
    transform: translateY(-10px);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--gm-transition-slow), opacity var(--gm-transition-slow), visibility var(--gm-transition-slow);
    z-index: 999;
}

.gm-header-search-dropdown.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.gm-header-search-form {
    display: flex;
    align-items: center;
    gap: var(--gm-gap-sm);
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}

.gm-header-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gm-text-muted);
    display: flex;
    pointer-events: none;
}

.gm-header-search-input {
    flex: 1;
    height: 50px;
    padding: 0 16px 0 48px;
    border: 2px solid var(--gm-border);
    border-radius: var(--gm-radius);
    font-size: 1rem;
    color: var(--gm-text);
    background: var(--gm-bg);
    outline: none;
    transition: border-color var(--gm-transition);
}

.gm-header-search-input::placeholder {
    color: var(--gm-text-muted);
}

.gm-header-search-input:focus {
    border-color: var(--gm-primary);
}

.gm-header-search-form .gm-btn {
    height: 50px;
    padding: 0 24px;
    flex-shrink: 0;
}

.gm-header-search-close {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gm-text-muted);
    border-radius: var(--gm-radius-sm);
    transition: color var(--gm-transition), background var(--gm-transition);
    flex-shrink: 0;
}

.gm-header-search-close:hover {
    color: var(--gm-text);
    background: var(--gm-bg-light);
}

/* ===== RESPONSIVE ===== */

/* Desktop: show nav, hide mobile toggle */
@media (min-width: 1025px) {
    .gm-menu-toggle {
        display: none;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .gm-header-nav {
        display: none;
    }

    .gm-header-cta {
        display: none;
    }

    .gm-topbar-left {
        display: none;
    }

    .gm-topbar-inner {
        justify-content: flex-end;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .gm-topbar {
        display: none;
    }

    .gm-header-inner {
        height: 60px;
    }

    .gm-header-profile {
        display: none;
    }

    .gm-header-search-form {
        flex-wrap: wrap;
    }

    .gm-header-search-input {
        height: 46px;
        font-size: 0.9375rem;
    }

    .gm-header-search-form .gm-btn {
        height: 46px;
    }
}

@media (max-width: 480px) {
    .gm-logo img {
        height: 30px;
    }

    .gm-logo-text {
        font-size: 1.25rem;
    }

    .gm-logo-badge {
        font-size: 0.8125rem;
        padding: 5px 10px;
    }

    .gm-header-icon-btn {
        width: 38px;
        height: 38px;
    }

    .gm-header-right {
        gap: 2px;
    }
}
