/* Mobile Cart Improvements - Modular Design - FORCE OVERRIDE TAILWIND */

/* ====================================================================
   MAIN MOBILE CART STYLES - MODULAR PRODUCT CARDS - HIGH SPECIFICITY
   ==================================================================== */
@media screen and (max-width: 1023px) {
    
    /* Mobile cart item wrapper - modular design */
    .lg\\:hidden .mobile-cart-item-wrapper,
    .mobile-cart-item-wrapper {
        margin-bottom: 2rem !important;
        filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15)) !important;
        border-radius: 16px !important;
        overflow: hidden !important;
        background: transparent !important;
        display: block !important;
    }
    
    /* Product header card - FORCE OVERRIDE */
    .lg\\:hidden .mobile-product-header,
    .mobile-cart-item-wrapper .mobile-product-header,
    .mobile-product-header {
        background: white !important;
        border-bottom: none !important;
        position: relative !important;
        padding: 1rem !important;
        border-radius: 1rem 1rem 0 0 !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
        border: 1px solid #e5e7eb !important;
        margin-bottom: 0 !important;
    }
    
    /* Force separator line */
    .mobile-product-header::after {
        content: '' !important;
        position: absolute !important;
        bottom: 0 !important;
        left: 1rem !important;
        right: 1rem !important;
        height: 1px !important;
        background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent) !important;
        display: block !important;
    }
    
    /* Enhanced product images - FORCE */
    .mobile-product-header img {
        border-radius: 0.75rem !important;
        border: 2px solid #e5e7eb !important;
        transition: transform 0.3s ease, box-shadow 0.3s ease !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        width: 6rem !important;
        height: 6rem !important;
        object-fit: cover !important;
        display: block !important;
    }
    
    /* Product title styling - FORCE */
    .mobile-product-header h3 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
        color: #1f2937 !important;
        font-weight: 700 !important;
        margin-bottom: 0.5rem !important;
        word-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    /* Badge styles - FORCE */
    .mobile-product-header .inline-flex {
        font-size: 0.625rem !important;
        padding: 0.25rem 0.5rem !important;
        border-radius: 9999px !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }
    
    /* Remove button - FORCE */
    .mobile-product-header form button {
        width: 3rem !important;
        height: 3rem !important;
        border-radius: 0.75rem !important;
        transition: all 0.3s ease !important;
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2) !important;
        background: #fef2f2 !important;
        border: 1px solid #fecaca !important;
        color: #dc2626 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Price info card - FORCE GRADIENT */
    .lg\\:hidden .mobile-price-card,
    .mobile-cart-item-wrapper .mobile-price-card,
    .mobile-price-card {
        background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
        margin: 0 !important;
        position: relative !important;
        overflow: hidden !important;
        padding: 1rem !important;
        border-radius: 0 !important;
        color: white !important;
        border-left: 1px solid #e5e7eb !important;
        border-right: 1px solid #e5e7eb !important;
    }
    
    /* Price card text */
    .mobile-price-card p {
        position: relative !important;
        z-index: 1 !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
        margin: 0 !important;
        color: white !important;
    }
    
    .mobile-price-card .text-sm {
        font-size: 0.875rem !important;
        opacity: 0.9 !important;
        font-weight: 500 !important;
    }
    
    .mobile-price-card .text-2xl {
        font-size: 1.5rem !important;
        font-weight: 800 !important;
        line-height: 1.2 !important;
    }
    
    /* Quantity control card - FORCE */
    .lg\\:hidden .mobile-quantity-card,
    .mobile-cart-item-wrapper .mobile-quantity-card,
    .mobile-quantity-card {
        background: white !important;
        border-top: none !important;
        position: relative !important;
        padding: 1rem !important;
        border-radius: 0 0 1rem 1rem !important;
        border: 1px solid #e5e7eb !important;
        border-top: none !important;
        margin-top: 0 !important;
    }
    
    /* Quantity card separator */
    .mobile-quantity-card::before {
        content: '' !important;
        position: absolute !important;
        top: 0 !important;
        left: 1rem !important;
        right: 1rem !important;
        height: 1px !important;
        background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent) !important;
        display: block !important;
    }
    
    /* Quantity title */
    .mobile-quantity-card h4 {
        color: #374151 !important;
        font-size: 1.125rem !important;
        font-weight: 600 !important;
        margin-bottom: 1rem !important;
        text-align: center !important;
    }
    
    /* Quantity buttons - FORCE */
    .mobile-quantity-card button {
        width: 3rem !important;
        height: 3rem !important;
        border-radius: 0.75rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.3s ease !important;
        font-size: 1.125rem !important;
        font-weight: bold !important;
        background: white !important;
        border: 2px solid #e5e7eb !important;
        color: #6b7280 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    }
    
    /* Quantity input */
    .mobile-quantity-card input {
        background: transparent !important;
        color: #1f2937 !important;
        font-weight: 800 !important;
        font-size: 1.5rem !important;
        min-height: 3rem !important;
        text-align: center !important;
        border: none !important;
        outline: none !important;
    }
    
    /* Cart items container - FORCE */
    .lg\\:hidden.cart-items-container,
    .cart-items-container {
        padding-bottom: 180px !important;
        padding-top: 1rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Ensure no horizontal overflow - FORCE */
    .mobile-cart-item-wrapper,
    .mobile-product-header,
    .mobile-price-card,
    .mobile-quantity-card {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }
}
    
    /* Product title styling */
    .mobile-product-header h3 {
        font-size: 1.25rem;
        line-height: 1.3;
        color: #1f2937;
        font-weight: 700;
        margin-bottom: 0.5rem;
        word-wrap: break-word;
        hyphens: auto;
    }
    
    /* Badge styles for product tags */
    .mobile-product-header .inline-flex {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
        border-radius: 9999px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    /* Remove button enhanced */
    .mobile-product-header form button {
        width: 3rem;
        height: 3rem;
        border-radius: 12px;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
        background: #fef2f2;
        border: 1px solid #fecaca;
    }
    
    .mobile-product-header form button:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
        background: #fee2e2;
    }
    
    .mobile-product-header form button:active {
        transform: scale(0.9);
    }
      /* Price info card with gradient */
    .mobile-price-card {
        background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
        margin: 0 !important;
        position: relative;
        overflow: hidden;
        padding: 1rem !important;
        border-radius: 0 !important;
    }
    
    .mobile-price-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
        pointer-events: none;
    }
    
    .mobile-price-card p {
        position: relative;
        z-index: 1;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        margin: 0;
    }
    
    .mobile-price-card .text-sm {
        font-size: 0.875rem;
        opacity: 0.9;
        font-weight: 500;
    }
    
    .mobile-price-card .text-2xl {
        font-size: 1.5rem;
        font-weight: 800;
        line-height: 1.2;
    }
      /* Quantity control card */
    .mobile-quantity-card {
        background: white !important;
        border-top: none !important;
        position: relative;
        padding: 1rem !important;
        border-radius: 0 0 1rem 1rem !important;
        box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important;
        border-left: 1px solid #f3f4f6 !important;
        border-right: 1px solid #f3f4f6 !important;
        border-bottom: 1px solid #f3f4f6 !important;
    }
    
    .mobile-quantity-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 1rem;
        right: 1rem;
        height: 1px;
        background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
    }
    
    .mobile-quantity-card h4 {
        color: #374151;
        font-size: 1.125rem;
        font-weight: 600;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    /* Quantity controls - large and touch-friendly */
    .mobile-quantity-card button {
        width: 3rem;
        height: 3rem;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        font-size: 1.125rem;
        font-weight: bold;
        background: white;
        border: 2px solid #e5e7eb;
        color: #6b7280;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .mobile-quantity-card button:hover {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-color: #3b82f6;
        color: #3b82f6;
        background: #f8fafc;
    }
    
    .mobile-quantity-card button:active {
        transform: scale(0.95);
    }
    
    .mobile-quantity-card input {
        background: transparent;
        color: #1f2937;
        font-weight: 800;
        font-size: 1.5rem;
        min-height: 3rem;
        text-align: center;
        border: none;
        outline: none;
    }
    
    /* Quick info cards in quantity section */
    .mobile-quantity-card .grid > div {
        transition: all 0.3s ease;
        border: 1px solid rgba(0, 0, 0, 0.05);
        border-radius: 8px;
        padding: 0.75rem;
        text-align: center;
    }
    
    .mobile-quantity-card .grid > div:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-quantity-card .grid i {
        font-size: 1.25rem;
        margin-bottom: 0.25rem;
        display: block;
    }
    
    /* Cart items container spacing - prevents overlap with fixed bar */
    .cart-items-container {
        padding-bottom: 180px;
        padding-top: 1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Ensure no horizontal overflow */
    .mobile-cart-item-wrapper,
    .mobile-product-header,
    .mobile-price-card,
    .mobile-quantity-card {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }
    
    /* Fixed bottom checkout bar */
    .mobile-checkout-bar {
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
        border-top: 1px solid rgba(229, 231, 235, 0.8);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }
    
    /* Checkout button styling */
    .mobile-checkout-button {
        background: linear-gradient(135deg, #3b82f6, #1d4ed8);
        color: white;
        font-weight: 700;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
        transition: all 0.3s ease;
        min-height: 3.25rem;
        font-size: 1.125rem;
    }
    
    .mobile-checkout-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
        background: linear-gradient(135deg, #2563eb, #1e40af);
    }
    
    .mobile-checkout-button:active {
        transform: translateY(0);
    }
    
    /* Summary panel */
    .mobile-summary-panel {
        backdrop-filter: blur(10px);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
        background: rgba(255, 255, 255, 0.98);
    }
    
    .max-h-80vh {
        max-height: 80vh;
    }
    
    /* Action buttons */
    .mobile-action-button {
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border-radius: 12px;
        font-weight: 600;
        min-height: 3rem;
        font-size: 1rem;
    }
    
    .mobile-action-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }
    
    /* Form improvements */
    input[type="number"] {
        -webkit-appearance: none;
        -moz-appearance: textfield;
        appearance: none;
        font-size: 1rem;
    }
    
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        appearance: none;
        margin: 0;
    }
}

