/* ===== header.css - African Suppliers Portal Header Styles (FIXED MOBILE LAYOUT) ===== */

/* ===== HEADER SECTION ===== */
.header-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(5, 84, 64, 0.1);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 15px rgba(5, 84, 64, 0.08);
}

.header-section.scrolled {
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 4px 25px rgba(5, 84, 64, 0.12);
}

.navbar {
    padding: 1rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo {
    height: 50px;
    width: auto;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    object-fit: contain;
    max-width: 200px;
}

.logo:hover {
    transform: scale(1.05);
}

/* ===== NAVIGATION LAYOUT ===== */
.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 1rem;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    flex-shrink: 0;
}

.navbar-nav .nav-link {
    color: #333333;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: 50px;
    margin: 0 5px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #055440;
    background: rgba(5, 84, 64, 0.08);
    transform: translateY(-2px);
    text-decoration: none;
}

.navbar-nav .nav-link::before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #E88824;
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.navbar-nav .nav-link.active::before,
.navbar-nav .nav-link:hover::before {
    width: 60%;
}

/* ===== MOBILE TOGGLE BUTTON - ALWAYS VISIBLE ===== */
.navbar-toggler {
    border: none !important;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(5, 84, 64, 0.1);
    border-radius: 8px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
}

/* Force visibility on all devices and pages */
@media (max-width: 991.98px) {
    .navbar-toggler {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

.navbar-toggler:hover {
    background: rgba(5, 84, 64, 0.15);
    transform: scale(1.05);
}

.navbar-toggler:focus {
    box-shadow: 0 0 15px rgba(5, 84, 64, 0.3) !important;
}

.toggler-line {
    width: 25px;
    height: 3px;
    background: #055440;
    margin: 2px 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 2px;
    display: block;
}

/* Hamburger to X animation - FIXED */
.navbar-toggler.menu-open .toggler-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background: #E88824;
}

.navbar-toggler.menu-open .toggler-line:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.navbar-toggler.menu-open .toggler-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
    background: #E88824;
}

/* Closed state (hamburger) */
.navbar-toggler:not(.menu-open) .toggler-line {
    transform: none;
    opacity: 1;
    background: #055440;
}

/* ===== MOBILE MENU LAYOUT - ENHANCED DESIGN ===== */
.navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(5, 84, 64, 0.1);
    box-shadow: 0 10px 30px rgba(5, 84, 64, 0.1);
    z-index: 1000;
    padding: 2rem 1.5rem;
    display: none;
    transition: all 0.3s ease-in-out;
}

.navbar-collapse.show {
    display: block;
    animation: slideInDown 0.3s ease-out;
}

/* ===== MOBILE NAVIGATION GRID - AS REQUESTED ===== */
@media (max-width: 991.98px) {
    .navbar-nav {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr; /* 3 columns */
        grid-template-rows: auto auto; /* 2 rows for main nav */
        gap: 1rem;
        margin-bottom: 1.5rem;
        width: 100%;
        justify-items: stretch;
    }

    .navbar-nav .nav-item {
        width: 100%;
    }
    
    /* Row 1: Home, About Us, Products */
    .navbar-nav .nav-item:nth-child(1) { grid-column: 1; grid-row: 1; } /* Home */
    .navbar-nav .nav-item:nth-child(2) { grid-column: 2; grid-row: 1; } /* About Us */
    .navbar-nav .nav-item:nth-child(3) { grid-column: 3; grid-row: 1; } /* Products */
    
    /* Row 2: Services, Blog, Contact Us */
    .navbar-nav .nav-item:nth-child(4) { grid-column: 1; grid-row: 2; } /* Services */
    .navbar-nav .nav-item:nth-child(5) { grid-column: 2; grid-row: 2; } /* Blog */
    .navbar-nav .nav-item:nth-child(6) { grid-column: 3; grid-row: 2; } /* Contact Us */

    .navbar-nav .nav-link {
        padding: 15px 10px;
        width: 100%;
        text-align: center;
        border-radius: 10px;
        margin: 0;
        background: rgba(5, 84, 64, 0.05);
        border: 1px solid rgba(5, 84, 64, 0.1);
        transition: all 0.3s ease;
        font-weight: 500;
        color: #333333;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 50px;
        text-decoration: none;
    }

    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link.active {
        background: rgba(5, 84, 64, 0.12);
        color: #055440;
        transform: translateY(-2px);
        border-color: rgba(5, 84, 64, 0.2);
        text-decoration: none;
    }

    .navbar-nav .nav-link::before {
        display: none;
    }
}

