/* ==========================================================================
   STYLESCART.CSS — Keranjang Belanja, Interaksi Item, Pengiriman & Tagihan
   ========================================================================== */

/* ---------- 1. TOMBOL KERANJANG DI HEADER ---------- */
.cart-btn {
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.3s ease, transform 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.cart-btn.highlight {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
}

.cart-btn-text {
    font-weight: 500;
    font-size: 1rem;
}

.cart-btn i {
    font-size: 1rem;
}

/* ---------- 2. PANEL & CONTAINER KERANJANG ---------- */
.cart-panel {
    background-image: url("https://img.sukahemat.com/ilustrasi/bg-keranjang.avif");
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    padding: 0;
}

.cart-header {
    padding: 0.75rem;
    margin-bottom: -2rem;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    gap: 1rem;
}

.cart-header h5 {
    font-size: 1.2rem;
}

.cart-header i {
    font-size: 1.2rem;
    margin-right: 0.25rem;
}

.cart-box {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    padding: 0.75rem;
    margin: 0 -0.75rem 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.cart-box .section-title {
    margin: 0 0 0.5rem;
}

.cart-box .cart-list-head {
    margin: 0 0 0.25rem;
}

.cart-box .cart-list-head .section-title {
    margin: 0;
}

.cart-box #cart-list .cart-item:last-child {
    border-bottom: 0;
}

.cart-box .total-bayar {
    margin: 0.5rem 0 0.25rem;
}

.cart-box .subtotal-info:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 1rem 0 0.5rem;
}

.empty-state img {
    max-width: 50%;
    margin-bottom: 0;
}

.empty-state {
    font-size: 0.9rem;
    text-align: center;
}

/* ---------- 3. DAFTAR ITEM & INTERAKSI (SWIPE & LONG PRESS) ---------- */
.cart-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 2rem;
}

.cart-delete-selected {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2rem;
    padding: 0 0.4rem 0 0.75rem;
    margin: 0;
    border: 1px solid #f5b7b1;
    border-radius: 999px;
    background: #fdecea;
    color: #c0392b;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.1s ease;
    animation: cartDeletePop 0.18s ease-out;
}

.cart-delete-selected i {
    font-size: 0.8rem;
}

.cart-delete-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.cart-delete-selected:active {
    background: #fadbd8;
    transform: scale(0.97);
}

@keyframes cartDeletePop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0 0;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
    line-height: 1rem;
    position: relative;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.cart-item.selected {
    background: #e3f2fd;
    box-shadow: -0.75rem 0 0 #e3f2fd, 0.75rem 0 0 #e3f2fd;
}

.cart-item.selected .cart-item-number {
    color: #3498db;
}

.cart-item::before {
    content: '\f2ed';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 0;
    bottom: 0;
    right: calc(100% + 0.75rem);
    width: 200%;
    display: none;
    align-items: center;
    justify-content: flex-end;
    padding-right: 1rem;
    background: #e74c3c;
    color: #fff;
    font-size: 1.1rem;
    border-radius: 0.5rem;
    pointer-events: none;
}

.cart-item.swiping::before {
    display: flex;
}

.cart-item-number {
    flex: 0 0 auto;
    min-width: 1.4rem;
    margin-right: 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
    text-align: left;
}

.cart-item-img {
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    margin: 0.25rem 0.6rem 0.25rem 0;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
    background: #f1f3f5;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

.cart-item-details {
    flex-grow: 1;
    min-width: 0;
    font-size: 0.9rem;
}

.cart-item-details .text-muted.cart-item-variant {
    font-size: inherit;
    margin: 0;
}

.cart-item-details .text-muted {
    font-size: 0.75rem;
    margin: 0.15rem 0;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quantity-input {
    width: 2.6rem;
    height: 1.6rem;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    margin: 0.5rem 0 0.5rem 0.5rem;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    -webkit-user-select: text;
    user-select: text;
    
    /* Standar reset spin button */
    appearance: textfield;
    -moz-appearance: textfield;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

#cart-list.selection-mode .quantity-input {
    pointer-events: none;
    opacity: 0.6;
}

/* ---------- 4. PEMILIH PENGIRIMAN (FULFILLMENT SELECTOR) ---------- */
.fulfil-card {
    background: #fff;
    border: none;
    border-radius: 0.75rem;
    margin: 0 -0.75rem 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.fulfil-segment {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    padding: 0.75rem;
    background: #3498dbb2;
    border-bottom: 1px solid #e9ecef;
}

.fulfil-seg-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
}

.fulfil-seg-btn i {
    color: #fff;
}

.fulfil-seg-btn.active {
    background: #fff;
    color: #3498db;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.fulfil-seg-btn.active i {
    color: #3498db;
}

.fulfil-seg-btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.fulfil-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #fff;
}

.fulfil-detail-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.fulfil-detail-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: #eaf4fb;
    color: #3498db;
}

.fulfil-detail-text {
    min-width: 0;
}

.fulfil-title {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
}

.fulfil-sub {
    margin: 0;
    font-size: 0.75rem;
    color: #64748b;
}

.fulfil-change-btn {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 0.5rem;
    background: #eaf4fb;
    color: #2980b9;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

.fulfil-change-btn:active {
    background: #d4e9f7;
}

/* ---------- 5. BALON PEMBERITAHUAN VOUCHER ---------- */
.voucher-empty-balloon {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fff8e1;
    border: 1px solid #f0d78c;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin: 0 -0.75rem 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    animation: voucherBalloonIn 0.3s ease;
}

@keyframes voucherBalloonIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.voucher-empty-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    font-size: 0.8rem;
    color: #5d4e37;
    line-height: 1.35;
    font-weight: 500;
}

.voucher-empty-content i {
    color: #e67e22;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* ---------- 6. RINGKASAN TAGIHAN & AKSI CHECKOUT ---------- */
.subtotal-info {
    font-size: 0.9rem;
    color: #555;
    display: flex;
    align-items: center;
    margin: 0;
    gap: 1.1rem;
    flex-wrap: nowrap;
}

.subtotal-info .icon-wrapper {
    flex: 0 0 auto;
    font-size: 0.9rem;
    color: #6c757d;
    width: 0.3rem;
    text-align: center;
}

.subtotal-info .label-wrapper {
    flex: 1;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subtotal-info .value-wrapper {
    flex: 0 0 auto;
    text-align: right;
}

.subtotal-info strong {
    color: #2c3e50;
    font-size: 0.9rem;
}

.total-bayar {
    background-color: #e8f5e9;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -0.5rem -0.75rem;
    gap: 0.5rem;
}

.cart-actions {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    margin: 1rem 0 1rem -0.75rem;
    width: calc(100% + 1.5rem);
}

.cart-actions .btn-checkout {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    margin: 0;
    white-space: nowrap;
}

.btn-continue {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #3498db;
    border-radius: 0.5rem;
    background: #fff;
    color: #2980b9;
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.btn-continue:hover,
.btn-continue:focus {
    background: #eaf4fb;
    color: #2980b9;
    border-color: #3498db;
}

.btn-continue:active {
    transform: scale(0.97);
}

.btn-checkout {
    background-color: #2ecc71;
    border: 1px solid #26aa5d;
    padding: 0.5rem;
    font-weight: 500;
    border-radius: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-checkout:focus {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    outline: none;
}

.btn-checkout:active {
    transform: translateY(0);
}

.btn-checkout i {
    font-size: 1.2rem;
}

.btn-checkout.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-checkout.loading .btn-spinner {
    display: inline-block;
    margin-right: 0.1rem;
}

.btn-spinner {
    display: none;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}