/* Small mobile devices */
@media screen and (max-width: 375px) {
    .mobile-cart-item-wrapper {
        margin-bottom: 1.5rem;
    }
    
    .mobile-product-header img {
        width: 5rem;
        height: 5rem;
    }
    
    .mobile-quantity-card button {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1rem;
    }
    
    .cart-items-container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* FORCE MODULAR DESIGN - Override Tailwind */
@media screen and (max-width: 1023px) {
    /* Force modular wrapper styling */
    .mobile-cart-item-wrapper {
        display: block !important;
        margin-bottom: 2rem !important;
        filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15)) !important;
        border-radius: 16px !important;
        overflow: hidden !important;
        box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    }
    
    /* Force header card styling */
    .mobile-cart-item-wrapper .mobile-product-header {
        background: #ffffff !important;
        border-bottom: none !important;
        position: relative !important;
        padding: 1.5rem !important;
        border-radius: 1rem 1rem 0 0 !important;
        box-shadow: none !important;
        border: 1px solid #f3f4f6 !important;
        border-bottom: none !important;
    }
    
    /* Force price card styling */
    .mobile-cart-item-wrapper .mobile-price-card {
        background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
        color: white !important;
        margin: 0 !important;
        padding: 1.5rem !important;
        border-radius: 0 !important;
        position: relative !important;
        overflow: hidden !important;
    }
    
    /* Force quantity card styling */
    .mobile-cart-item-wrapper .mobile-quantity-card {
        background: #ffffff !important;
        border-top: none !important;
        position: relative !important;
        padding: 1.5rem !important;
        border-radius: 0 0 1rem 1rem !important;
        box-shadow: none !important;
        border: 1px solid #f3f4f6 !important;
        border-top: none !important;
    }
    
    /* Force text colors in price card */
    .mobile-price-card p,
    .mobile-price-card .text-sm,
    .mobile-price-card .text-2xl {
        color: white !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Force modular layout spacing */
    .cart-items-container {
        padding-bottom: 180px !important;
        padding-top: 1rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Fixed bottom checkout bar - FORCE */
    .lg\\:hidden .mobile-checkout-bar,
    .mobile-checkout-bar {
        backdrop-filter: blur(10px) !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border-top: 1px solid rgba(229, 231, 235, 0.8) !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 50 !important;
    }
    
    /* Checkout button - FORCE */
    .mobile-checkout-button {
        background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
        color: white !important;
        font-weight: 700 !important;
        border-radius: 0.75rem !important;
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3) !important;
        transition: all 0.3s ease !important;
        min-height: 3.25rem !important;
        font-size: 1.125rem !important;
        border: none !important;
    }
    
    /* Summary panel - FORCE */
    .mobile-summary-panel {
        backdrop-filter: blur(10px) !important;
        border-top-left-radius: 20px !important;
        border-top-right-radius: 20px !important;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 50 !important;
    }
    
    /* Action buttons - FORCE */
    .mobile-action-button {
        transition: all 0.3s ease !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        border-radius: 0.75rem !important;
        font-weight: 600 !important;
        min-height: 3rem !important;
        font-size: 1rem !important;
    }
    
    /* Overlay styling - FORCE */
    #mobile-summary-overlay {
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 40 !important;
    }
    
    /* Transitions */
    #mobile-summary-chevron {
        transition: transform 0.3s ease !important;
    }
    
    .mobile-summary-panel {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    /* Transform states */
    .translate-y-full {
        transform: translateY(100%) !important;
    }
    
    /* Visibility states */
    .hidden {
        display: none !important;
    }
    
    /* Max height */
    .max-h-80vh {
        max-height: 80vh !important;
    }
}

/* Force display on small screens only */
@media screen and (max-width: 1023px) {
    /* Ensure modular layout is visible */
    .lg\\:hidden {
        display: block !important;
    }
    
    /* Hide desktop layout */
    .hidden.lg\\:block {
        display: none !important;
    }
}

/* Small devices adjustments */
@media screen and (max-width: 375px) {
    .mobile-cart-item-wrapper {
        margin-bottom: 1.5rem !important;
    }
    
    .mobile-product-header img {
        width: 5rem !important;
        height: 5rem !important;
    }
    
    .mobile-quantity-card button {
        width: 2.75rem !important;
        height: 2.75rem !important;
        font-size: 1rem !important;
    }
    
    .cart-items-container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}