/* ═══════════════════════════════════════════════════════════
   MinhTamCoconut — cart.css
   Trang giỏ hàng
═══════════════════════════════════════════════════════════ */

/* ── LAYOUT ─────────────────────────────────────────────── */
.cart-page {
    padding: 48px 8% 80px;
    background: white;
    min-height: 60vh;
}

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

/* ── SECTION TITLE ──────────────────────────────────────── */
.cart-section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem; font-weight: 600;
    color: var(--ink); margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}

.cart-section-title span {
    background: var(--g1); color: var(--g6);
    font-size: 0.72rem; font-weight: 700;
    padding: 3px 9px; border-radius: 12px;
    font-family: 'DM Sans', sans-serif;
}

/* ── CART ITEMS LIST ────────────────────────────────────── */
.cart-list {
    display: flex; flex-direction: column; gap: 14px;
}

.cart-item {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 18px; align-items: center;
    padding: 18px 20px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 18px;
    transition: all 0.3s;
    position: relative;
}

.cart-item:hover {
    border-color: var(--g3);
    box-shadow: 0 6px 24px rgba(58,170,86,0.08);
}

/* Ảnh sản phẩm */
.ci-img {
    width: 90px; height: 90px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.8rem; flex-shrink: 0;
    overflow: hidden;
}

