/* Multi-Language Support Styles */

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .header-search-wrapper {
    direction: rtl;
}

[dir="rtl"] .language-switcher {
    margin-left: 15px;
    margin-right: 0;
}

[dir="ltr"] .language-switcher {
    margin-right: 15px;
    margin-left: 0;
}

/* Language Switcher Enhancements */
.language-switcher {
    position: relative;
    display: inline-block;
    margin-left: 15px;
    z-index: 99999;
}

.language-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 100px;
    position: relative;
    z-index: 99999;
}

.language-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.language-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 999999;
    display: none;
    margin-top: 8px;
    overflow: hidden;
}

.language-menu.show {
    display: block;
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background-color: #f8f9fa;
    color: #333;
    text-decoration: none;
    padding-left: 20px;
}

.language-option.active {
    background-color: #007bff;
    color: white;
}

.language-option.active:hover {
    background-color: #0056b3;
    color: white;
}

.flag-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

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

.language-option .fa-check {
    margin-left: auto;
    color: #28a745;
}

.language-option.active .fa-check {
    color: white;
}

/* RTL Language Menu */
[dir="rtl"] .language-menu {
    right: auto;
    left: 0;
}

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

[dir="rtl"] .language-option:hover {
    padding-right: 20px;
    padding-left: 16px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .language-switcher {
        margin: 0 10px;
    }
    
    .language-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 80px;
    }
    
    .language-menu {
        min-width: 140px;
        margin-top: 5px;
        right: 0;
        left: auto;
    }
    
    [dir="rtl"] .language-menu {
        right: auto;
        left: 0;
    }
    
    .language-option {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .flag-icon {
        font-size: 16px;
        width: 20px;
    }
}

