﻿
/* ── Design Tokens ── */
:root {
    --green: #2c5f3a;
    --green-mid: #3d7a4f;
    --green-light: #edf5f0;
    --orange: #f07b35;
    --orange-dark: #d4660e;
    --red: #e63946;
    --red-dark: #c1121f;
    --bg: #f2f5f2;
    --white: #ffffff;
    --border: #e2ebe4;
    --text-dark: #1a2318;
    --text-mid: #4a5568;
    --text-light: #8a9a8a;
    --shadow-sm: 0 2px 12px rgba(30,65,41,0.07);
    --shadow-md: 0 6px 28px rgba(30,65,41,0.12);
    --radius: 16px;
    --font-body: 'Nunito', sans-serif;
    --font-display: 'Lora', Georgia, serif;
    --tr: 0.24s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    font-family: var(--font-body);
    color: var(--text-dark);
}

/* ── Page ── */
.cart-page {
    padding: 40px 0 90px;
}

.cart-page__title {
    font-family: var(--font-display);
    font-size: clamp(22px, 4vw, 32px);
    font-weight: 700;
    color: var(--green);
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    gap: 12px;
}

    .cart-page__title i {
        font-size: 0.85em;
        color: var(--green-mid);
    }

/* ── Cart Item Card ── */
.cart-item {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow var(--tr), transform var(--tr);
    animation: slideIn 0.35s ease both;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.cart-item.removing {
    opacity: 0;
    transform: translateX(40px) scale(0.97);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

/* ── Image ── */
.cart-item-img-wrap {
    width: 88px;
    height: 88px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--green-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.cart-item-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 26px;
}

/* ── Info ── */
.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-unit {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
}

/* ── Qty ── */
.qty-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}

.btn-qty {
    width: 34px;
    height: 36px;
    border: none;
    background: var(--white);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--tr), color var(--tr);
    flex-shrink: 0;
    line-height: 1;
}

    .btn-qty:hover {
        background: var(--green);
        color: #fff;
    }

.qty-input {
    width: 44px;
    height: 36px;
    text-align: center;
    border: none;
    border-left: 1.5px solid var(--border);
    border-right: 1.5px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text-dark);
    background: #fafcfa;
    outline: none;
    -moz-appearance: textfield;
}

    .qty-input::-webkit-outer-spin-button,
    .qty-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
    }

/* ── Item Total ── */
.cart-item-total {
    font-size: 15px;
    font-weight: 800;
    min-width: 70px;
    text-align: right;
    color: var(--text-dark);
    flex-shrink: 0;
}

/* ── Delete Btn ── */
.btn-delete {
    width: 38px;
    height: 38px;
    background: #fff0f1;
    border: 1.5px solid #fcd0d3;
    border-radius: 10px;
    color: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    transition: background var(--tr), transform var(--tr), border-color var(--tr);
}

    .btn-delete:hover {
        background: var(--red);
        border-color: var(--red);
        color: #fff;
        transform: scale(1.08);
    }

/* ── Order Summary ── */
.cart-summary {
    background: var(--white);
    padding: 26px 22px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: sticky;
    top: 88px;
}

.cart-summary__title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-mid);
    font-weight: 600;
}

    .summary-row.total {
        font-size: 17px;
        font-weight: 800;
        color: var(--text-dark);
        margin-top: 4px;
    }

    .summary-row .val {
        color: var(--text-dark);
        font-weight: 700;
    }

    .summary-row.discount .val {
        color: var(--green);
    }

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

/* ── Coupon ── */
.coupon-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-mid);
    margin-bottom: 8px;
    display: block;
}

.coupon-row {
    display: flex;
    gap: 8px;
}

.coupon-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-family: var(--font-body);
    font-weight: 600;
    outline: none;
    color: var(--text-dark);
    background: #fafcfa;
    transition: border-color var(--tr);
}

    .coupon-input:focus {
        border-color: var(--green-mid);
    }

.btn-apply {
    padding: 10px 16px;
    border: 1.5px solid var(--green-mid);
    border-radius: 10px;
    background: var(--white);
    color: var(--green-mid);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--tr), color var(--tr);
}

    .btn-apply:hover {
        background: var(--green-mid);
        color: #fff;
    }

#coupon-msg {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    display: block;
    min-height: 18px;
}

/* ── Checkout Btn ── */
.btn-checkout {
    background: var(--orange);
    border: none;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    font-family: var(--font-body);
    border-radius: 12px;
    padding: 15px;
    width: 100%;
    margin-top: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: background var(--tr), transform var(--tr), box-shadow var(--tr);
    box-shadow: 0 4px 18px rgba(240,123,53,0.35);
}

    .btn-checkout:hover {
        background: var(--orange-dark);
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(240,123,53,0.4);
    }