.ci-img.bg-finished { background: linear-gradient(150deg, var(--g1), var(--g2)); }
.ci-img.bg-raw      { background: linear-gradient(150deg, #fff8e6, #fce7b4); }
.ci-img.bg-topping  { background: linear-gradient(150deg, #e6f4ff, #b9d9f5); }
.ci-img.bg-gift     { background: linear-gradient(150deg, #f5e6ff, #dbb9f5); }
.ci-img.bg-default  { background: linear-gradient(150deg, var(--g0), #c0f0cc); }

.ci-img img {
    width: 100%; height: 100%; object-fit: contain; padding: 8px;
}

/* Thông tin */
.ci-info { min-width: 0; }

.ci-cat {
    font-size: 0.62rem; letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--g5); font-weight: 700; margin-bottom: 4px;
}

.ci-name {
    font-weight: 600; font-size: 0.95rem; color: var(--ink);
    margin-bottom: 4px; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ci-unit {
    font-size: 0.75rem; color: var(--muted);
}

.ci-price-unit {
    font-size: 0.82rem; color: var(--ink-soft); margin-top: 6px; font-weight: 500;
}

/* Bên phải: qty + subtotal + xóa */
.ci-right {
    display: flex; flex-direction: column;
    align-items: flex-end; gap: 10px; flex-shrink: 0;
}

.ci-subtotal {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem; font-weight: 600; color: var(--g5);
    white-space: nowrap;
}

/* Qty control nhỏ */
.ci-qty {
    display: flex; align-items: center;
    border: 1.5px solid var(--g2); border-radius: 22px;
    overflow: hidden; background: white;
}

.ci-qty-btn {
    width: 32px; height: 32px; border: none; background: none;
    font-size: 1rem; color: var(--g6); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s; flex-shrink: 0;
}

.ci-qty-btn:hover { background: var(--g1); }

.ci-qty-input {
    width: 38px; text-align: center; border: none; outline: none;
    font-size: 0.85rem; font-weight: 700; color: var(--ink);
    font-family: 'DM Sans', sans-serif;
    -moz-appearance: textfield;
}

.ci-qty-input::-webkit-inner-spin-button { display: none; }

/* Nút xóa */
.ci-remove {
    background: none; border: none; cursor: pointer;
    color: #ccc; font-size: 1rem; line-height: 1;
    transition: color 0.2s; padding: 2px;
    display: flex; align-items: center;
}

.ci-remove:hover { color: #e74c3c; }

/* Loading overlay khi đang update */
.ci-loading {
    position: absolute; inset: 0; border-radius: 18px;
    background: rgba(255,255,255,0.75);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}

.cart-item.updating .ci-loading { opacity: 1; pointer-events: all; }

/* ── EMPTY CART ─────────────────────────────────────────── */
.cart-empty {
    grid-column: 1 / -1;
    text-align: center; padding: 80px 20px;
}

.cart-empty-icon { font-size: 5rem; margin-bottom: 16px; display: block; }

.cart-empty-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem; font-weight: 300; color: var(--ink); margin-bottom: 10px;
}

.cart-empty-desc { font-size: 0.9rem; color: var(--muted); margin-bottom: 28px; }

/* ── ORDER SUMMARY (sidebar) ────────────────────────────── */
.order-summary {
    background: var(--g0);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 28px 24px;
    position: sticky; top: 90px;
}

.summary-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem; font-weight: 600; color: var(--ink);
    margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.summary-row {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 12px;
    font-size: 0.87rem;
}

.summary-row-label { color: var(--ink-soft); }
.summary-row-val   { font-weight: 600; color: var(--ink); }

.summary-divider {
    border: none; border-top: 1px dashed var(--g3);
    margin: 16px 0;
}

.summary-total {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 20px;
}

.summary-total-label {
    font-size: 0.9rem; font-weight: 700; color: var(--ink);
}

.summary-total-val {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.9rem; font-weight: 600; color: var(--g5);
}

/* Voucher input */
.voucher-wrap {
    display: flex; gap: 8px; margin-bottom: 20px;
}

.voucher-input {
    flex: 1; padding: 10px 14px; border-radius: 12px;
    border: 1.5px solid var(--g2); font-family: 'DM Sans', sans-serif;
    font-size: 0.83rem; color: var(--ink); outline: none;
    text-transform: uppercase; letter-spacing: 1px;
    transition: border-color 0.3s;
}

.voucher-input:focus { border-color: var(--g4); }
.voucher-input::placeholder { text-transform: none; letter-spacing: 0; }

.voucher-btn {
    padding: 10px 16px; border-radius: 12px; border: none;
    background: var(--g1); color: var(--g6); font-weight: 700;
    font-size: 0.8rem; cursor: pointer; font-family: 'DM Sans', sans-serif;
    transition: all 0.2s; white-space: nowrap;
}

.voucher-btn:hover { background: var(--g2); }

/* Checkout button */
.btn-checkout {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 15px;
    background: linear-gradient(135deg, var(--g5), var(--g6));
    color: white; border: none; border-radius: 16px;
    font-family: 'DM Sans', sans-serif; font-weight: 700; font-size: 0.95rem;
    cursor: pointer; transition: all 0.3s; text-decoration: none;
    box-shadow: 0 6px 22px var(--shadow-g);
    margin-bottom: 12px;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--shadow-g);
    color: white;
}

.btn-continue {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; padding: 12px;
    background: white; color: var(--g6);
    border: 1.5px solid var(--g3); border-radius: 16px;
    font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.85rem;
    text-decoration: none; transition: all 0.3s;
}

.btn-continue:hover { background: var(--g0); border-color: var(--g5); color: var(--g6); }

/* Trust badges */
.summary-trust {
    display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; justify-content: center;
}

.strust {
    display: flex; align-items: center; gap: 4px;
    font-size: 0.65rem; color: var(--muted); font-weight: 500;
}

/* Clear cart */
.cart-actions {
    display: flex; justify-content: flex-end; margin-bottom: 16px;
}

.btn-clear-cart {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.78rem; color: var(--muted); font-weight: 500;
    background: none; border: none; cursor: pointer;
    transition: color 0.2s; font-family: 'DM Sans', sans-serif;
    padding: 4px 0;
}

.btn-clear-cart:hover { color: #e74c3c; }

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

@media (max-width: 640px) {
    .cart-page { padding: 36px 5% 60px; }
    .cart-item { grid-template-columns: 72px 1fr; gap: 12px; }
    .ci-right  { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
    .ci-img    { width: 72px; height: 72px; font-size: 2.2rem; }
}
