/* Modern Navbar Styles */

/* Using CSS variables from base.css */

/* Reset and Base Styles */
.modern-navbar * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Force all text to be black */
.modern-navbar {
    color: #1a1a1a !important;
}

.modern-navbar a,
.modern-navbar span,
.modern-navbar strong,
.modern-navbar small,
.modern-navbar h4,
.modern-navbar button {
    color: inherit;
}

/* Main Navbar Container */
.modern-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: var(--z-nav-base);
    transition: var(--transition);
}

.modern-navbar.scrolled {
    box-shadow: var(--navbar-shadow);
}

/* Inner Container */
.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo Section */
.navbar-logo {
    flex-shrink: 0;
}

.navbar-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.navbar-logo img {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease;
}

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

/* Desktop Menu */
.navbar-menu {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 40px;
}

.menu-list {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
}

.menu-item {
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: var(--text-primary) !important;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

.menu-link:hover {
    background: var(--hover-bg);
    color: #0066ff !important;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.menu-item:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Mega Dropdown */
.mega-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    min-width: 320px;
}

.menu-item:hover .mega-dropdown {
    opacity: 1;
    visibility: visible;
    margin-top: 5px;
}

.dropdown-content {
    padding: 20px;
}

.dropdown-section h4 {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.dropdown-link {
    display: flex;
    align-items: start;
    gap: 12px;
    padding: 12px;
    margin: 0 -12px;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition);
}

.dropdown-link:hover {
    background: var(--hover-bg);
}

.dropdown-link .icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.dropdown-link strong {
    display: block;
    color: #1a1a1a !important;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.dropdown-link small {
    display: block;
    color: #666 !important;
    font-size: 12px;
    line-height: 1.4;
}

/* Right Actions Section */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Language Switcher */
.language-switcher {
    position: relative;
}

.lang-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
}

.lang-button:hover {
    border-color: var(--accent-color);
    background: var(--hover-bg);
}

.lang-arrow {
    transition: transform 0.3s ease;
}

.language-switcher.active .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    min-width: 280px;
}

.language-switcher.active .lang-dropdown {
    opacity: 1;
    visibility: visible;
    margin-top: 5px;
}

.lang-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    color: var(--text-primary);
    text-align: left;
}

.lang-option:hover {
    background: var(--hover-bg);
}

.lang-option.active {
    background: var(--accent-color);
    color: white;
}

.lang-option .flag {
    font-size: 20px;
}

.lang-option .lang-name {
    flex: 1;
    font-weight: 500;
}

/* CTA Button */
.navbar-cta {
    padding: 10px 24px;
    background: var(--primary-color);
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
}

.navbar-cta:hover {
    background: #3d8a3d;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 157, 74, 0.3);
    color: white !important;
}

.navbar-cta span {
    color: white !important;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin: -10px;
    position: relative;
    z-index: var(--z-nav-base);
    min-width: 44px;
    min-height: 44px;
}

.hamburger {
    display: block;
    width: 24px;
    height: 20px;
    position: relative;
}

.hamburger span {
    display: block;
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger span:nth-child(3) { bottom: 0; }

.mobile-toggle.active .hamburger span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.mobile-toggle.active .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active .hamburger span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: var(--z-nav-mobile);
    max-width: 100vw;
    min-height: 400px;
    height: auto;
    max-height: calc(100vh - 70px);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.mobile-menu.active {
    transform: translateX(0);
}

.mobile-menu-inner {
    padding: 30px;
    display: flex;
    flex-direction: column;
    min-height: 350px;
    height: auto;
    justify-content: flex-start;
}

.mobile-nav {
    list-style: none;
    margin-bottom: 40px;
    flex: 1;
}

.mobile-nav li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.mobile-nav li:last-child {
    border-bottom: none;
}

.mobile-nav a,
.submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    color: #1a1a1a !important;
    text-decoration: none;
    font-size: 18px;
    font-weight: 500;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 48px;
}

.mobile-nav a:hover,
.submenu-toggle:hover {
    color: #0066ff !important;
}

.submenu {
    display: none;
    list-style: none;
    padding-left: 20px;
    padding-bottom: 10px;
}

.submenu.active {
    display: block;
}

.submenu a {
    font-size: 16px;
    font-weight: 400;
    padding: 12px 0;
    min-height: 40px;
    color: #666 !important;
}

/* Mobile Language Grid */
.mobile-languages {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.mobile-languages h4 {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    font-weight: 600;
}

.mobile-lang-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.mobile-lang-option {
    padding: 12px 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    text-align: center;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    text-decoration: none;
}

.mobile-lang-option:hover {
    border-color: var(--accent-color);
    background: var(--hover-bg);
}

.mobile-lang-option.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Mobile CTA */
.mobile-cta-button {
    display: block;
    width: 100%;
    padding: 15px;
    background: var(--accent-color);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: var(--transition);
}

.mobile-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 102, 255, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .navbar-inner {
        padding: 0 20px;
    }

    .navbar-menu {
        padding: 0 20px;
    }

    .menu-link {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 1025px) {
    /* Fix navbar-actions container for mobile */
    .navbar-actions {
        flex-direction: row-reverse;
        gap: 10px;
        align-items: center;
        justify-content: flex-end;
    }

    /* Hide desktop elements */
    .navbar-menu,
    .navbar-cta {
        display: none !important;
    }

    /* Ensure mobile toggle is always visible */
    .mobile-toggle {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative;
        z-index: var(--z-nav-dropdown);
        order: 1;
    }

    .language-switcher {
        order: 2;
    }

    .lang-button {
        padding: 8px;
    }

    .lang-button .current-flag {
        font-size: 20px;
    }

    .lang-arrow {
        display: none;
    }

    .lang-dropdown {
        right: -10px;
    }
}


/* RTL Support for Arabic */
[dir="rtl"] .modern-navbar {
    direction: rtl;
}

[dir="rtl"] .navbar-inner {
    flex-direction: row-reverse;
}

[dir="rtl"] .menu-list {
    flex-direction: row-reverse;
}

[dir="rtl"] .dropdown-link {
    flex-direction: row-reverse;
}

[dir="rtl"] .lang-option {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .mobile-menu {
    transform: translateX(-100%);
    max-width: 100vw;
    overflow-x: hidden;
}

[dir="rtl"] .mobile-menu.active {
    transform: translateX(0);
}

/* Smooth Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Loading State */
.modern-navbar.loading {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    animation-delay: 0.2s;
}