/* ── Continue Shopping ── */
.btn-continue {
    border: 1.5px solid var(--green-mid);
    color: var(--green-mid);
    background: var(--white);
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    font-family: var(--font-body);
    padding: 10px 20px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background var(--tr), color var(--tr);
}

    .btn-continue:hover {
        background: var(--green-mid);
        color: #fff;
        text-decoration: none;
    }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 70px 24px;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

    .empty-state i {
        font-size: 52px;
        color: #c5d9cb;
        display: block;
        margin-bottom: 18px;
    }

    .empty-state h4 {
        font-family: var(--font-display);
        font-size: 20px;
        color: var(--text-dark);
        margin-bottom: 8px;
    }

    .empty-state p {
        color: var(--text-light);
        font-size: 14px;
        margin-bottom: 20px;
    }

/* ── Loader ── */
#cart-loader {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-light);
    font-weight: 600;
}

/* ── Count badge ── */
.cart-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 18px;
}

    .cart-count-badge span {
        background: var(--green-light);
        color: var(--green);
        padding: 3px 10px;
        border-radius: 20px;
        font-weight: 800;
        font-size: 12px;
    }

/* ══════════════════════════════════════
   CUSTOM TOASTR NOTIFICATIONS
══════════════════════════════════════ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast-msg {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    min-width: 260px;
    max-width: 340px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
    pointer-events: all;
    animation: toastIn 0.32s cubic-bezier(.22,.68,0,1.2) both;
    position: relative;
    overflow: hidden;
}

    .toast-msg::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        height: 3px;
        background: rgba(255,255,255,0.35);
        animation: toastBar 3s linear forwards;
        border-radius: 0 0 12px 12px;
        width: 100%;
    }

@keyframes toastBar {
    from {
        width: 100%
    }

    to {
        width: 0%
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(60px) scale(0.92)
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1)
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
        max-height: 80px
    }

    to {
        opacity: 0;
        transform: translateX(60px) scale(0.92);
        max-height: 0
    }
}

.toast-msg.hiding {
    animation: toastOut 0.28s ease forwards;
}

.toast-msg.toast-success {
    background: #1e4d2b;
    color: #ffffff;
    border-left: 5px solid #52c97a;
}

.toast-msg.toast-error {
    background: #7f0d14;
    color: #ffffff;
    border-left: 5px solid #f4606b;
}

.toast-msg.toast-warning {
    background: #7a3a00;
    color: #ffffff;
    border-left: 5px solid #f4a124;
}

.toast-msg.toast-info {
    background: #0f2d6b;
    color: #ffffff;
    border-left: 5px solid #5b9cf6;
}

.toast-msg i {
    font-size: 16px;
    flex-shrink: 0;
    color: #ffffff;
}

/* ══════════════════════════════════════
   CUSTOM CONFIRM DIALOG
══════════════════════════════════════ */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeOverlay 0.2s ease;
}

@keyframes fadeOverlay {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.confirm-box {
    background: var(--white);
    border-radius: 18px;
    padding: 28px 26px 22px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.22);
    animation: confirmIn 0.3s cubic-bezier(.22,.68,0,1.2);
    text-align: center;
}

@keyframes confirmIn {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(16px)
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0)
    }
}

.confirm-icon {
    width: 56px;
    height: 56px;
    background: #fff0f1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 22px;
    color: var(--red);
}

.confirm-title {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.confirm-msg {
    font-size: 13px;
    color: var(--text-mid);
    font-weight: 500;
    margin-bottom: 22px;
    line-height: 1.55;
}

.confirm-btns {
    display: flex;
    gap: 10px;
}

.confirm-btn {
    flex: 1;
    padding: 11px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.confirm-btn-cancel {
    background: var(--bg);
    color: var(--text-mid);
    border: 1.5px solid var(--border);
}

    .confirm-btn-cancel:hover {
        background: var(--border);
    }

.confirm-btn-confirm {
    background: var(--red);
    color: #fff;
    box-shadow: 0 4px 14px rgba(230,57,70,0.3);
}

    .confirm-btn-confirm:hover {
        background: var(--red-dark);
        transform: translateY(-1px);
    }

/* ── Responsive ── */
@media (max-width:767px) {
    .cart-page {
        padding: 24px 0 70px;
    }

    .cart-item {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }

    .cart-item-img-wrap {
        width: 72px;
        height: 72px;
    }

    .cart-item-info {
        flex: 1;
        min-width: 120px;
    }

    .cart-summary {
        position: static;
        margin-top: 8px;
    }

    .cart-page__title {
        font-size: 22px;
    }
}

@media (max-width:480px) {
    .cart-item {
        padding: 12px 14px;
        gap: 10px;
    }

    .cart-item-img-wrap {
        width: 60px;
        height: 60px;
    }

    .cart-item-name {
        font-size: 14px;
    }

    .qty-wrap {
        transform: scale(0.92);
    }
}