@media (max-width: 480px) {
    .language-switcher {
        position: relative;
        margin: 0 5px;
    }
    
    [dir="rtl"] .language-switcher {
        margin: 0 5px;
    }
    
    .language-btn {
        padding: 5px 8px;
        font-size: 12px;
        min-width: auto;
        gap: 3px;
        border-width: 1px;
    }
    
    .current-lang {
        display: none;
    }
    
    .language-btn .fa-globe {
        margin-right: 0;
        font-size: 14px;
    }
    
    .language-btn .fa-chevron-down {
        display: none;
    }
    
    .language-menu {
        min-width: 120px;
        right: 0;
        left: auto;
    }
    
    [dir="rtl"] .language-menu {
        right: auto;
        left: 0;
    }
    
    .language-option {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* Header Integration */
.header-top {
    position: relative;
    overflow-x: hidden;
    z-index: 1000;
    width: 100%;
}

.header-top .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    
    /* Hide scrollbar for Chrome, Safari and Opera */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.header-top .container::-webkit-scrollbar {
    display: none;  /* Chrome, Safari, Opera */
}

.header-top .language-switcher {
    order: 1;
    flex-shrink: 0;
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

.header-top * {
    box-sizing: border-box;
}

/* Ensure all header items don't cause overflow */
.header-phone,
.header-social,
.header-search-wrapper,
.top-header-contact-btn,
.header-top-menu {
    flex-shrink: 0;
}

/* Header search wrapper - ensure clickable */
.header-search-wrapper {
    position: relative;
    z-index: 10;
}

.header-search-wrapper input {
    cursor: text;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

.header-search-wrapper i {
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

/* Ensure all header interactive elements are clickable */
.header-phone,
.header-social,
.top-header-contact-btn {
    position: relative;
    z-index: 10;
}

.header-phone a,
.header-social a,
.top-header-contact-btn {
    pointer-events: auto;
    cursor: pointer;
}

/* Top menu toggle functionality */
.header-top-menu {
    display: block;
    position: relative;
}

.header-top-menu.header-top-menu-open {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 500;
}

/* Hide burger menu button on desktop */
.top-menu-btn {
    display: none;
    cursor: pointer;
    z-index: 100;
}

/* Top menu default styling for desktop */
.header-top-menu ul {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-top-menu ul li {
    display: inline-block;
    padding: 0 5px;
}

.header-top-menu ul li a {
    display: block;
    padding: 5px 10px;
    text-decoration: none;
}

/* Smooth transitions for language changes */
.language-transition {
    transition: all 0.3s ease;
}

/* Loading state */
.language-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Success feedback */
.language-success {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .language-menu {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .language-option {
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .language-option:hover {
        background-color: #4a5568;
        color: #e2e8f0;
    }
}

/* Print styles */
@media print {
    .language-switcher {
        display: none;
    }
}

/* Desktop - Ensure menu is visible and burger is hidden */
@media (min-width: 769px) {
    .header-top {
        overflow-x: visible;
    }
    
    .header-top .container {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 10px;
    }
    
    .header-top .top-menu-btn,
    header .top-menu-btn,
    .top-menu-btn {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Bottom header - hide mobile menu button on desktop */
    .mobMenu {
        display: none !important;
    }
    
    /* Bottom header - ensure main menu is visible on desktop */
    .bottom-header .mainMenuContainer,
    .top-menu .mainMenuContainer {
        display: flex !important;
        flex-direction: row !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        width: auto !important;
        flex-basis: auto !important;
    }
    
    .mainMenuContainer > li {
        display: inline-block !important;
        border: none !important;
        width: auto !important;
    }
    
    .header-top .header-top-menu,
    header .header-top-menu,
    .header-top-menu {
        display: block !important;
        background: transparent !important;
        padding: 0 !important;
        visibility: visible !important;
        opacity: 1 !important;
        max-height: none !important;
        flex-shrink: 1;
        min-width: 0;
    }
    
    .header-top-menu ul {
        display: flex !important;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
        gap: 5px;
    }
    
    .header-top-menu ul li {
        display: inline-block !important;
        width: auto !important;
        border-bottom: none !important;
    }
    
    .header-top-menu ul li a {
        font-size: 13px;
        padding: 5px 8px;
        white-space: nowrap;
    }
    
    /* Optimize spacing for desktop */
    .header-phone {
        flex-shrink: 1;
        min-width: 100px;
    }
    
    .header-social {
        flex-shrink: 1;
    }
    
    .header-search-wrapper {
        flex-shrink: 1;
        max-width: 200px;
        min-width: 150px;
    }
    
    .language-switcher {
        flex-shrink: 0;
        min-width: 100px;
    }
}

/* Enhanced Responsive Styles for Header */
@media (max-width: 768px) {
    .header-top .container {
        flex-wrap: wrap;
        padding: 10px 15px;
        position: relative;
    }
    
    /* Show burger button on mobile only */
    .top-menu-btn {
        display: block !important;
        order: 1;
        cursor: pointer;
        padding: 5px 10px;
        margin-right: 10px;
        color: white;
        font-size: 18px;
        visibility: visible;
        z-index: 100;
    }
    
    .header-phone {
        order: 2;
    }
    
    .header-social {
        order: 3;
        margin: 0 10px;
    }
    
    .header-social a {
        margin: 0 5px;
    }
    
    .top-header-contact-btn {
        order: 4;
    }
    
    .header-search-wrapper {
        order: 5;
        flex: 1;
        max-width: 200px;
        margin: 0 10px;
    }
    
    .language-switcher {
        order: 6;
    }
    
    /* Hide menu by default on mobile */
    .header-top-menu {
        display: none !important;
        order: 10;
        width: 100%;
        margin-top: 10px;
        background: rgba(0, 0, 0, 0.95);
        padding: 15px;
        border-radius: 5px;
        overflow: visible;
    }
    
    /* Show menu when toggle class is active */
    .header-top-menu.header-top-menu-open {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        overflow: visible !important;
    }
    
    /* Reset ul styling for mobile */
    .header-top-menu ul {
        justify-content: center;
        flex-wrap: wrap;
        display: flex !important;
        flex-direction: column;
        list-style: none;
        margin: 0 !important;
        padding: 0 !important;
        visibility: visible !important;
    }
    
    .header-top-menu ul li {
        padding: 8px 10px;
        display: block !important;
        visibility: visible !important;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .header-top-menu ul li:last-child {
        border-bottom: none;
    }
    
    .header-top-menu ul li a {
        color: white !important;
        padding: 10px 15px;
        display: block !important;
        text-decoration: none;
        visibility: visible !important;
        font-size: 14px;
    }
    
    .header-top-menu ul li a:hover {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 3px;
    }
}

@media (max-width: 600px) {
    .header-phone {
        order: 2;
        font-size: 12px;
    }
    
    .header-phone a {
        padding: 5px;
    }
    
    .top-header-contact-btn {
        order: 4;
        margin: 0 5px;
    }
    
    .header-search-wrapper {
        max-width: 150px;
        font-size: 12px;
    }
    
    .header-search-wrapper input {
        font-size: 12px;
        padding: 5px 30px 5px 10px;
    }
    
    .header-social a {
        font-size: 14px;
        margin: 0 3px;
    }
}

@media (max-width: 480px) {
    .header-top .container {
        padding: 8px 10px;
    }
    
    /* Hide top menu on very small screens by default */
    .header-top-menu {
        display: none;
    }
    
    /* But show when opened */
    .header-top-menu.header-top-menu-open {
        display: block !important;
    }
    
    /* Simplify social icons */
    .header-social a:not(:first-child):not(:nth-child(2)) {
        display: none;
    }
    
    /* Make search smaller */
    .header-search-wrapper {
        max-width: 100px;
        margin: 0 5px;
    }
    
    .header-search-wrapper input {
        font-size: 11px;
        padding: 4px 25px 4px 8px;
    }
    
    .header-search-wrapper .fa-search {
        right: 5px;
        font-size: 12px;
    }
    
    /* Compact phone display */
    .header-phone span {
        display: none;
    }
    
    .header-phone a i {
        margin: 0;
        font-size: 16px;
    }
    
    /* Top menu button */
    .top-menu-btn {
        order: 1;
        margin-right: 10px;
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .language-switcher {
        margin: 0 3px;
    }
    
    .language-btn {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .header-search-wrapper {
        max-width: 80px;
    }
    
    .header-social {
        margin: 0 5px;
    }
    
    .header-social a {
        margin: 0 2px;
        font-size: 12px;
    }
}

/* Bottom Header (Main Navigation) Responsive Styles */
@media (max-width: 768px) {
    /* Ensure banners and content are below menu */
    .top-banner-wrapper,
    .slider-wrapper,
    .banner,
    main,
    section {
        z-index: 1;
        position: relative;
    }
    
    .bottom-header {
        overflow: visible;
        z-index: 1000;
        position: relative;
    }
    
    .bottom-header .container {
        flex-wrap: wrap;
        padding: 10px 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
        z-index: 1000;
    }
    
    .top-menu {
        position: relative;
        z-index: 10000;
    }
    
    .header-logo {
        flex: 0 0 auto;
        order: 1;
    }
    
    .header-logo .logo {
        display: block;
    }
    
    .header-logo .logo img {
        max-height: 45px;
        width: auto;
        height: auto;
    }
    
    /* Top menu wrapper */
    .top-menu {
        order: 2;
        flex: 0 0 auto;
    }
    
    /* Mobile burger menu button */
    .mobMenu {
        display: block !important;
        cursor: pointer;
        padding: 10px;
        font-size: 24px;
        color: white;
        background: transparent;
        border: none;
        z-index: 100;
    }
    
    /* Main menu container - hidden by default on mobile */
    .bottom-header .mainMenuContainer,
    .top-menu .mainMenuContainer {
        display: none;
        width: 100% !important;
        text-align: center !important;
        background: rgba(0, 0, 0, 0.95) !important;
        padding: 15px 0 !important;
        margin: 10px 0 !important;
        border-radius: 5px !important;
        order: 3 !important;
        flex-basis: 100% !important;
        flex-direction: column !important;
        list-style: none;
        position: relative !important;
        z-index: 9999 !important;
    }
    
    /* Ensure menu items are visible and styled correctly */
    .bottom-header .mainMenuContainer > li,
    .top-menu .mainMenuContainer > li {
        width: 100% !important;
        display: block !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-top: none !important;
        border-left: none !important;
        border-right: none !important;
        list-style: none;
        visibility: visible !important;
    }
    
    .mainMenuContainer > li:last-child {
        border-bottom: none;
    }
    
    .mainMenuContainer > li > a {
        display: block !important;
        padding: 12px 15px;
        color: white !important;
        text-decoration: none;
    }
    
    .mainMenuContainer > li > a:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    /* Hide submenus on mobile by default */
    .mainMenuContainer .subMenu {
        display: none;
    }
}

@media (max-width: 480px) {
    .bottom-header .container {
        padding: 8px 10px;
    }
    
    .header-logo .logo img {
        max-height: 35px !important;
    }
    
    .mobMenu {
        font-size: 20px;
        padding: 8px;
    }
}

@media (max-width: 360px) {
    .header-logo .logo img {
        max-height: 30px !important;
    }
}
