/* ========================================
   Mobile Responsive Header & Navigation
   ======================================== */

/* Mobile Menu Toggle Button */
.small_menu_key {
    cursor: pointer;
    padding: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    background: transparent;
}

.small_menu_key:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.small_menu_key svg {
    transition: transform 0.3s ease;
}

/* Mobile Header Alignment */
.mobile-menu-col,
.header-middle .col-3,
.header-middle .col-6 {
    display: flex;
    align-items: center;
}

/* Logo on the left */
.header-middle .col-3:has(#logo).order-1 {
    justify-content: flex-start;
}

/* Search bar in center */
.header-middle .col-6.search_bar {
    justify-content: center;
}

/* Mobile menu on the right */
.mobile-menu-col.order-3 {
    justify-content: flex-end;
}


/* Mobile Icon Buttons */
.mobile-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f8f9fa;
    color: #333 !important;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.mobile-icon-btn:hover {
    background-color: #007bff;
    color: #fff !important;
}

.mobile-icon-btn i {
    font-size: 18px;
}

/* Desktop Only Elements */
.desktop-only {
    display: block !important;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

/* Mobile Actions Column */
.mobile-actions-col {
    gap: 8px;
}

/* Mobile User Dropdown */
.mobile-user-dropdown .dropdown-menu {
    right: 0 !important;
    left: auto !important;
    min-width: 200px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mobile-user-dropdown .dropdown-item {
    padding: 10px 15px;
    font-size: 14px;
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateX(-100%);
    opacity: 0;
    z-index: 9999;
}

.mobile-nav-overlay:not(.closed_nav) {
    transform: translateX(0);
    opacity: 1;
}

/* Mobile Nav Container */
.mobile-nav-container {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    max-width: 320px;
    width: 85%;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
}

/* Mobile Nav Header */
.mobile-nav-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.mobile-nav-header .logo img {
    max-width: 100px;
    height: auto;
}

/* Mobile Nav Content */
.mobile-nav-content {
    padding-bottom: 20px;
}

/* Mobile Nav Footer */
.mobile-nav-footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Header Mobile Responsiveness */
@media (max-width: 768px) {
    .container-fluid h3 {
        padding-left: 15px !important;
        padding-right: 15px !important;
        margin: 0 !important;
    }

    .header-middle {
        padding: 10px 0 !important;
    }

    .header-middle .row {
        margin: 5px 10px !important;
    }

    /* Mobile Header Layout: Logo Left, Search Center, Menu Right */
    .mobile-menu-col {
        padding-right: 0 !important;
    }

    .header-middle .col-3:has(#logo).order-1 {
        padding-left: 0 !important;
    }

    .header-middle .logo img {
        max-height: 35px;
        width: auto;
    }


    /* Search Bar Mobile - Center */
    .search-mobile {
        padding: 0 5px !important;
        margin-top: 0 !important;
        display: block !important;
    }

    .search-mobile .top-search .box-search {
        width: 100%;
    }

    .search-mobile .top-search input {
        width: 100%;
        font-size: 12px;
        padding: 8px 35px 8px 10px;
        border-radius: 20px;
        border: 1px solid #ddd;
    }

    .search-mobile .top-search .box-search {
        position: relative;
    }

    .search-mobile .top-search .btn-search {
        position: absolute;
        right: auto;
        top: 23px !important;
        transform: translateY(-50%);
        background: none;
        border: none;
        padding: 5px;
        cursor: pointer;
    }

    .search-mobile .top-search .btn-search img {
        width: 18px;
        height: 18px;
    }

    /* Country & Language Switcher - Hide on Mobile */
    .country-switcher-dropdown,
    .lang-switcher-btn {
        display: none !important;
    }

    /* Profile Responsive - Hide on Mobile */
    .profile-responive:not(.mobile-user-dropdown) {
        display: none !important;
    }

    .search-listings .filter-sidebar,
    .category-listings .filter-sidebar {
        display: none !important;
    }

    .category_image {
        height: auto;
        padding: 3px;
    }

    .mobile-login-logo {
        display: block !important;
    }

    .mobile-login-logo img {
        max-height: 60px !important;
    }

    .switcher-label-wrapper img {
        margin-left: 5px;
    }

    .switcher-label-wrapper i , .switcher-option i {
        margin-right: 5px !important;
        color: #FFFFFF;
        margin-left: 5px !important;
    }
}

/* Mobile Action Buttons in Navigation */
.mobile-action-buttons {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-action-buttons .btn {
    font-weight: 500;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
}

.mobile-action-buttons .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.mobile-action-buttons .btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
}

.mobile-action-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* ========================================
   Mobile Country & Language Switchers
   ======================================== */

.mobile-switchers {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-switcher-item {
    margin-bottom: 0;
}

.switcher-header {
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.switcher-header:hover {
    background: rgba(255, 255, 255, 0.15);
}

.switcher-label-wrapper {
    font-size: 14px;
    font-weight: 600;
}

.switcher-label-wrapper img {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switcher-label-wrapper .fs-12 {
    font-size: 12px;
    font-weight: 400;
}

.chevron-toggle {
    transition: transform 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.chevron-toggle.rotate {
    transform: rotate(180deg);
}

.switcher-options {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    max-height: 500px;
}

.switcher-options.closed_nav {
    display: none;
    max-height: 0;
}

.switcher-option {
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 48px;
}

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

.switcher-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

.switcher-option.active {
    background: rgba(255, 255, 255, 0.2);
}

.switcher-option span {
    font-size: 14px;
    font-weight: 500;
}

.switcher-option img {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switcher-option .fa-check {
    font-size: 16px;
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .mobile-nav-container {
        max-width: 100%;
        width: 100%;
    }

    .header-middle .logo img {
        max-height: 30px;
    }

    .mobile-icon-btn {
        width: 36px;
        height: 36px;
    }

    .mobile-icon-btn i {
        font-size: 16px;
    }

    .search_bar .top-search input {
        font-size: 11px;
        padding: 6px 30px 6px 8px;
    }

    .small_menu_key svg {
        width: 20px;
        height: 20px;
    }
}

/* Tablet Devices */
@media (min-width: 769px) and (max-width: 992px) {
    .header-middle .search_bar {
        width: 40%;
    }

    .header_btn {
        font-size: 13px;
        padding: 8px 15px;
    }
}

/* Category Navigation Mobile */
.upper_categories_nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.upper_cat_name {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.upper_cat_name:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.upper_cat_name a {
    color: #fff !important;
    text-decoration: none;
}

/* Chevron Rotation Animation */
.chevron {
    transition: transform 0.3s ease;
}

.chevron.rotate {
    transform: rotate(180deg);
}

/* Category Nav Closed State */
.category_nav.closed_nav {
    display: none;
}

.category_nav:not(.closed_nav) {
    display: block;
    animation: slideDown 0.3s ease-in-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Middle & Lower Categories */
.middle-category-item,
.lower-category-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.middle-category-item:last-child,
.lower-category-item:last-child {
    border-bottom: none;
}

.middle_cat_name a,
.lower-category-item a {
    color: #ffffff !important;
    text-decoration: none;
    display: block;
    padding: 0;
}

.middle_cat_name a:hover,
.lower-category-item a:hover {
    color: #007bff !important;
}

/* Body Overflow Hidden When Mobile Menu Open */
body.overflow-hidden {
    overflow: hidden;
    height: 100vh;
}

/* Improve Touch Targets for Mobile */
@media (hover: none) and (pointer: coarse) {

    .mobile-icon-btn,
    .small_menu_key,
    .chevron {
        min-height: 44px;
        min-width: 44px;
    }
}

/* RTL Support for Mobile */
[dir="rtl"] .mobile-nav-container {
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.3);
}

[dir="rtl"] .mobile-nav-overlay {
    transform: translateX(100%);
}

[dir="rtl"] .mobile-nav-overlay:not(.closed_nav) {
    transform: translateX(0);
}

/* Smooth Transitions */
* {
    -webkit-tap-highlight-color: transparent;
}

a,
button,
.cursor-pointer {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Mobile Menu Items Styling */
.responosive_profile {
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.profile_menu .category_nav {
    background-color: rgba(255, 255, 255, 0.95) !important;
    margin: 10px;
    border-radius: 8px;
    overflow: hidden;
}

.profile_menu .middle_cat_name a {
    font-weight: 500;
}

/* Loading State */
.mobile-nav-content:empty::after {
    content: "Loading...";
    display: block;
    text-align: center;
    padding: 20px;
    color: #fff;
}

/* ========================================
   Mobile Categories Grid
   ======================================== */

.categories-mobile-grid {
    width: 100%;
    padding: 10px;
}

.categories-mobile-grid .row {
    margin: 0;
}

.categories-mobile-grid .col-3 {
    padding: 5px;
}

.category-item-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.category-item-mobile:hover {
    transform: translateY(-5px);
}

.category-item-mobile .category_image {
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    margin-bottom: 8px;
}

.category-item-mobile .category_image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-item-mobile h4 {
    font-size: 11px !important;
    color: #333 !important;
    margin: 0;
    padding: 0 2px;
    line-height: 1.2;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Responsive adjustments for very small screens */
@media (max-width: 375px) {
    .category-item-mobile h4 {
        font-size: 10px !important;
    }

    .categories-mobile-grid .col-3 {
        padding: 3px;
    }
}

/* For tablets, show 6 items per row */
@media (min-width: 576px) and (max-width: 767px) {
    .categories-mobile-grid .col-3 {
        flex: 0 0 auto;
        width: 16.666667%;
        /* 6 items per row */
    }

    .category-item-mobile h4 {
        font-size: 12px !important;
    }
}
