﻿/* ============================================
   CART QUANTITY CONTROLS
   ============================================ */

.quantity-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #f5f1ed;
    border: 1px solid #d4c4b0;
    border-radius: 5px;
    padding: 0.25rem;
}

.quantity-btn {
    background: white;
    border: 1px solid #d4c4b0;
    border-radius: 5px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #705542;
    padding: 0;
    flex-shrink: 0;
}

.quantity-btn:hover:not(:disabled) {
    background: #705542;
    border-color: #705542;
    color: white;
    transform: scale(1.05);
}

.quantity-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.quantity-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.quantity-display {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #705542;
    user-select: none;
}

/* ============================================
   PROMOTION GROUPING - JOINED ITEMS
   ============================================ */

/* Promotion Group - fluid section, no card */
.cart-promotion-group {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-bottom: 0;
    border: none;
    box-shadow: none;
}

.cart-promotion-group:hover {
    box-shadow: none;
    border-color: transparent;
    transform: none;
}

/* Promotion Header - inline tag next to price label */
.cart-promotion-header {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.35rem;
    background: #f5f1ed;
    border-radius: 5px;
    font-size: 0.62rem;
    color: #8b6f47;
    margin: 0 0.3rem 0 0;
    vertical-align: middle;
    flex-shrink: 0;
}

.cart-promotion-label {
    display: none; /* Hide "Promoção" text */
}

.cart-promotion-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.1rem 0.35rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.cart-promotion-count {
    display: none; /* Hide count */
}

/* Items within promotion group — same fluid style as regular items */
.cart-promotion-group .cart-item {
    background: transparent !important;
    padding: 0.55rem 0.25rem !important;
    margin-bottom: 0 !important;
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.cart-promotion-group .cart-item:hover {
    background: #faf7f4 !important;
    transform: none !important;
    box-shadow: none !important;
}

.cart-promotion-group .cart-item:last-child {
    border-bottom: 1px solid #f0e6dd !important;
    margin-bottom: 0 !important;
    padding-bottom: 0.55rem !important;
}

/* No divider between items in the same promotion group */
.cart-promotion-group .cart-item:not(:last-child) {
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

/* Cart item header positioning */
.cart-promotion-group .cart-item-header {
    position: static;
}

/* Remove button inside promotion groups — inline, same as regular items */
.cart-promotion-group .cart-item .cart-remove-btn {
    display: block !important;
    position: static;
    top: auto;
    right: auto;
}

/* Cart item with points (gifts) styling - Outside promotion groups */
.cart-item-gift {
    background: rgba(76, 175, 80, 0.04) !important;
    border-left: 3px solid #4caf50 !important;
    padding-left: 0.5rem;
}

/* Remove hover effects on free products */
.cart-item-gift:hover {
    background: rgba(76, 175, 80, 0.07) !important;
    transform: none !important;
}

/* Hide remove button on gift products (points products) - HIGHEST PRIORITY */
.cart-item-gift .cart-remove-btn,
.cart-promotion-group .cart-item-gift .cart-remove-btn {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .cart-promotion-group {
        padding: 0;
    }

    .cart-promotion-header {
        font-size: 0.58rem;
        padding: 0.08rem 0.3rem;
    }

    .cart-promotion-badge {
        font-size: 0.55rem;
    }
}

.cart-section-divider {
    border-top: 2px dashed #f4d9a6;
    margin: 1rem 0;
}

.cart-section-divider strong {
    color: #8b6f47;
    font-size: 0.9rem;
}

/* Individual Cart Item — fluid list style */
.cart-item {
    background: transparent;
    padding: 0.55rem 0.25rem;
    border-radius: 0;
    margin-bottom: 0 !important;
    border: none !important;
    border-bottom: 1px solid #f0e6dd !important;
    transition: background 0.15s ease;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.cart-item:hover {
    background: #faf7f4;
    box-shadow: none;
    border-color: #f0e6dd !important;
    transform: none;
}

.cart-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
}

/* Cart Item Image */
.cart-item-img {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border: 1px solid #ece4da;
    border-radius: 5px;
    flex-shrink: 0;
    transition: border-color 0.15s ease;
}

.cart-item:hover .cart-item-img {
    border-color: #d4c4b0;
}

/* Cart Item Title */
.cart-item-title {
    font-size: 0.87rem;
    font-weight: 600;
    color: #3d2f26;
    margin-bottom: 0 !important;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

/* Cart Item Price */
/* Cart Item Price */
.cart-item-price {
    color: #705542 !important;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

/* Stacked price (original strikethrough + discounted) — used by A_TO_VALORDEST items */
.cart-item-price-stack {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
}

.cart-item-price-stack small {
    font-size: 0.72rem;
}

.cart-item-price-stack strong {
    font-size: 0.88rem;
    font-weight: 700;
}

/* Unit price label (e.g. "32,30 € / CX = 64,60 €") */
.cart-item-price-label {
    font-size: 0.8rem;
    color: #8b6f47;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: space-between;
    text-align: left;
}

.cart-item-price-label strong {
    color: #705542;
    font-size: 0.88rem;
}

/* Coupon tag — shown on A_TO_VALORDEST items instead of qty */
.cart-item-coupon-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #059669;
    background: rgba(5, 150, 105, 0.08);
    border: 1px solid rgba(5, 150, 105, 0.25);
    border-radius: 5px;
    padding: 0.1rem 0.4rem;
    flex-shrink: 0;
}

/* Quantity selector — matches LeopoldoClick go-qty-selector style */
.cart-qty-selector {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #d4c4b0;
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
}

.cart-qty-input {
    width: 38px;
    text-align: center;
    border: none;
    font-weight: 600;
    font-size: 0.82rem;
    color: #705542;
    background: #fff;
    padding: 0.15rem 0.2rem;
    -moz-appearance: textfield;
}

.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-qty-input:focus {
    outline: none;
}

.cart-qty-unit {
    font-size: 0.68rem;
    font-weight: 600;
    color: #705542;
    background: #f5f1ed;
    border-right: 1px solid #d4c4b0;
    padding: 0 0.3rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
    line-height: 1;
}

/* Remove Button - Enhanced */
.cart-remove-btn {
    display: block !important;
    transition: all 0.2s ease;
    color: #dc3545 !important;
    padding: 0.25rem !important;
    line-height: 1;
    align-self: flex-start;
}

/* Ensure solo cart items ALWAYS show remove button (not in promotion group) */
#cartItems > .cart-item .cart-remove-btn {
    display: block !important;
}

.cart-remove-btn:focus {
    outline: none;
    box-shadow: none;
}

.cart-remove-btn:hover {
    transform: scale(1.15);
    color: #c82333 !important;
}

.cart-remove-btn:active {
    transform: scale(1.05);
}

/* Cart item layout improvements */
.cart-item-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
}

.cart-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cart-item-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.cart-item-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

/* Responsive adjustments for quantity controls */
@media (max-width: 576px) {
    .quantity-controls {
        padding: 0.2rem;
        gap: 0.35rem;
    }

    .quantity-btn {
        width: 24px;
        height: 24px;
    }

    .quantity-display {
        min-width: 25px;
        font-size: 0.85rem;
    }

    .cart-item {
        padding: 0.75rem;
    }

    .cart-item-img {
        width: 60px;
        height: 60px;
    }

    .cart-item-title {
        font-size: 0.9rem;
    }

    .cart-item-price {
        font-size: 1rem;
    }
}

