:root {
    --ali-red: #ff4747;
    --ali-orange: #ff9100;
    --ali-black: #222;
    --ali-gray: #f2f2f2;
    --ali-border: #e8e8e8;
    --white: #ffffff;
}

body {
    font-family: 'Outfit', sans-serif;
    /* Keep the font */
    /* Premium gradient background for large screens */
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 50%, #f5f7fa 100%);
    margin: 0;
    padding: 0;
    color: var(--ali-black);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Top Bar */
.top-bar {
    background: #fafafa;
    border-bottom: 1px solid var(--ali-border);
    padding: 0.5rem 2rem;
    font-size: 0.8rem;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
    color: #666;
}

/* Header */
.ali-header {
    background: var(--white);
    padding: 1.5rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.header-container {
    max-width: 1350px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 0 1.5rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--ali-red);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-box {
    flex: 1;
    display: flex;
    border-radius: 30px;
    overflow: visible;
    position: relative;
    background: #fff;
    z-index: 1001;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.search-box form {
    display: flex;
    flex: 1;
    z-index: 2;
    position: relative;
    background: transparent;
    border-radius: 30px;
}

.search-box input {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: none;
    outline: none;
    font-size: 1.05rem;
    border-radius: 30px 0 0 30px;
    background: transparent;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: 0.2s;
    text-decoration: none;
}

.suggestion-item:hover {
    background: #f9f9f9;
}

.s-img {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

.s-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.s-info {
    flex: 1;
}

.s-name {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

.s-price {
    font-size: 0.8rem;
    color: var(--ali-red);
    font-weight: 700;
}

.search-box button {
    background: var(--ali-red);
    color: white;
    border: none;
    padding: 0 1.5rem;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    width: 60px;
    /* Fixed width to prevent jumping when icon spins */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 30px 30px 0;
    transition: background 0.2s ease;
}

.search-box button:hover {
    background: #e63d3d;
}

/* Polished Search Dropdown */
.highlight {
    font-weight: 800;
    color: var(--ali-red);
}

.suggestion-view-all {
    display: block;
    padding: 12px;
    background: #fdfdfd;
    text-align: center;
    border-top: 1px solid #eee;
    color: #007bff;
    /* Link color */
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.suggestion-view-all:hover {
    background: #f0f8ff;
    text-decoration: underline;
}

.suggestion-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
    cursor: pointer;
    color: #333;
}

.action-item i {
    font-size: 1.4rem;
    margin-bottom: 0.2rem;
}

/* Horizontal Desktop Category Navigation - AliExpress Style */
.desktop-category-nav {
    background: var(--white);
    border-bottom: 1px solid var(--ali-border);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: relative;
    /* Acts as anchor for dropdown */
    z-index: 998;
    display: block;
}

.category-nav-container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    overflow: visible;
    /* Fix dropdown clipping */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-nav-container::-webkit-scrollbar {
    display: none;
}

/* All Categories Wrapper - For dropdown alignment */
.all-categories-wrapper {
    position: relative;
    display: inline-block;
    padding-bottom: 2px;
    /* Bridge the gap for smooth hover */
}

/* All Categories Dropdown Button */
.all-categories-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--ali-red);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    border-radius: 0;
    width: 100%;
}

.all-categories-btn:hover {
    background: #e63d3d;
}

.all-categories-btn i:first-child {
    font-size: 1rem;
}

.all-categories-btn i:last-child {
    font-size: 0.8rem;
    margin-left: 0.3rem;
}

/* Category Links (Flat Style) */
.cat-nav-link {
    padding: 0.75rem 1.25rem;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
    border-radius: 20px;
    background: transparent;
}

.cat-nav-link:hover {
    color: var(--ali-red);
    background: #fff5f5;
}

.cat-nav-link.active {
    color: white;
    background: var(--ali-red);
    font-weight: 600;
}

/* Mega Menu Dropdown Panel */
.all-categories-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 997;
    display: none;
    max-height: 600px;
    overflow-y: auto;
}

/* Show dropdown on hover of navigation bar or dropdown itself */
.desktop-category-nav:hover .all-categories-dropdown,
.all-categories-dropdown:hover {
    display: block;
}

/* Mega Menu Wrapper - Vertical Left + Dynamic Right */
.mega-menu-wrapper {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    min-height: 400px;
    max-height: 600px;
}

/* Left Menu - Vertical (ALL, Products, Services) */
.mega-left-menu {
    width: 200px;
    background: var(--ali-red);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.mega-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 600;
    border-left: 4px solid transparent;
}

.mega-menu-item:hover,
.mega-menu-item.active {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: white;
}

.mega-menu-item i:first-child {
    font-size: 1.2rem;
    width: 24px;
}

.mega-menu-item span {
    flex: 1;
}

.mega-menu-item i.fa-chevron-right {
    font-size: 0.9rem;
    margin-left: auto;
}

/* Right Panel - Dynamic Content */
.mega-right-panel {
    flex: 1;
    background: white;
    overflow-y: auto;
    overflow-x: visible;
    /* Allow submenus to appear outside panel */
    position: relative;
}

.mega-panel-content {
    display: none;
    /* Hidden by default */
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.mega-panel-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.panel-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ali-black);
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--ali-red);
}