/* ===== ROW 3: LOGIN + LANGUAGE SELECTOR (70% + 30%) ===== */
/* This section will be dynamically created by JavaScript */
.mobile-bottom-section {
    display: grid;
    grid-template-columns: 70% 30%;
    gap: 1rem;
    width: 100%;
    margin-top: 1.5rem;
}

.mobile-login-section {
    grid-column: 1;
}

.mobile-language-section {
    grid-column: 2;
    width: 100%;
    position: relative;
}

.login-register-btn-mobile {
    background: linear-gradient(135deg, #055440 0%, #E88824 100%) !important;
    color: white !important;
    border: 2px solid #055440 !important;
    border-radius: 10px !important;
    padding: 15px 20px !important;
    font-weight: 600 !important;
    width: 100% !important;
    text-align: center !important;
    font-size: 0.9rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    position: relative;
    overflow: hidden;
}

.login-register-btn-mobile::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #E88824 0%, #643919 100%);
    transition: left 0.3s ease;
    z-index: -1;
}

.login-register-btn-mobile:hover {
    color: white !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 8px 20px rgba(232, 136, 36, 0.3) !important;
    border-color: #E88824 !important;
    text-decoration: none !important;
}

.login-register-btn-mobile:hover::before {
    left: 0;
}

.language-select-mobile {
    background: rgba(5, 84, 64, 0.08);
    border: 2px solid rgba(5, 84, 64, 0.15);
    border-radius: 10px;
    color: #333333;
    padding: 15px 10px 15px 35px;
    font-size: 0.8rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    outline: none;
    text-align: center;
    position: relative;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23333" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 8px;
}

.language-select-mobile:focus {
    border-color: #055440;
    background: rgba(5, 84, 64, 0.1);
    box-shadow: 0 0 10px rgba(5, 84, 64, 0.2);
}

.language-select-mobile option {
    background: white;
    color: #333333;
    padding: 8px;
}

/* Mobile language selector globe icon */
.mobile-language-section::before {
    content: '🌐';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    z-index: 2;
    pointer-events: none;
}

/* ===== DESKTOP RIGHT SECTION - ALWAYS VISIBLE ON DESKTOP ===== */
.header-right-section {
    display: none !important; /* Hidden on mobile */
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
    min-width: 0;
    position: relative !important;
    z-index: 10 !important;
}

/* CRITICAL: Show only on desktop (992px and above) */
@media (min-width: 992px) {
    .header-right-section {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 10 !important;
    }
    
    .language-selector {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
    }
    
    .login-register-section {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
    }

    /* Override any hiding classes */
    .header-right-section.d-none {
        display: flex !important;
    }
}

