/* Mobile Shop Optimizations - Comprehensive Mobile Fixes */

@media (max-width: 768px) {
    /* UNIVERSAL MOBILE PRODUCT GRID - 2 COLUMNS EXACTLY */
    .products-area .row,
    .products-area3 .row,
    .product-grid .row,
    .row {
        margin: 0 -4px !important;
        display: flex !important;
        flex-wrap: wrap !important;
    }
    
    .products-area .row > [class*="col-"],
    .products-area3 .row > [class*="col-"],
    .product-grid .row > [class*="col-"],
    .row > .col-12,
    .row > .col-sm-6,
    .row > .col-md-4,
    .row > .col-lg-3,
    .row > [class*="col-"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
        padding: 0 4px !important;
        margin-bottom: 12px !important;
        display: flex !important;
    }
    
    /* FIXED HEIGHT CARD CONTAINERS FOR CONSISTENCY - COMPACT FOR 4 CARDS */
    .card-container {
        height: 320px !important;
        min-height: 320px !important;
        max-height: 320px !important;
        padding: 3px !important;
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .product-card {
        height: 100% !important;
        min-height: 310px !important;
        max-height: 310px !important;
        display: flex !important;
        flex-direction: column !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px !important;
        overflow: hidden !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
        transition: all 0.3s ease !important;
        background: white !important;
    }
    
    .product-card:hover {
        transform: translateY(-3px) !important;
        box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
    }
    
    /* Fixed Image Section - COMPACT FOR 4 CARDS */
    .product-card .image-container {
        height: 120px !important;
        min-height: 120px !important;
        max-height: 120px !important;
        overflow: hidden !important;
        position: relative !important;
        flex-shrink: 0 !important;
        background: #f8f9fa !important;
    }
    
    .product-card .card-img-top {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        transition: transform 0.3s ease !important;
    }
    
    .product-card:hover .card-img-top {
        transform: scale(1.05) !important;
    }
    
    /* SIMPLIFIED CARD BODY LAYOUT */
    .product-card .card-body {
        padding: 12px !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        min-height: 160px !important;
        max-height: 160px !important;
        overflow: visible !important;
    }
    
    /* PRODUCT TITLE - FIRST ROW FULL WIDTH */
    .product-card .card-title {
        font-size: 13px !important;
        height: 45px !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
        overflow: hidden !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3 !important;
        line-clamp: 3 !important;
        -webkit-box-orient: vertical !important;
        font-weight: 600 !important;
        color: #333 !important;
        width: 100% !important;
        text-align: left !important;
    }
    
    /* PRICE AND VIEW ICON ROW */
    .product-card .card-body .row {
        margin: 0 !important;
        display: flex !important;
        align-items: flex-start !important;
        width: 100% !important;
        flex: 1 !important;
    }
    
    .product-card .card-body .row .col-10 {
        flex: 1 !important;
        max-width: 100% !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* HIDE VIEW ICON ON MOBILE - HIDDEN IN MOBILE */
    .view-icon {
        display: none !important;
    }
    
    .product-card .card-body .row .col-2 {
        display: none !important;
    }
    
    /* PRICE LAYOUT - HORIZONTAL */
    .product-card .card-text {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        margin-bottom: 8px !important;
    }
    
    .product-card .card-text > div {
        display: flex !important;
        gap: 8px !important;
        align-items: center !important;
        flex-wrap: wrap !important;
    }
    
    /* PRICE STYLING */
    .product-card .card-text .text-danger {
        font-size: 11px !important;
        color: #dc3545 !important;
        text-decoration: line-through !important;
        font-weight: 500 !important;
        display: inline-block !important;
    }
    
    .product-card .card-text .text-success.fw-bold {
        font-size: 14px !important;
        color: #28a745 !important;
        font-weight: 700 !important;
        display: inline-block !important;
    }
    
    .product-card .card-text .fw-bold:not(.text-success) {
        font-size: 14px !important;
        color: #333 !important;
        font-weight: 700 !important;
        display: inline-block !important;
    }
    
    /* SELLER NAME */
    .product-card .card-text .seller-name {
        font-size: 8px !important;
        color: #28a745 !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
        margin-top: 4px !important;
        display: block !important;
    }
    
    /* CENTERED ADD TO CART BUTTON SECTION */
    .product-card .price-section {
        padding: 12px !important;
        margin-top: auto !important;
        background: #f8f9fa !important;
        border-top: 1px solid #e9ecef !important;
        min-height: 70px !important;
        max-height: 70px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }
    
    /* PROFESSIONAL ADD TO CART BUTTON */
    .product-card .add-to-cart-btn {
        padding: 8px 16px !important;
        font-size: 10px !important;
        width: 90% !important;
        max-width: 200px !important;
        background: transparent !important;
        border: 2px solid #FF8C00 !important;
        color: #FF8C00 !important;
        border-radius: 25px !important;
        font-weight: bold !important;
        text-transform: uppercase !important;
        transition: all 0.3s ease !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        letter-spacing: 0.4px !important;
        position: relative !important;
        overflow: hidden !important;
        min-height: 40px !important;
        margin: 0 auto !important;
    }
    
    .product-card .add-to-cart-btn:hover {
        background: #FF8C00 !important;
        color: white !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 15px rgba(153, 53, 53, 0.3) !important;
        border-color: #FF8C00 !important;
    }
    
    .product-card .add-to-cart-btn i {
        font-size: 10px !important;
        margin-right: 3px !important;
    }
    
    /* BUTTON SHINE EFFECT */
    .product-card .add-to-cart-btn::before {
        content: "" !important;
        position: absolute !important;
        top: 0 !important;
        left: -100% !important;
        width: 100% !important;
        height: 100% !important;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent) !important;
        transition: left 0.6s !important;
    }
    
    .product-card .add-to-cart-btn:hover::before {
        left: 100% !important;
    }
    
    /* Discount Badge */
    .discount-badge {
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        background: linear-gradient(45deg, #dc3545, #c82333) !important;
        color: white !important;
        padding: 4px 8px !important;
        border-radius: 12px !important;
        font-size: 10px !important;
        font-weight: 700 !important;
        z-index: 15 !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
        letter-spacing: 0.3px !important;
    }
    
    /* Overlay effect */
    .overlay {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background-image: url('../images/logo/ecom-logo-bw.png') !important;
        background-size: 60px 60px !important;
        background-repeat: repeat !important;
        transform: rotate(-45deg) !important;
        opacity: 0.05 !important;
        z-index: 5 !important;
        pointer-events: none !important;
    }
    
    /* SHOP PAGE MOBILE ADJUSTMENTS */
    .rts-shop-section {
        padding-top: 15px !important;
    }
    
    .shop-product-topbar {
        flex-wrap: wrap !important;
        gap: 10px !important;
        margin-bottom: 20px !important;
        padding: 15px 10px !important;
        border-bottom: 1px solid #e0e0e0 !important;
        background: #f8f9fa !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    /* Shop Search Bar Mobile Styling */
    .shop-search-bar-wrapper {
        margin-bottom: 20px !important;
        padding: 0 10px !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .shop-search-bar-wrapper .search-part.inline-search {
        width: 100% !important;
        max-width: 400px !important;
        display: flex !important;
        background: white !important;
        border: 2px solid #FF8C00 !important;
        border-radius: 25px !important;
        padding: 8px 15px !important;
        box-shadow: 0 3px 10px rgba(153, 53, 53, 0.15) !important;
        transition: all 0.3s ease !important;
    }
    
    .shop-search-bar-wrapper .search-part.inline-search:hover,
    .shop-search-bar-wrapper .search-part.inline-search:focus-within {
        border-color: #b8860b !important;
        box-shadow: 0 5px 15px rgba(153, 53, 53, 0.25) !important;
        transform: translateY(-2px) !important;
    }
    
    .shop-search-bar-wrapper .search-input-inline {
        flex: 1 !important;
        display: flex !important;
    }
    
    .shop-search-bar-wrapper .search-input-inline-field {
        width: 100% !important;
        border: none !important;
        outline: none !important;
        background: transparent !important;
        font-size: 14px !important;
        color: #333 !important;
        padding: 0 !important;
        font-weight: 500 !important;
    }
    
    .shop-search-bar-wrapper .search-input-inline-field::placeholder {
        color: #999 !important;
        font-style: italic !important;
    }
    
    .shop-search-bar-wrapper .search-icon {
        color: #FF8C00 !important;
        font-size: 16px !important;
        cursor: pointer !important;
        padding: 0 8px !important;
    }
    
    .shop-product-topbar .items-onlist {
        font-size: 15px !important;
        width: 100% !important;
        text-align: center !important;
        margin-bottom: 15px !important;
        font-weight: 700 !important;
        color: #333 !important;
        padding: 8px 12px !important;
        background: linear-gradient(135deg, #FF8C00, #b8860b) !important;
        color: white !important;
        border-radius: 20px !important;
        box-shadow: 0 3px 10px rgba(153, 53, 53, 0.3) !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }
    
    .filter-area {
        width: 100% !important;
        text-align: center !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .filter-area .select-area {
        width: 100% !important;
        max-width: 280px !important;
        margin: 0 !important;
    }
    
    .filter-area select {
        width: 100% !important;
        padding: 12px 16px !important;
        border: 2px solid #FF8C00 !important;
        border-radius: 25px !important;
        background: white !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #333 !important;
        text-align: center !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        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='%23993535' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>") !important;
        background-repeat: no-repeat !important;
        background-position: right 12px center !important;
        background-size: 12px !important;
        transition: all 0.3s ease !important;
        cursor: pointer !important;
    }
    
    .filter-area select:focus {
        outline: none !important;
        border-color: #b8860b !important;
        box-shadow: 0 0 15px rgba(153, 53, 53, 0.2) !important;
        background-color: #fffbf0 !important;
    }
    
    .filter-area select:hover {
        border-color: #b8860b !important;
        background-color: #fffbf0 !important;
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 12px rgba(153, 53, 53, 0.15) !important;
    }
    
    /* SHOP PAGE RESPONSIVE LAYOUT FIXES */
    .rts-shop-section .container {
        padding: 0 8px !important;
    }
    
    .rts-shop-section .row {
        margin: 0 !important;
    }
    
    .rts-shop-section .col-12 {
        padding: 0 4px !important;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    .card-container {
        min-height: 320px !important;
    }
    
    .product-card {
        min-height: 310px !important;
    }
    
    .product-card .image-container {
        height: 140px !important;
    }
    
    .product-card .card-body {
        padding: 10px !important;
    }
    
    .product-card .card-title {
        font-size: 13px !important;
        height: 36px !important;
    }
    
    .product-card .price-section {
        padding: 10px !important;
    }
    
    .product-card .add-to-cart-btn {
        font-size: 10px !important;
        padding: 0.2rem 0.4rem !important;
    }
}
