/* ============================================================
 * Ahmadiyad - Cart & Wishlist Styles
 * ============================================================ */

/* --- Common Container --- */
.cw-section {
    padding: 60px 20px;
    background-color: var(--bg-light, #fafafa);
    min-height: 70vh;
}
.cw-container {
    max-width: 1200px;
    margin: 0 auto;
}
.cw-header {
    text-align: center;
    margin-bottom: 30px;
}
.cw-header h1 {
    font-size: 2.2rem;
    font-family: var(--font-heading, var(--font));
    color: var(--text);
    margin-bottom: 8px;
}
.cw-header p {
    color: #888;
    font-size: 14px;
}

/* --- Empty State --- */
.cw-empty {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}
.cw-empty-icon {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 20px;
}
.cw-empty h2 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 15px;
}
.cw-btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--text);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.3s ease;
}
.cw-btn:hover {
    background-color: var(--secondary);
    color: #fff;
}

/* --- Cart Layout --- */
.cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: flex-start;
}

/* --- Cart Items Wrapper --- */
.cart-items-wrapper {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* --- Custom Checkbox Design --- */
.cart-real-checkbox {
    display: none;
}

.cart-custom-checkbox-wrap,
.cart-item-select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.cart-checkbox-pill {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cart-checkbox-pill i {
    font-size: 12px;
    color: #fff;
    font-weight: 900;
    display: none;
}

.cart-real-checkbox:checked + .cart-checkbox-pill {
    background: var(--secondary);
    border-color: var(--secondary);
}

.cart-real-checkbox:checked + .cart-checkbox-pill i {
    display: block;
}

/* --- Select All Header Bar --- */
.cart-select-all-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #fdfdfd;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
    border-radius: 8px;
}

.cart-select-all-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.cart-delete-selected-header-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}

.cart-delete-selected-header-btn:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.08);
}

/* --- Cart Items List --- */
.cart-item {
    display: flex;
    align-items: center;
    padding: 18px 10px;
    border-bottom: 1px solid #f0f0f0;
    gap: 16px;
    transition: background 0.2s ease;
}
.cart-item:last-child {
    border-bottom: none;
    padding-bottom: 10px;
}

.cart-item-img {
    width: 84px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    background: #f9f9f9;
    flex-shrink: 0;
}
.cart-item-details {
    flex-grow: 1;
    min-width: 0;
}
.cart-item-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 4px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-title:hover {
    color: var(--secondary);
}
.cart-item-meta {
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
}
.cart-item-meta span {
    margin-right: 14px;
}
.cart-item-price {
    font-weight: 700;
    color: var(--secondary);
    font-size: 16px;
}
.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    flex-shrink: 0;
}
.cart-qty-ctrl {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}
.cart-qty-btn {
    background: #f5f5f5;
    border: none;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    transition: background 0.2s;
}
.cart-qty-btn:hover {
    background: #e0e0e0;
}
.cart-qty-input {
    width: 36px;
    height: 30px;
    border: none;
    text-align: center;
    font-weight: 600;
    pointer-events: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    background: #fff;
    color: var(--text);
}
.cart-remove-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s;
}
.cart-remove-btn:hover {
    opacity: 0.7;
}

/* --- Cart Summary (Desktop) --- */
.cart-summary {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: fit-content;
    position: sticky;
    top: 100px;
}
.cart-summary h3 {
    margin-bottom: 18px;
    font-size: 1.2rem;
    color: var(--text);
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
    color: #777;
    font-size: 14px;
}
.summary-total {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
}
.checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--text);
    color: #fff;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 22px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}
.checkout-btn:hover {
    background: var(--secondary);
}

/* --- Wishlist Grid --- */
.wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}
.wishlist-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    position: relative;
    transition: transform 0.3s;
}
.wishlist-card:hover {
    transform: translateY(-5px);
}
.wishlist-card-img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}
.wishlist-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e74c3c;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: background 0.2s;
}
.wishlist-remove:hover {
    background: #e74c3c;
    color: #fff;
}
.wishlist-info {
    padding: 15px;
    text-align: center;
}
.wishlist-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    margin-bottom: 5px;
    display: block;
}
.wishlist-price {
    color: var(--secondary);
    font-weight: 700;
    margin-bottom: 15px;
}
.wishlist-add-cart {
    width: 100%;
    padding: 10px;
    background: var(--text);
    border: none;
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}
.wishlist-add-cart:hover {
    background: var(--secondary);
    color: #fff;
}

