/* =============================================
   CARRITO — Cart page + Popup styles
   ============================================= */

/* ---- Cart Popup Overlay ---- */
.cart-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cpFadeIn .25s ease;
}
@keyframes cpFadeIn { from { opacity: 0; } to { opacity: 1; } }

.cart-popup {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px 32px;
    max-width: 400px;
    width: 92%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: cpSlideUp .3s ease;
}
@keyframes cpSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.cart-popup__close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}
.cart-popup__close:hover { color: #333; }

.cart-popup__icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.cart-popup h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    margin-bottom: 4px;
    color: #2c2c2c;
}

.cart-popup p {
    color: #777;
    font-size: .95rem;
    margin-bottom: 24px;
}

.cart-popup__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-popup__actions .btn--primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: #d4956a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
}
.cart-popup__actions .btn--primary:hover { background: #c07a4e; }

.cart-popup__actions .btn--outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 28px;
    background: transparent;
    color: #d4956a;
    border: 2px solid #d4956a;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: .2s;
}
.cart-popup__actions .btn--outline:hover { background: #fdf1ea; }


/* ---- Cart Page ---- */
.cart-page {
    padding: 120px 0 80px;
    min-height: 70vh;
}

.cart-page__title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #2c2c2c;
    margin-bottom: 32px;
}

.cart-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    align-items: start;
}

/* Header row */
.cart-header-row {
    display: grid;
    grid-template-columns: 1fr 130px 100px 40px;
    gap: 12px;
    padding: 0 0 12px;
    border-bottom: 2px solid #eee;
    margin-bottom: 8px;
    font-size: .85rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* Individual item row */
.cart-item {
    display: grid;
    grid-template-columns: 1fr 130px 100px 40px;
    gap: 12px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item__product {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cart-item__image {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #fdf1ea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    text-decoration: none;
}

.cart-item__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cart-item__name {
    font-weight: 600;
    color: #2c2c2c;
    text-decoration: none;
    font-size: .95rem;
    line-height: 1.3;
}
.cart-item__name:hover { color: #d4956a; }

.cart-item__unit {
    color: #aaa;
    font-size: .82rem;
}

.cart-item__option {
    display: block;
    color: #888;
    font-size: .82rem;
    font-weight: 500;
}

/* Quantity controls */
.cart-item__qty {
    display: flex;
    align-items: center;
    gap: 0;
    background: #f7f7f7;
    border-radius: 8px;
    overflow: hidden;
    width: fit-content;
}

.qty-btn {
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.qty-btn:hover { background: #eee; }

.qty-value {
    width: 32px;
    text-align: center;
    font-weight: 600;
    font-size: .95rem;
}

/* Subtotal */
.cart-item__subtotal {
    font-weight: 600;
    color: #2c2c2c;
    font-size: .95rem;
}

/* Remove button */
.cart-item__remove {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-item__remove:hover { color: #e74c3c; background: #fef5f5; }

/* Loading */
.cart-loading {
    text-align: center;
    padding: 60px 0;
    color: #aaa;
    font-size: 1rem;
}

/* ---- Cart Summary Sidebar ---- */
.cart-summary {
    background: #fdf9f6;
    border-radius: 16px;
    padding: 28px 24px;
    position: sticky;
    top: 100px;
}

.cart-summary h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #2c2c2c;
}

.cart-summary__row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: .95rem;
    color: #555;
}

.cart-summary__total {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2c2c2c;
}

.cart-summary__divider {
    height: 1px;
    background: #e8ddd5;
    margin: 12px 0;
}

.cart-summary__tax {
    font-size: .8rem;
    color: #aaa;
    text-align: center;
    margin-top: 4px;
    margin-bottom: 20px;
}

.cart-summary__promo {
    font-size: .8rem;
    color: #e8a4b8;
    text-align: center;
    margin: -4px 0 8px;
    font-weight: 500;
}

.cart-checkout-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: #d4956a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    margin-bottom: 12px;
}
.cart-checkout-btn:hover { background: #c07a4e; }

.cart-continue {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #d4956a;
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 0;
}
.cart-continue:hover { text-decoration: underline; }

/* ---- Payment Method Selector ---- */
.cart-payment-methods {
    margin-bottom: 18px;
}
.cart-payment__label {
    font-size: .82rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 10px;
}
.cart-payment__options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}
.cart-payment__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid #e8ddd5;
    border-radius: 10px;
    cursor: pointer;
    transition: .2s;
    font-size: .9rem;
    font-weight: 500;
    color: #555;
}
.cart-payment__option:hover {
    border-color: #d4956a;
}
.cart-payment__option--selected {
    border-color: #d4956a;
    background: rgba(212,149,106,.06);
    color: #2c2c2c;
}
.cart-payment__option input { display: none; }
.cart-payment__option svg { color: #999; flex-shrink: 0; }
.cart-payment__option--selected svg { color: #d4956a; }

.cart-payment__radio {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    transition: .2s;
}
.cart-payment__option--selected .cart-payment__radio {
    border-color: #d4956a;
}
.cart-payment__option--selected .cart-payment__radio::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 8px; height: 8px;
    background: #d4956a;
    border-radius: 50%;
}
.cart-payment__none {
    font-size: .85rem;
    color: #aaa;
    text-align: center;
    padding: 12px 0;
}
.cart-payment__loading {
    font-size: .85rem;
    color: #bbb;
    text-align: center;
    padding: 8px;
}


/* ---- Empty State ---- */
.cart-empty {
    text-align: center;
    padding: 80px 0;
}
.cart-empty__icon {
    font-size: 72px;
    display: block;
    margin-bottom: 16px;
}
.cart-empty h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: #2c2c2c;
    margin-bottom: 8px;
}
.cart-empty p {
    color: #999;
    margin-bottom: 28px;
    font-size: 1rem;
}


/* ---- Responsive ---- */
@media (max-width: 900px) {
    .cart-layout {
        grid-template-columns: 1fr;
        gap: 28px;
    }
    .cart-summary {
        position: static;
    }
}

@media (max-width: 600px) {
    .cart-page {
        padding: 100px 0 60px;
    }
    .cart-header-row { display: none; }
    .cart-item {
        grid-template-columns: 1fr auto auto;
        gap: 8px;
    }
    .cart-item__product {
        grid-column: 1 / -1;
    }
    .cart-item__image {
        width: 52px;
        height: 52px;
        font-size: 26px;
    }
    .cart-popup {
        padding: 28px 20px 24px;
    }
}

/* ---- Cart Address Form ---- */
.cart-address {
    grid-column: 1;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    padding: 28px 28px 24px;
    margin-top: 4px;
}
.cart-address__title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    color: #2d2d2d;
    margin: 0 0 16px;
}
.cart-address__fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.cart-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: .88rem;
    color: #333;
    transition: border-color .2s;
    box-sizing: border-box;
}
.cart-field input:focus {
    outline: none;
    border-color: #e8a4b8;
    box-shadow: 0 0 0 3px rgba(232,164,184,.15);
}
.cart-field input.field-error {
    border-color: #e74c3c;
}
.cart-field-row {
    display: flex;
    gap: 10px;
}
.cart-field-row .cart-field {
    flex: 1;
}
.cart-address__error {
    color: #e74c3c;
    font-size: .82rem;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fdf0f0;
    border-radius: 6px;
}
@media (max-width: 600px) {
    .cart-field-row {
        flex-direction: column;
    }
}
