/* =========================================
   Mobile Cart & Checkout Responsiveness Fixes
   ========================================= */

@media (max-width: 767.98px) {
    /* --- Cart Page --- */

    /* Hide the desktop header row */
    .cart-header-row {
        display: none !important;
    }

    /* Make cart item row wrap content */
    .cart-item-row {
        flex-wrap: wrap !important;
        height: auto !important;
        padding: 12px !important;
        position: relative;
    }

    /* Image container */
    .cart-item-row>div:nth-child(1) {
        flex: 0 0 50px !important;
        max-width: 50px !important;
        margin-bottom: 8px;
        margin-right: 15px;
        text-align: left;
        order: 1;
    }

    /* Product name (Full width on second row) */
    .cart-item-row>div:nth-child(2) {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 12px;
        white-space: normal !important;
        overflow: visible !important;
        text-align: left;
        order: 4;
        padding-top: 5px;
    }

    /* Price (Strike-through MRP) - move to new line or hide if redundant */
    .cart-item-row>div:nth-child(3) {
        display: none !important;
        /* Hide MRP column on mobile to save space */
    }

    .cart-item-row>div:nth-child(4) {
        flex: 0 0 auto !important;
        min-width: auto !important;
        text-align: left !important;
        font-weight: normal;
        font-size: 0.95rem !important;
        order: 2;
        margin-right: 15px;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
    }

    .cart-item-row>div:nth-child(4)::before {
        content: "Price: ";
        font-weight: normal;
        color: #666;
        font-size: 0.9rem;
        margin-right: 4px;
    }

    /* Savings */
    .cart-item-row>div:nth-child(5) {
        display: none !important;
        /* Hide savings column on mobile */
    }

    /* Quantity Control */
    .cart-item-row>div:nth-child(6) {
        flex: 0 0 auto !important;
        min-width: auto !important;
        order: 3;
        margin-bottom: 8px;
        margin-right: auto;
        display: flex;
        align-items: center;
        /* Push remove button to right */
    }

    /* Total Row (Duplicate of You Pay * Qty) - Often redundant on mobile, but let's keep it if needed or hide it */
    .cart-item-row>div:nth-child(7) {
        display: none !important;
        /* Hide Total column, user sees subtotal at bottom */
    }

    /* Remove Button */
    .cart-item-row>div:nth-child(8) {
        position: absolute;
        top: 12px;
        right: 12px;
        flex: 0 0 auto !important;
        min-width: auto !important;
    }

    /* Stack checkout summary */
    .shopping-card .card-body {
        padding: 15px;
    }

    /* --- Checkout Page --- */

    /* Address Actions Buttons */
    .address-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .address-actions .btn {
        flex: 1 1 auto;
        margin-right: 0;
        margin-bottom: 5px;
        text-align: center;
        padding: 6px 10px;
    }

    /* Payment Method Radio Labels */
    .form-check-label {
        padding: 12px;
    }

    /* Place Order Button */
    .place-order-btn {
        padding: 12px;
        font-size: 1.1rem;
    }

    /* Add Address Form inputs */
    #addAddressForm .col-md-6,
    #addAddressForm .col-md-4,
    #addAddressForm .col-md-8,
    #addAddressForm .col-md-12 {
        margin-bottom: 10px;
    }

    .checkout-card {
        margin-bottom: 15px;
    }
}