.panel-categories {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.panel-cat-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
}

.panel-cat-link:hover {
    background: var(--ali-red);
    color: white;
    transform: translateX(5px);
}

.panel-cat-link i {
    width: 20px;
    text-align: center;
}

/* Category Items in Panel (recursive rendering) */
.mega-menu-section {
    display: flex;
    flex-direction: column;
}

.mega-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ali-black);
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--ali-red);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mega-section-title i {
    color: var(--ali-red);
    font-size: 1.2rem;
}

.mega-menu-categories {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Mega Menu Category Item */
.mega-cat-item {
    position: relative;
}

.mega-cat-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.mega-cat-link:hover {
    background: var(--ali-red);
    color: white;
    transform: translateX(3px);
}

.mega-cat-link .cat-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.mega-cat-link img.cat-icon {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
}

.mega-cat-link span {
    flex: 1;
}

.mega-cat-link .arrow-icon {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.mega-cat-item:hover>.mega-cat-link .arrow-icon {
    transform: translateX(3px);
}

/* Multi-Level Submenu */
.mega-submenu {
    position: absolute;
    left: auto;
    right: auto;
    top: 0;
    min-width: 280px;
    max-width: 350px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.75rem;
    display: none;
    z-index: 1000;
    transform: translateX(calc(100% + 0.5rem));
}

.mega-cat-item:hover>.mega-submenu {
    display: block;
}

/* Nested submenu items */
.mega-submenu .mega-cat-link {
    background: white;
    border: 1px solid #e8e8e8;
}

.mega-submenu .mega-cat-link:hover {
    background: var(--ali-red);
    color: white;
    border-color: var(--ali-red);
}

/* Main Layout - Full width without sidebar */
.main-container {
    max-width: 1500px;
    margin: 2rem auto;
    display: block;
    padding: 0 1rem;
}

/* Sidebar - Hidden on Desktop (horizontal nav used instead) */
.sidebar-cats {
    display: none;
    width: 200px;
    background: var(--white);
    border-radius: 8px;
    padding: 1rem 0;
    height: fit-content;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.sidebar-cats h3 {
    font-size: 1rem;
    padding: 0 1rem 0.5rem;
    border-bottom: 1px solid var(--ali-border);
    margin-bottom: 0.5rem;
}

.cat-link {
    display: block;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: #333;
    transition: 0.2s;
}

.cat-link:hover {
    background: #f5f5f5;
    color: var(--ali-red);
    padding-left: 1.2rem;
}

/* Content */
.content-area {
    flex: 1;
}

.hero-banner-container {
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 350; /* Maintains desktop proportion */
    margin-bottom: 2rem;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ali-slider {
    width: 100%;
    height: 100%;
    position: relative;
}

.slide {
    display: block;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    cursor: pointer;
}

.slide.active {
    opacity: 1;
    z-index: 1;
}

.slider-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.dot.active {
    background: #fff;
    width: 25px;
    border-radius: 12px;
}

/* Products */
.products-wrapper {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
}

.section-head {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.p-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.ali-card {
    background: var(--white);
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 0.75rem;
    position: relative;
    cursor: pointer;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.ali-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-4px);
    border-color: transparent;
}

.ali-img {
    height: 160px;
    background: #f9f9f9;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 3rem;
    margin-bottom: 0.8rem;
}

.ali-title {
    font-size: 0.9rem;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em;
    line-height: 1.3em;
    margin-bottom: 0.5rem;
}

.ali-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ali-red);
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.ali-price small {
    font-size: 0.8rem;
    color: #999;
    text-decoration: line-through;
    font-weight: 400;
}

.ali-sold {
    font-size: 0.75rem;
    color: #777;
    margin-top: 0.3rem;
}

.tag-hot {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ffe6e6;
    color: var(--ali-red);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 0.5rem 0;
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.7rem;
    min-width: 60px;
    transition: all 0.2s;
}

.mobile-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
}

.mobile-nav-item.active {
    color: var(--ali-red);
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

/* Logo in Bottom Nav (replaces Home button) */
.mobile-nav-item.mobile-nav-logo {
    flex: 0 0 auto;
    padding: 0.5rem 1rem;
}

.mobile-nav-item.mobile-nav-logo img {
    height: 32px;
    width: auto;
    max-width: 50px;
    object-fit: contain;
    margin-bottom: 0.2rem;
}

.mobile-nav-item.mobile-nav-logo i {
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
    color: var(--ali-red);
}

.mobile-nav-item.mobile-nav-logo span {
    font-size: 0.7rem;
}

/* Mobile Categories Drawer */
.mobile-categories-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1100;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.mobile-categories-drawer.active {
    display: block;
    transform: translateY(0);
}

.drawer-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.drawer-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.drawer-content {
    padding: 1rem;
}

.drawer-search {
    padding: 0 1rem 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    position: sticky;
    top: 57px;
    z-index: 9;
}

.drawer-search i {
    color: #94a3b8;
    font-size: 1rem;
}

.drawer-search input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.drawer-search input:focus {
    border-color: var(--ali-red);
}

.drawer-category-group {
    margin-bottom: 0.25rem;
}

.drawer-category-item {
    display: flex;
    align-items: center;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #f8fafc;
    color: #334155;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    position: relative;
}

.drawer-category-item:active {
    background: var(--ali-red);
    color: white;
    transform: scale(0.98);
}

.drawer-category-item i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

.drawer-category-item span {
    flex: 1;
}

.expand-icon {
    margin-left: auto !important;
    margin-right: 0 !important;
    font-size: 0.9rem !important;
    transition: transform 0.3s ease;
    color: #64748b;
}

.subcategories {
    padding-left: 1rem;
    margin-top: -0.25rem;
}

.subcategory {
    padding: 0.7rem 1rem;
    padding-left: 2rem;
    font-size: 0.9rem;
    background: #f1f5f9;
}

.subcategory i {
    font-size: 0.8rem !important;
}

.drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1099;
}

.drawer-backdrop.active {
    display: block;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .top-bar {
        display: none;
    }

    /* Responsive Header */
    .ali-header {
        padding: 1rem 0;
    }

    .header-container {
        gap: 0.5rem;
        padding: 0 0.75rem;
    }

    .logo {
        font-size: 1.3rem;
    }

    .logo span {
        display: none;
    }

    .search-box button {
        padding: 0 1rem;
        /* Touch-friendly */
        min-width: 44px;
    }

    /* Hide header actions on mobile (now in bottom nav) */
    .header-actions {
        display: none;
    }

    /* Header container - no wrapping needed now */
    .header-container {
        flex-wrap: nowrap;
    }

    /* Search box - optimize for available space */
    .search-box {
        order: 2;
        flex: 1;
        margin-top: 0;
        margin-left: 0.5rem;
    }

    /* Main container */
    .main-container {
        flex-direction: column;
        margin: 0.75rem auto;
        padding: 0 0.5rem;
    }

    /* Hide desktop category nav on mobile */
    .desktop-category-nav {
        display: none;
    }

    /* Hide categories on mobile (will use slide-up drawer instead) */
    .sidebar-cats {
        display: none;
    }

    /* Responsive Hero Banner */
    .hero-banner-container {
        aspect-ratio: 768 / 200; /* Maintains tablet proportion */
        height: auto;
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    /* Products section */
    .products-wrapper {
        padding: 1rem;
        border-radius: 8px;
    }

    .section-head {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    /* Product grid - 2 columns on mobile */
    .p-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }

    /* Product cards */
    .ali-card {
        padding: 0.4rem;
        border-radius: 6px;
        border: 1px solid #f0f0f0;
    }

    .ali-img {
        height: 120px;
        margin-bottom: 0.5rem;
        font-size: 2rem;
    }

    .ali-title {
        font-size: 0.8rem;
        line-height: 1.2em;
        height: 2.4em;
        margin-bottom: 0.4rem;
    }

    .ali-price {
        font-size: 1rem;
    }

    .tag-hot {
        top: 6px;
        left: 6px;
        padding: 2px 5px;
        font-size: 0.65rem;
    }

    /* Search suggestions mobile */
    .suggestion-item {
        padding: 1rem;
        /* Larger touch area */
    }

    .s-img {
        width: 50px;
        height: 50px;
    }

    .s-name {
        font-size: 0.85rem;
    }

    .s-price {
        font-size: 0.75rem;
    }

    /* Show mobile bottom nav */
    .mobile-bottom-nav {
        display: block;
    }

    /* Add bottom padding to prevent content being hidden behind nav */
    body {
        padding-bottom: 70px;
    }
}

/* Extra small mobile devices (< 480px) */
@media (max-width: 480px) {
    .ali-header {
        padding: 0.75rem 0;
    }

    .header-container {
        padding: 0 0.5rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .logo i {
        font-size: 1.2rem;
    }

    .search-box input {
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
    }

    .hero-banner-container {
        aspect-ratio: 480 / 180; /* Maintains mobile proportion */
        height: auto;
        min-height: 150px; /* Ensure content remains legible */
        margin-bottom: 0.75rem;
    }

    .products-wrapper {
        padding: 0.75rem;
    }

    .section-head {
        font-size: 1rem;
    }

    .p-grid {
        gap: 0.5rem;
    }

    .ali-img {
        height: 100px;
    }

    .ali-title {
        font-size: 0.75rem;
    }

    .ali-price {
        font-size: 0.9rem;
    }
}

/* =========================================
   Mini Glass Dropdown - All Categories
   ========================================= */
.mini-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    /* Same width as button */
    min-width: 200px;
    background: rgba(255, 255, 255, 0.9);
    /* Transparent/Glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 997;
    display: none;
    padding: 0.5rem 0;
    margin-top: -2px;
    /* Overlap to prevent hover gap */
}

/* Show dropdown on wrapper hover */
.all-categories-wrapper:hover .mini-dropdown {
    display: block;
}

.mini-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    color: #333;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-wrap: wrap;
}

.mini-dropdown-item:hover {
    background: rgba(255, 71, 71, 0.1);
    color: var(--ali-red);
}

.mini-dropdown-item>span {
    flex: 1;
}

.mini-dropdown-item>i {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.mini-dropdown-item:hover>i {
    transform: rotate(180deg);
}

/* Sub Dropdown - Shows BELOW */
.mini-sub-dropdown {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    /* Transparent/Glass */
    display: none;
    padding: 0.25rem 0;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.mini-dropdown-item:hover>.mini-sub-dropdown {
    display: block;
}

/* Level 3 Dropdown - Shows SIDE */
.mini-sub-item-wrapper {
    position: relative;
    width: 100%;
}

.mini-sub-item {
    display: flex;
    align-items: center;
    position: relative;
    padding: 0.5rem 1rem 0.5rem 1.5rem;
    color: #555;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    /* Ensure padding doesn't affect width */
}

.has-children {
    padding-right: 25px;
    /* Space for arrow */
}

/* Level 3+ Dropdown - Shows SIDE (Generic Recursive Rule) */
.mini-sub-item-wrapper .mini-sub-dropdown {
    position: absolute;
    /* Essential for side positioning */
    top: 0;
    left: 100%;
    margin-top: 0;
    margin-left: 2px;
    background: rgba(255, 255, 255, 0.9);
    border-top: none;
    /* Reset top level border */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    display: none;
    /* Hide by default */
}

.mini-sub-item-wrapper:hover>.mini-sub-dropdown {
    display: block;
}

.mini-sub-item:hover {
    background: var(--ali-red);
    color: white;
}

.mini-sub-item img {
    transition: transform 0.2s ease;
    /* Smooth zoom */
}

.mini-sub-item:hover img {
    transform: scale(1.2);
    /* Slight zoom on hover */
}

/* Mobile: Hide mini dropdown */
@media (max-width: 768px) {
    .mini-dropdown {
        display: none !important;
    }
}

/* --- Mobile Split View Styles --- */
.drawer-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    background: #fff;
    position: sticky;
    top: 50px;
    /* Below drawer header */
    z-index: 10;
}

.drawer-tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.drawer-tab.active {
    color: var(--ali-red);
    border-bottom-color: var(--ali-red);
    font-weight: 600;
}

.mobile-split-view {
    display: flex;
    height: calc(100% - 92px);
    /* Calc height minus header + tabs */
    overflow: hidden;
}

.mobile-cat-sidebar {
    width: 90px;
    background: #f5f5f5;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-item {
    padding: 12px 8px;
    font-size: 0.8rem;
    color: #333;
    text-align: center;
    border-left: 3px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    word-break: break-word;
}

.sidebar-item.active {
    background: #fff;
    font-weight: 600;
    color: var(--ali-red);
    border-left-color: var(--ali-red);
}

.mobile-cat-content {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    padding: 10px;
}

.content-panel {
    display: none;
}

.content-panel.active {
    display: block;
    animation: fadeIn 0.3s;
}

.panel-header {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.panel-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #444;
    text-align: center;
}

.panel-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    /* Circle fallback */
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    overflow: hidden;
}

.panel-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.panel-img i {
    font-size: 1.5rem;
    color: #888;
}

.panel-item span {
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Sub-section styles */
.panel-section {
    margin-bottom: 20px;
}

.section-title {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    text-decoration: none;
}

.panel-grid.small {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.panel-item.small .panel-img {
    width: 50px;
    height: 50px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cart Badge */
.header-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--ali-red);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    z-index: 10;
}

.action-item {
    position: relative !important;
}
/* Services Slider Styles */
.services-slider-container {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 5px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    display: block;
    width: 100%;
}

.services-slider-container::-webkit-scrollbar {
    display: none;
}

.services-slider {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    min-width: max-content;
}

.slider-card {
    flex: 0 0 220px !important;
    margin-right: 0.5rem;
}

/* Slider Navigation Buttons */
.slider-nav-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.slider-nav-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #333;
}

.slider-nav-btn:hover {
    background: var(--ali-red);
    color: white;
    border-color: var(--ali-red);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(255, 71, 71, 0.3);
}

.slider-nav-btn.prev {
    left: -22px;
}

.slider-nav-btn.next {
    right: -22px;
}

/* --- Advanced Filters --- */
.filter-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}
.filter-section h3 {
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.price-filter .price-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.price-filter input {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}
.price-filter button {
    width: 100%;
    padding: 0.4rem;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.price-filter button:hover {
    background: #555;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4b5563;
}
.filter-checkbox input {
    width: 16px;
    height: 16px;
}

.rating-filters {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.rating-filter-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #4b5563;
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}
.rating-filter-link:hover, .rating-filter-link.active {
    background: #f3f4f6;
    color: var(--primary);
}
.rating-filter-link .stars {
    color: #fbbf24;
}
.rating-filter-link.active .stars {
    color: var(--primary);
}

/* --- Content Top Bar --- */
.content-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.results-info {
    font-size: 0.9rem;
    color: #6b7280;
}
.results-info .count {
    font-weight: 600;
    color: #333;
}
.clear-filters {
    margin-left: 1rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}
.clear-filters:hover {
    text-decoration: underline;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.sort-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}
.sort-box select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    outline: none;
}
.view-modes {
    display: flex;
    gap: 0.2rem;
    background: #f3f4f6;
    padding: 0.2rem;
    border-radius: 6px;
}
.view-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}
.view-btn:hover {
    color: #333;
}
.view-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* --- List View Support --- */
.p-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}
.p-grid.list-view .ali-card {
    display: flex;
    flex-direction: row;
    height: auto;
    min-height: 180px;
    padding: 0;
    max-width: 100%;
    overflow: hidden;
    background: white;
}
.p-grid.list-view .ali-img {
    width: 180px;
    height: 180px;
    flex-shrink: 0;
    margin-bottom: 0;
    border-radius: 8px 0 0 8px;
}
.p-grid.list-view .ali-img img {
    border-radius: 0;
}
.p-grid.list-view .ali-info-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    height: 100%;
}
.p-grid.list-view .ali-title {
    font-size: 1.2rem;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    flex: 1;
    height: auto;
    max-height: none;
    display: block;
    margin-bottom: 0;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    border: none;
}
.p-grid.list-view .card-rating {
    margin-left: 0; /* Inside title now */
    margin-top: 0.5rem;
}
.p-grid.list-view .ali-footer {
    border-left: 1px solid #eee;
    width: 220px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    flex-shrink: 0;
    height: 100%;
}
.p-grid.list-view .ali-price {
    font-size: 1.5rem;
    width: 100%;
    justify-content: center;
}

