/* ============================================
   IMTA Unified Header System v2.0
   Standardized Top Bar + Navbar Component
   ============================================ */

/* ========== TOP BAR ========== */
.top-bar {
    background: var(--primary-900);
    color: var(--white);
    padding: 0.5rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    position: relative;
    z-index: 1001;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 2rem;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-bar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.3s ease;
}

.top-bar-item:hover {
    color: var(--accent-400);
}

.top-bar-item i {
    color: var(--accent-400);
    font-size: 0.7rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-lang {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.top-bar-lang a {
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.top-bar-lang a:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

.top-bar-lang a.active {
    color: var(--accent-400);
    background: rgba(212, 160, 58, 0.15);
}

.top-bar-divider {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.5rem;
}

/* ========== MAIN NAVBAR ========== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.navbar.has-topbar {
    top: 37px;
}

.navbar--transparent {
    background: transparent;
    padding: 1.25rem 0;
}

.navbar--solid {
    background: var(--primary-800);
    padding: 1rem 0;
}

.navbar.scrolled {
    top: 0 !important;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
    padding: 0.75rem 0;
}

.navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
}

.brand-logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(212, 160, 58, 0.35);
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-logo {
    transform: rotate(6deg) scale(1.05);
}

.brand-logo img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--white);
    line-height: 1.1;
    transition: color 0.3s ease;
}

.brand-tagline {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
}

.navbar.scrolled .brand-name {
    color: var(--gray-900);
}

.navbar.scrolled .brand-tagline {
    color: var(--accent-500);
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-500);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: calc(100% - 2rem);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.navbar.scrolled .nav-link {
    color: var(--gray-600);
}

.navbar.scrolled .nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* Dropdown Menu */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.nav-dropdown-toggle i {
    font-size: 0.65rem;
    transition: transform 0.3s ease;
}

.nav-dropdown:hover .nav-dropdown-toggle i {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 240px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 0.5rem;
    margin-top: 0.5rem;
    z-index: 100;
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-600);
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-dropdown-item:hover {
    background: var(--gray-100);
    color: var(--primary-700);
}

.nav-dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 0;
}

/* Mobile Language Switcher - Hidden on Desktop */
.mobile-lang-switcher {
    display: none !important;
}

/* CTA Button */
.nav-cta {
    margin-left: 1rem;
    padding: 0.75rem 1.75rem !important;
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%) !important;
    color: var(--white) !important;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(212, 160, 58, 0.35);
    font-weight: 700;
    transition: all 0.3s ease;
}

.nav-cta::after {
    display: none !important;
}

.nav-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 160, 58, 0.45);
    background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%) !important;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1002;
}

.mobile-toggle span {
    width: 24px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.navbar.scrolled .mobile-toggle span {
    background: var(--gray-800);
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 0.125rem;
    }

    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .nav-cta {
        padding: 0.625rem 1.25rem !important;
    }
}

@media (max-width: 768px) {
    .top-bar {
        display: none;
    }

    .navbar.has-topbar {
        top: 0;
    }

    .mobile-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--white);
        flex-direction: column;
        padding: 100px 2rem 2rem;
        z-index: 999;
        overflow-y: auto;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        display: block;
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        text-align: left;
        color: var(--gray-700);
        border-bottom: 1px solid var(--gray-200);
        border-radius: 0;
    }

    .nav-link::after {
        display: none;
    }

    .nav-link:hover {
        background: var(--gray-50);
        color: var(--primary-700);
    }

    .nav-dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        margin-top: 0;
        padding: 0;
        padding-left: 1.5rem;
        background: var(--gray-50);
    }

    .nav-dropdown-item {
        border-bottom: 1px solid var(--gray-200);
        border-radius: 0;
    }

    .nav-cta {
        margin: 1.5rem 0 0 0;
        width: 100%;
        text-align: center;
        padding: 1rem 2rem !important;
    }

    /* Mobile Language Switcher - Show on Mobile */
    .mobile-lang-switcher {
        display: flex !important;
        justify-content: center;
        gap: 0.5rem;
        padding: 1.5rem 0;
        margin-top: 1rem;
        border-top: 1px solid var(--gray-200);
    }

    .mobile-lang-switcher a {
        padding: 0.5rem 1rem;
        border-radius: 8px;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--gray-600);
        background: var(--gray-100);
        transition: all 0.3s ease;
    }

    .mobile-lang-switcher a:hover {
        background: var(--gray-200);
        color: var(--gray-900);
    }

    .mobile-lang-switcher a.active {
        background: var(--accent-500);
        color: var(--white);
    }
}

@media (max-width: 480px) {
    .navbar-inner {
        padding: 0 1rem;
    }

    .brand-name {
        font-size: 1.5rem;
    }

    .brand-logo {
        width: 44px;
        height: 44px;
    }

    .brand-logo img {
        width: 36px;
        height: 36px;
    }
}

/* ========== RTL SUPPORT ========== */
[dir="rtl"] .top-bar-inner {
    flex-direction: row-reverse;
}

[dir="rtl"] .top-bar-left {
    flex-direction: row-reverse;
}

[dir="rtl"] .top-bar-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .top-bar-right {
    flex-direction: row-reverse;
}

[dir="rtl"] .navbar-inner {
    flex-direction: row-reverse;
}

[dir="rtl"] .brand {
    flex-direction: row-reverse;
}

[dir="rtl"] .nav-menu {
    flex-direction: row-reverse;
}

[dir="rtl"] .nav-cta {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .nav-dropdown-toggle {
    flex-direction: row-reverse;
}

@media (max-width: 768px) {
    [dir="rtl"] .nav-link {
        text-align: right;
    }

    [dir="rtl"] .nav-dropdown-menu {
        padding-left: 0;
        padding-right: 1.5rem;
    }

    [dir="rtl"] .nav-cta {
        margin-right: 0;
    }
}

/* ========== TOPBAR SCROLLED STATE ========== */
.top-bar.scrolled {
    position: fixed;
    top: -50px;
    left: 0;
    right: 0;
    opacity: 0;
    transition: all 0.4s ease;
}

/* ========== ACCESSIBILITY ========== */
.nav-link:focus,
.nav-cta:focus,
.mobile-toggle:focus {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
}

.nav-link:focus-visible,
.nav-cta:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-500);
    color: var(--white);
    padding: 0.5rem 1rem;
    z-index: 10000;
    font-weight: 700;
    border-radius: 0 0 8px 0;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}
