/* ==========================================================
   Cart Page — DokterTaman.com
   Path: vendors/cart.css
   ========================================================== */

/* ---------- Breadcrumb ---------- */
.cart-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0 12px;
    font-size: 12px;
    color: var(--text-muted, #6b7d6f);
}
.cart-breadcrumb a {
    color: var(--text-muted, #6b7d6f);
    text-decoration: none;
}
.cart-breadcrumb a:hover { color: var(--green-600, #16a34a); }
.cart-breadcrumb i { font-size: 8px; opacity: .5; }
.cart-breadcrumb span { color: var(--text-dark, #1a2e1f); font-weight: 600; }

/* ---------- Wrapper ---------- */
.cart-wrap { padding-bottom: 60px; }

.cart-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark, #1a2e1f);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.cart-title i { color: var(--green-500, #22c55e); font-size: 20px; }
.cart-count-label {
    font-size: 12px;
    color: var(--text-muted, #6b7d6f);
    background: var(--green-50, #f0fdf4);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    margin-left: auto;
}

/* ---------- Layout ---------- */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 20px;
    align-items: start;
}

/* ---------- List ---------- */
.cart-list {
    background: #fff;
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border, #e5efe7);
    overflow: hidden;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.05));
}

/* Item */
.cart-item {
    display: grid;
    grid-template-columns: 88px 1fr auto;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border, #e5efe7);
    align-items: center;
    transition: background .15s;
}
.cart-item:last-child { border-bottom: none; }
.cart-item:hover { background: #fafdfb; }

.cart-item-img {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 10px;
    background: var(--green-100, #dcfce7);
    cursor: pointer;
}

.cart-item-info { min-width: 0; }

.cart-item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark, #1a2e1f);
    line-height: 1.35;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
}
.cart-item-name:hover { color: var(--green-600, #16a34a); }

.cart-item-variant {
    display: inline-block;
    font-size: 11px;
    color: var(--green-700, #15803d);
    background: var(--green-50, #f0fdf4);
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-weight: 500;
}

.cart-item-price {
    font-size: 13px;
    color: var(--green-700, #15803d);
    font-weight: 700;
}

.cart-item-price small {
    font-size: 11px;
    color: var(--text-muted, #6b7d6f);
    font-weight: 500;
}

/* Aksi & qty */
.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.cart-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border, #e5efe7);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}
.cart-qty button {
    background: var(--green-50, #f0fdf4);
    border: none;
    width: 30px;
    height: 30px;
    cursor: pointer;
    color: var(--green-700, #15803d);
    font-weight: 700;
    font-size: 14px;
    transition: background .15s;
}
.cart-qty button:hover { background: var(--green-100, #dcfce7); }
.cart-qty button:active { transform: scale(.94); }
.cart-qty input {
    width: 42px;
    height: 30px;
    text-align: center;
    border: none;
    outline: none;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    color: var(--text-dark, #1a2e1f);
}
.cart-qty input::-webkit-outer-spin-button,
.cart-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cart-qty input[type=number] { -moz-appearance: textfield; }

.cart-subtotal {
    font-size: 14px;
    font-weight: 800;
    color: var(--green-700, #15803d);
    white-space: nowrap;
}

.cart-remove {
    background: none;
    border: none;
    color: var(--text-muted, #6b7d6f);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all .15s;
}
.cart-remove:hover { color: #ef4444; background: #fef2f2; }
.cart-remove i { margin-right: 3px; }

/* Empty */
.cart-empty {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border, #e5efe7);
}
.cart-empty i {
    font-size: 56px;
    color: var(--green-300, #86efac);
    margin-bottom: 12px;
}
.cart-empty h3 {
    font-size: 16px;
    color: var(--text-dark, #1a2e1f);
    margin-bottom: 6px;
}
.cart-empty p {
    font-size: 13px;
    color: var(--text-muted, #6b7d6f);
    margin-bottom: 20px;
}
.cart-empty a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--green-500, #22c55e), var(--green-600, #16a34a));
    color: #fff;
    padding: 10px 22px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

/* Loading */
.cart-loading {
    padding: 50px 20px;
    text-align: center;
    color: var(--text-muted, #6b7d6f);
    font-size: 13px;
}
.cart-loading i {
    font-size: 24px;
    color: var(--green-400, #4ade80);
    margin-bottom: 8px;
    display: block;
}

/* ---------- Summary ---------- */
.cart-summary {
    background: #fff;
    border-radius: var(--radius, 12px);
    border: 1px solid var(--border, #e5efe7);
    padding: 18px;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.05));
    position: sticky;
    top: 80px;
}
.cart-summary h2 {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-dark, #1a2e1f);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border, #e5efe7);
}

.cart-sum-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted, #6b7d6f);
    padding: 8px 0;
    gap: 10px;
}
.cart-sum-row strong {
    font-size: 14px;
    color: var(--text-dark, #1a2e1f);
    font-weight: 700;
}
.cart-sum-hint {
    font-size: 11px;
    color: var(--text-muted, #6b7d6f);
    font-style: italic;
}
.cart-sum-divider {
    border-top: 1px dashed var(--border, #e5efe7);
    margin-top: 6px;
    padding-top: 14px;
    align-items: baseline;
}
.cart-sum-total {
    font-size: 18px !important;
    color: var(--green-700, #15803d) !important;
    font-weight: 800 !important;
}

/* Kupon */
.cart-coupon {
    display: flex;
    gap: 6px;
    margin: 12px 0;
}
.cart-coupon input {
    flex: 1;
    border: 1px solid var(--border, #e5efe7);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 12px;
    font-family: inherit;
    outline: none;
    min-width: 0;
}
.cart-coupon input:focus { border-color: var(--green-500, #22c55e); }
.cart-coupon button {
    border: 1px solid var(--green-200, #bbf7d0);
    background: var(--green-50, #f0fdf4);
    color: var(--green-700, #15803d);
    padding: 0 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s;
}
.cart-coupon button:hover { background: var(--green-100, #dcfce7); }

/* Checkout button */
.cart-checkout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--green-500, #22c55e), var(--green-600, #16a34a));
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    margin-top: 4px;
}
.cart-checkout-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(34,197,94,.35);
}
.cart-checkout-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cart-continue-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted, #6b7d6f);
    text-decoration: none;
    font-weight: 500;
}
.cart-continue-link:hover { color: var(--green-600, #16a34a); }

/* ---------- Mobile sticky bar ---------- */
.cart-mobile-bar {
    display: none;
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--border, #e5efe7);
    padding: 10px 14px;
    box-shadow: 0 -4px 16px rgba(0,0,0,.06);
    z-index: 180;
    align-items: center;
    gap: 12px;
}
.cart-mob-total {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.cart-mob-total span {
    font-size: 10px;
    color: var(--text-muted, #6b7d6f);
    text-transform: uppercase;
    letter-spacing: .3px;
    font-weight: 700;
}
.cart-mob-total strong {
    font-size: 17px;
    font-weight: 800;
    color: var(--green-700, #15803d);
}
.cart-mobile-bar .cart-checkout-btn {
    flex: 1;
    max-width: 200px;
    margin: 0 0 0 auto;
    padding: 12px 18px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    body.mp-body {
        padding-bottom: calc(64px + 64px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .cart-breadcrumb { padding: 10px 0 8px; font-size: 11px; }
    .cart-title { font-size: 17px; gap: 8px; }
    .cart-title i { font-size: 16px; }
    .cart-count-label { font-size: 11px; padding: 3px 10px; }

    .cart-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* List mobile */
    .cart-item {
        grid-template-columns: 72px 1fr;
        grid-template-areas:
            "img info"
            "img actions";
        padding: 12px;
        gap: 10px;
    }
    .cart-item-img {
        grid-area: img;
        width: 72px;
        height: 72px;
    }
    .cart-item-info { grid-area: info; }
    .cart-item-actions {
        grid-area: actions;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 4px;
    }

    .cart-item-name { font-size: 13px; -webkit-line-clamp: 2; }
    .cart-item-price { font-size: 12px; }
    .cart-qty button { width: 26px; height: 26px; font-size: 12px; }
    .cart-qty input { width: 36px; height: 26px; font-size: 11px; }
    .cart-subtotal { font-size: 13px; }
    .cart-remove span { display: none; }

    /* Summary: sembunyikan di mobile (pakai sticky bar) */
    .cart-summary { display: none; }
    .cart-mobile-bar { display: flex; }

    .cart-empty { padding: 40px 20px; }
    .cart-empty i { font-size: 44px; }
    .cart-empty h3 { font-size: 15px; }
}

@media (max-width: 400px) {
    .cart-title { font-size: 15px; }
    .cart-item-img { width: 64px; height: 64px; }
    .cart-item-name { font-size: 12px; }
    .cart-qty button { width: 24px; height: 24px; }
    .cart-qty input { width: 32px; height: 24px; }
    .cart-mob-total strong { font-size: 15px; }
    .cart-mobile-bar .cart-checkout-btn { padding: 10px 14px; font-size: 13px; }
}