/* Mobile List View Optimization */
@media (max-width: 600px) {
    .p-grid.list-view .ali-card {
        min-height: 100px;
    }
    .p-grid.list-view .ali-img {
        width: 120px;
        height: 120px;
    }
    .p-grid.list-view .ali-info-body {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
        overflow: hidden;
    }
    .p-grid.list-view .ali-title {
        font-size: 0.95rem;
        padding: 0.5rem 1rem 0.2rem 1rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        line-height: 1.2;
    }
    .p-grid.list-view .card-rating {
        margin-left: 1rem;
        margin-top: 0;
        font-size: 0.7rem;
    }
    .p-grid.list-view .ali-footer {
        width: 100%;
        border-left: none;
        padding: 0.2rem 1.2rem 0.5rem 1rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        height: auto;
        gap: 0.5rem;
    }
    .p-grid.list-view .ali-price {
        font-size: 1.1rem;
        width: auto;
        justify-content: flex-start;
    }
    .p-grid.list-view .free-shipping-tag {
        font-size: 0.65rem;
        padding: 0.1rem 0.3rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .content-top-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    .top-bar-right {
        justify-content: space-between;
    }
}

/* --- Card Enhancements --- */
.card-rating {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.3rem;
}
.card-rating i {
    color: #fbbf24;
}
.card-rating .count {
    color: #9ca3af;
}

.ali-footer {
    padding: 0 1rem 1rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.free-shipping-tag {
    font-size: 0.7rem;
    color: #059669;
    background: #ecfdf5;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
}

@media (max-width: 1200px) {
    .slider-nav-btn.prev { left: 0; }
    .slider-nav-btn.next { right: 0; }
    .slider-nav-btn { width: 36px; height: 36px; background: rgba(255, 255, 255, 0.8); }
}
