/* ============================================
   MOBILE RESPONSIVE STYLES
   Comprehensive mobile responsiveness for all pages
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    margin-right: 10px;
    z-index: 10001;
}

body.homepage .mobile-menu-toggle {
    color: #212121;
}

.mobile-menu-toggle i {
    font-size: 24px;
}

/* Mobile Navigation Overlay */
.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20001;
    /* Higher than header (10001) */
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-nav-overlay.active {
    opacity: 1;
}

/* Mobile Navigation Menu - Flipkart Style */
.mobile-nav-menu {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    max-width: 85%;
    height: 100vh;
    background: white;
    z-index: 20002;
    /* Higher than overlay (20001) */
    overflow-y: auto;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.mobile-nav-menu.active {
    left: 0;
    display: block;
}

.mobile-nav-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.mobile-nav-loading i {
    margin-right: 8px;
}

.mobile-nav-header {
    background: linear-gradient(135deg, var(--mobitez-purple) 0%, var(--mobitez-purple-dark) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-nav-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-content {
    padding: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid #e0e0e0;
}

.mobile-nav-header-item {
    background-color: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
}

.mobile-nav-header-item:first-child {
    border-top: 1px solid #e0e0e0;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    color: #212121;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.2s;
    cursor: pointer;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background-color: #f5f5f5;
    color: var(--mobitez-purple);
}

.mobile-nav-link i {
    font-size: 14px;
    color: #666;
    margin-right: 12px;
}

.mobile-nav-link .fa-chevron-right,
.mobile-nav-link .fa-chevron-down {
    font-size: 12px;
    color: #878787;
    margin-right: 0;
    margin-left: auto;
}

.mobile-nav-expand-icon {
    transition: transform 0.3s ease;
}

.mobile-nav-expand-icon.expanded {
    transform: rotate(180deg);
}

.mobile-nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: #fafafa;
}

.mobile-nav-submenu.expanded {
    max-height: 1000px;
}

.mobile-nav-sublink {
    display: flex;
    align-items: center;
    padding: 12px 20px 12px 52px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;
}

.mobile-nav-sublink:hover {
    background-color: #f0f0f0;
    color: var(--mobitez-purple);
}

.mobile-nav-sublink i {
    font-size: 14px;
    color: #878787;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.mobile-nav-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 8px 0;
}

.mobile-nav-badge {
    background: #fb641b;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Tablet and Mobile - 768px and below */
@media (max-width: 768px) {

    /* Header Mobile Styles */
    .header {
        padding: 8px 0;
    }

    .header-container {
        flex-wrap: wrap;
        padding: 0 10px;
        gap: 8px;
        justify-content: space-between;
    }

    .logo {
        min-width: 80px;
        order: 1;
    }

    .logo-image {
        height: 40px;
    }

    .mobile-menu-toggle {
        display: block;
        order: 0;
    }

    .header-right {
        order: 2;
        gap: 8px;
        flex-wrap: wrap;
    }

    .header-item {
        font-size: 12px;
    }

    .header-item a {
        font-size: 12px;
        padding: 6px 12px;
    }

    /* Hide login button completely on mobile */
    .login-btn,
    .login-dropdown-wrapper {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .become-seller {
        display: none;
        /* Hide on mobile */
    }

    .more-options {
        display: none;
        /* Hide on mobile */
    }

    .search-container {
        order: 3;
        width: 100%;
        max-width: 100%;
        min-width: auto;
        margin: 8px 0 0 0;
        flex: 1 1 100%;
    }

    .search-input {
        font-size: 14px;
        padding: 8px 12px;
    }

    .search-btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .cart-text {
        display: none;
    }

    /* Navigation Menu Mobile */
    .nav-menu {
        top: 56px !important;
        height: auto;
        max-height: 200px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
    }

    .nav-container {
        padding: 0 10px !important;
        gap: 0;
        height: 40px;
        min-height: 40px;
        max-height: 40px;
    }

    .nav-link {
        padding: 8px 12px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }

    .nav-link .fa-chevron-down {
        font-size: 9px !important;
        margin-left: 3px !important;
    }

    /* Main Content */
    .main-content {
        padding-top: 96px !important;
        /* Header + Nav */
        padding-left: 10px;
        padding-right: 10px;
    }

    body.homepage .main-content {
        padding-top: 96px !important;
        /* Header (48px top row + 48px search row) */
    }

    /* Products Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }

    .product-card {
        padding: 12px;
    }

    .product-image {
        height: 160px;
    }

    .product-title {
        font-size: 13px;
        line-height: 1.4;
        margin: 8px 0 4px;
    }

    .price-current {
        font-size: 16px;
    }

    /* Hide login button completely on mobile */
    .login-btn,
    .login-dropdown-wrapper {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Dropdowns - Hidden on mobile (no dropdown functionality) */
    .login-dropdown,
    .more-dropdown {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .login-dropdown-wrapper.active .login-dropdown,
    .more-dropdown-wrapper.active .more-dropdown {
        display: none !important;
    }

    /* Hide chevron icons on mobile */
    .more-options .fa-chevron-down,
    .more-options i.fa-chevron-down {
        display: none !important;
    }

    /* Category Dropdowns - Hide on mobile (use mobile menu instead) */
    body:not(.homepage) .category-dropdown {
        display: none !important;
    }

    /* Disable hover effects on mobile */
    body:not(.homepage) .nav-item:hover .category-dropdown {
        display: none !important;
    }

    /* Footer Mobile */
    .footer-container {
        flex-direction: column;
        padding: 30px 20px;
        gap: 30px;
    }

    .footer-section {
        width: 100%;
    }

    .footer-bottom {
        padding: 15px 20px;
        font-size: 12px;
    }
}

/* Small Mobile - 480px and below */
@media (max-width: 480px) {
    .header-container {
        padding: 0 8px;
        gap: 6px;
    }

    .logo-image {
        height: 35px;
    }

    .mobile-menu-toggle {
        font-size: 20px;
        padding: 6px;
        margin-right: 6px;
    }

    .header-right {
        gap: 6px;
    }

    .header-item a {
        font-size: 11px;
        padding: 5px 8px;
    }

    /* Hide login button completely on mobile */
    .login-btn,
    .login-dropdown-wrapper {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .cart {
        padding: 5px 8px;
    }

    .cart-count {
        font-size: 10px;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        top: -6px;
        right: -6px;
        box-shadow: 0 2px 4px rgba(255, 97, 97, 0.4), 0 0 0 1.5px white;
    }

    .search-container {
        margin: 6px 0 0 0;
    }

    .search-input {
        font-size: 13px;
        padding: 7px 10px;
    }

    .search-btn {
        padding: 7px 14px;
        font-size: 13px;
    }

    .nav-container {
        padding: 0 8px !important;
    }

    .nav-link {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }

    .main-content {
        padding-top: 92px !important;
        padding-left: 8px;
        padding-right: 8px;
    }

    body.homepage .main-content {
        padding-top: 96px !important;
        /* Header (48px top row + 48px search row) */
    }

    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .product-image {
        height: 200px;
    }

    .product-title {
        font-size: 12px;
    }

    .price-current {
        font-size: 18px;
    }

    .mobile-nav-menu {
        width: 260px;
        max-width: 90%;
    }
}

/* Extra Small Mobile - 360px and below */
@media (max-width: 360px) {
    .header-container {
        padding: 0 6px;
    }

    .logo-image {
        height: 30px;
    }

    .header-item a {
        font-size: 10px;
        padding: 4px 6px;
    }

    /* Hide login button completely on mobile */
    .login-btn,
    .login-dropdown-wrapper {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 0 !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .nav-link {
        padding: 6px 8px !important;
        font-size: 11px !important;
    }

    .mobile-nav-menu {
        width: 240px;
        max-width: 95%;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .nav-menu {
        max-height: 150px;
    }

    .nav-container {
        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }
}

/* Touch-friendly targets */
@media (max-width: 768px) {

    .header-item a,
    .nav-link,
    .btn,
    button,
    .product-card,
    .cart {
        min-height: 44px;
        /* Apple's recommended touch target size */
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Prevent text selection on tap */
    .nav-link,
    .header-item a {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        user-select: none;
    }

    /* Category Filters Mobile */
    .category-filters-sidebar {
        position: relative !important;
        top: 0 !important;
        width: 100% !important;
    }

    .filters-section {
        margin-bottom: 16px;
    }

    /* Product Cards Mobile */
    .product-card {
        padding: 12px;
    }

    .product-image {
        height: 180px;
    }

    /* Cart Page Mobile */
    .cart-content {
        grid-template-columns: 1fr !important;
    }

    .cart-summary {
        position: relative !important;
        top: 0 !important;
        margin-top: 20px;
    }

    /* Checkout Mobile */
    .checkout-content {
        grid-template-columns: 1fr !important;
    }

    .checkout-summary {
        order: -1;
        margin-bottom: 20px;
    }

    /* Profile Mobile */
    .profile-content {
        grid-template-columns: 1fr !important;
    }

    .profile-sidebar {
        order: -1;
        margin-bottom: 20px;
    }
}

/* Additional Mobile Styles for Specific Pages */
@media (max-width: 480px) {

    /* Orders Page */
    .orders-content-wrapper {
        gap: 12px;
    }

    /* Categories Page */
    .categories-content-wrapper {
        grid-template-columns: 1fr !important;
    }

    .category-filters-sidebar {
        margin-bottom: 16px;
    }

    /* Search Page */
    .search-content-wrapper {
        grid-template-columns: 1fr !important;
    }

    .search-filters-sidebar {
        margin-bottom: 16px;
    }

    /* Product Page */
    .product-content {
        grid-template-columns: 1fr !important;
    }

    .product-images-wrapper {
        margin-bottom: 20px;
    }

    /* Cart Items */
    .cart-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-item-image {
        width: 100%;
        max-width: 200px;
        margin: 0 auto 12px;
    }

    .cart-item-details {
        width: 100%;
    }

    .cart-item-actions {
        width: 100%;
        justify-content: space-between;
    }

    /* Ensure proper spacing on mobile */
    .container,
    .orders-container,
    .cart-container,
    .product-container {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Fix navigation menu positioning */
    .nav-menu {
        position: fixed !important;
        top: 56px !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 9999 !important;
    }

    /* Ensure main content doesn't overlap with fixed nav */
    .main-content,
    .search-main,
    .product-main {
        padding-top: 96px !important;
        /* Header (56px) + Nav (40px) */
    }

    body.homepage .main-content {
        padding-top: 96px !important;
        /* Header (48px top row + 48px search row) */
    }

    /* Breadcrumbs mobile */
    .breadcrumbs {
        margin-top: 96px !important;
        padding: 10px 0;
    }

    body.homepage .breadcrumbs {
        margin-top: 96px !important;
        /* Header (48px top row + 48px search row) */
    }
}