/* --- Mobile Checkout Bar (Hidden on Desktop) --- */
.mobile-cart-checkout-bar {
    display: none;
}

/* ============================================================
 * MOBILE RESPONSIVE
 * ============================================================ */
@media (max-width: 768px) {
    .cw-section.cart-page-section {
        padding: 16px 12px calc(var(--bottom-nav-height, 65px) + 120px) !important;
        min-height: auto;
    }
    .cw-header {
        margin-bottom: 16px;
    }
    .cw-header h1 {
        font-size: 1.5rem;
    }
    .cw-header p {
        font-size: 12px;
    }

    .cart-layout {
        grid-template-columns: 1fr;
        gap: 0;
        width: 100%;
    }

    .cart-items-wrapper {
        padding: 12px 10px;
        border-radius: 12px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .cart-select-all-header {
        padding: 8px 10px;
        margin-bottom: 8px;
    }

    .cart-item {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 10px 4px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        border-bottom: 1px solid #f0f0f0;
    }

    .cart-item-select-wrap {
        flex-shrink: 0;
    }

    .cart-item-img {
        width: 52px !important;
        height: 64px !important;
        flex-shrink: 0 !important;
        border-radius: 6px;
    }

    .cart-item-details {
        flex: 1 !important;
        min-width: 0 !important;
    }

    .cart-item-title {
        font-size: 12px !important;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 2px;
    }

    .cart-item-meta {
        font-size: 10px !important;
        margin-bottom: 2px !important;
        color: #888;
    }

    .cart-item-price {
        font-size: 13px !important;
        font-weight: 700;
        color: var(--secondary);
    }

    .cart-item-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        justify-content: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }

    .cart-qty-ctrl {
        display: flex;
        align-items: center;
        border: 1px solid #e0e0e0;
        border-radius: 6px;
        overflow: hidden;
    }

    .cart-qty-btn {
        width: 22px !important;
        height: 22px !important;
        font-size: 11px !important;
        background: #f5f5f5;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cart-qty-input {
        width: 24px !important;
        height: 22px !important;
        font-size: 11px !important;
        text-align: center;
        border: none;
        padding: 0;
    }

    .cart-remove-btn {
        font-size: 10px !important;
        padding: 2px 4px;
        color: #999;
        border: none;
        background: none;
        cursor: pointer;
    }

    /* Hide desktop summary on mobile */
    .desktop-cart-summary {
        display: none !important;
    }

    /* Mobile Fixed Checkout Bar (Positioned cleanly right above bottom-nav) */
    .mobile-cart-checkout-bar {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: var(--bottom-nav-height, 65px);
        left: 0;
        right: 0;
        z-index: 1040;
        background: #ffffff;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
        padding: 10px 14px;
        gap: 6px;
        width: 100%;
        box-sizing: border-box;
    }

    .mobile-checkout-bar-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .mobile-bar-left {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mobile-bar-left .cart-select-all-text {
        font-size: 12px;
        font-weight: 600;
        color: var(--text);
    }

    .mobile-bar-right {
        text-align: right;
    }

    .mobile-payable-label {
        font-size: 11px;
        color: var(--text);
    }

    .mobile-payable-label strong {
        color: var(--secondary);
        font-size: 14px;
        font-weight: 700;
        margin-left: 2px;
    }

    .mobile-checkout-btn-wrap {
        width: 100%;
    }

    .mobile-checkout-btn {
        width: 100%;
        height: 44px;
        padding: 0 16px;
        background: var(--secondary);
        color: #ffffff;
        font-size: 13px;
        font-weight: 700;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        box-shadow: 0 4px 12px rgba(213,0,109,0.3);
    }
}