.language-selector {
    flex-shrink: 0;
    position: relative;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.language-select {
    background: rgba(5, 84, 64, 0.05);
    border: 2px solid rgba(5, 84, 64, 0.15);
    border-radius: 20px;
    color: #333333;
    padding: 8px 12px 8px 35px;
    font-size: 0.9rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    min-width: 100px;
    outline: none;
    position: relative;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23333" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 8px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.language-select:hover {
    background: rgba(5, 84, 64, 0.08);
    border-color: rgba(5, 84, 64, 0.25);
    transform: translateY(-1px);
}

.language-select:focus {
    border-color: #E88824;
    box-shadow: 0 0 15px rgba(232, 136, 36, 0.2);
    background: rgba(5, 84, 64, 0.1);
}

.language-select option {
    background: white;
    color: #333333;
    padding: 8px;
}

/* Desktop language selector globe icon */
.language-selector::before {
    content: '🌐';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    z-index: 2;
    pointer-events: none;
}

.login-register-section {
    flex-shrink: 0;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.login-register-btn-desktop {
    background: linear-gradient(135deg, #055440 0%, #E88824 100%);
    color: white;
    border: 2px solid #055440;
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(5, 84, 64, 0.2);
}

.login-register-btn-desktop::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #E88824 0%, #643919 100%);
    transition: left 0.3s ease;
    z-index: -1;
}

.login-register-btn-desktop:hover {
    color: white;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(232, 136, 36, 0.4);
    border-color: #E88824;
    text-decoration: none;
}

.login-register-btn-desktop:hover::before {
    left: 0;
}

.login-register-btn-desktop i {
    font-size: 0.9rem;
}

/* ===== LANGUAGE LOADING STATES ===== */
.language-select.loading,
.language-select-mobile.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.language-select.loading::after,
.language-select-mobile.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 25px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(5, 84, 64, 0.3);
    border-top: 2px solid #055440;
    border-radius: 50%;
    animation: languageSpinner 0.8s linear infinite;
    transform: translateY(-50%);
}

@keyframes languageSpinner {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* ===== TRANSLATION ANIMATION STATES ===== */
.language-changing .navbar-nav .nav-link,
.language-changing .login-register-btn-desktop,
.language-changing .login-register-btn-mobile {
    opacity: 0.8;
    transition: all 0.3s ease;
}

/* ===== DESKTOP VIEW ===== */
@media (min-width: 992px) {
    .mobile-language-section,
    .mobile-login-section,
    .mobile-bottom-section {
        display: none !important;
    }
    
    .navbar-toggler {
        display: none !important;
    }
    
    .navbar-collapse {
        position: static;
        background: none;
        backdrop-filter: none;
        border: none;
        box-shadow: none;
        padding: 0;
        display: block !important;
        width: auto;
    }
    
    .navbar-nav {
        flex-direction: row;
        gap: 0.5rem;
        margin-bottom: 0;
        width: auto;
        display: flex;
        grid-template-columns: none;
        grid-template-rows: none;
    }
    
    .navbar-nav .nav-link {
        padding: 12px 20px;
        width: auto;
        text-align: center;
        border-radius: 50px;
        background: transparent;
        border: none;
        min-height: auto;
        font-size: 0.9rem;
    }
    
    .navbar-nav .nav-link::before {
        display: block;
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .navbar-nav .nav-link {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .logo {
        height: 45px;
    }
    
    .login-register-btn-desktop {
        padding: 8px 16px;
        font-size: 0.85rem;
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.8rem 0;
    }
    
    .logo {
        height: 40px;
        max-width: 180px;
    }
    
    .navbar-nav .nav-link {
        font-size: 0.8rem;
        padding: 12px 8px;
    }
    
    .login-register-btn-mobile {
        font-size: 0.8rem !important;
        padding: 12px 16px !important;
    }
    
    .language-select-mobile {
        font-size: 0.7rem;
        padding: 12px 8px 12px 30px;
    }
    
    .mobile-language-section::before {
        font-size: 0.8rem;
        left: 8px;
    }
}

@media (max-width: 576px) {
    .navbar {
        padding: 0.7rem 0;
    }
    
    .logo {
        height: 38px;
        max-width: 160px;
    }
    
    .navbar-collapse {
        padding: 1rem;
    }
    
    .navbar-nav .nav-link {
        font-size: 0.75rem;
        padding: 10px 6px;
    }
    
    .login-register-btn-mobile {
        font-size: 0.75rem !important;
        padding: 10px 14px !important;
    }
    
    .language-select-mobile {
        font-size: 0.65rem;
        padding: 10px 6px 10px 25px;
    }
    
    .mobile-language-section::before {
        font-size: 0.7rem;
        left: 6px;
    }
}

/* ===== LANGUAGE-SPECIFIC FONT ADJUSTMENTS ===== */
.lang-ar .navbar-nav .nav-link,
.lang-ar .login-register-btn-desktop,
.lang-ar .login-register-btn-mobile {
    font-family: 'Tajawal', 'Arial', sans-serif;
    line-height: 1.4;
}

.lang-zh .navbar-nav .nav-link,
.lang-zh .login-register-btn-desktop,
.lang-zh .login-register-btn-mobile {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    line-height: 1.3;
}

/* Mobile text adjustments for Arabic and Chinese */
@media (max-width: 768px) {
    .lang-ar .navbar-nav .nav-link,
    .lang-zh .navbar-nav .nav-link {
        font-size: 0.75rem;
        line-height: 1.2;
    }
    
    .lang-ar .login-register-btn-mobile,
    .lang-zh .login-register-btn-mobile {
        font-size: 0.75rem !important;
    }
}

/* ===== BODY SCROLL LOCK ===== */
body.menu-open {
    overflow: hidden;
}

/* ===== ANIMATIONS ===== */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ACCESSIBILITY ===== */
.nav-link:focus,
.language-select:focus,
.language-select-mobile:focus,
.login-register-btn-desktop:focus,
.login-register-btn-mobile:focus,
.navbar-toggler:focus {
    outline: 2px solid #055440 !important;
    outline-offset: 2px;
    box-shadow: 0 0 10px rgba(5, 84, 64, 0.3) !important;
}

/* ===== TOUCH OPTIMIZATIONS ===== */
@media (hover: none) and (pointer: coarse) {
    .navbar-nav .nav-link:hover,
    .navbar-toggler:hover,
    .logo:hover,
    .login-register-btn-desktop:hover,
    .login-register-btn-mobile:hover,
    .language-select:hover,
    .language-select-mobile:hover {
        transform: none;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .header-section {
        position: static;
        background: white;
        box-shadow: none;
        border-bottom: 1px solid #000;
    }
    
    .navbar-nav .nav-link {
        color: #000 !important;
    }
    
    .header-right-section,
    .mobile-language-section,
    .navbar-toggler {
        display: none !important;
    }
}