﻿/* ➜ Đặt tại: wwwroot/css/home/cart.css   (nạp trong _Layout.cshtml — có toast + badge dùng mọi trang) */

/* ================= DÙNG CHUNG MỌI TRANG ================= */
.hp-cart-toast {
    position: fixed;
    left: 50%;
    bottom: calc(84px + env(safe-area-inset-bottom));
    transform: translate(-50%, 20px);
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(20, 20, 20, .92);
    color: #fff;
    padding: 10px 18px;
    border-radius: 22px;
    font-size: 14px;
    z-index: 1080;
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    white-space: nowrap;
}

    .hp-cart-toast.is-show {
        opacity: 1;
        transform: translate(-50%, 0);
        pointer-events: auto;
    }
    .hp-cart-toast a {
        color: #8fe3a0;
        font-weight: 700;
        text-decoration: none;
    }
@media (min-width: 992px) {
    .hp-cart-toast {
        bottom: 28px;
    }
}

[data-hp-add-cart].is-added {
    background: #0b3a6e !important;
    border-color: #0b3a6e !important;
    color: #fff !important;
}
/* ================= TRANG GIỎ HÀNG ================= */
.hp-cart {
    --c-green: #1f7a34;
    --c-navy: #0b3a6e;
    --c-red: #e53935;
    --c-line: #ececec;
    padding-top: 18px;
    padding-bottom: 28px;
}

    .hp-cart, .hp-cart *, .hp-cart *::before, .hp-cart *::after {
        box-sizing: border-box;
    }

.hp-cart-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--c-navy);
    margin: 0 0 14px;
}

    .hp-cart-title i {
        margin-right: 6px;
    }

.hp-cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
}

    .hp-cart-layout[hidden], .hp-cart-empty[hidden], .hp-cart-success[hidden], .hp-cart-alert[hidden] {
        display: none;
    }

.hp-cart-items, .hp-cart-box {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .05);
}

.hp-cart-items {
    padding: 6px 16px 10px;
}

.hp-cart-items-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--c-line);
    color: #555;
    font-size: 14px;
}

.hp-cart-clear {
    border: 0;
    background: none;
    color: var(--c-red);
    font-size: 13px;
    cursor: pointer;
    padding: 4px;
}

.hp-cart-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hp-cart-item {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto 110px 28px;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--c-line);
}

    .hp-cart-item:last-child {
        border-bottom: 0;
    }

    .hp-cart-item.is-invalid {
        opacity: .75;
    }

        .hp-cart-item.is-invalid .hp-cart-name {
            text-decoration: line-through;
        }

.hp-cart-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: #f1f1f1;
    border: 1px solid #e5e5e5;
    color: #bbb;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .hp-cart-thumb svg {
        width: 50%;
    }

.hp-cart-info {
    min-width: 0;
}

.hp-cart-badge {
    display: inline-block;
    background: var(--c-navy);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 4px;
    margin-bottom: 3px;
}

.hp-cart-name {
    font-size: 14.5px;
    color: #222;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.hp-cart-price {
    font-size: 13px;
    color: #777;
    margin-top: 2px;
}

.hp-cart-warn {
    font-size: 12.5px;
    color: var(--c-red);
    margin-top: 3px;
}

.hp-cart-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

    .hp-cart-qty button {
        width: 32px;
        height: 32px;
        border: 0;
        background: #f6f6f6;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        color: #333;
    }

        .hp-cart-qty button:hover {
            background: #ececec;
        }

    .hp-cart-qty input {
        width: 46px;
        height: 32px;
        border: 0;
        text-align: center;
        font-size: 14px;
        -moz-appearance: textfield;
    }

        .hp-cart-qty input::-webkit-outer-spin-button,
        .hp-cart-qty input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

.hp-cart-line {
    text-align: right;
    font-weight: 700;
    color: var(--c-red);
}

.hp-cart-remove {
    border: 0;
    background: none;
    font-size: 22px;
    line-height: 1;
    color: #aaa;
    cursor: pointer;
    padding: 0;
}

    .hp-cart-remove:hover {
        color: var(--c-red);
    }

.hp-cart-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 16px;
}

.hp-cart-box {
    padding: 16px;
}

    .hp-cart-box h2 {
        font-size: 16px;
        font-weight: 800;
        color: var(--c-navy);
        margin: 0 0 12px;
    }

.hp-cart-field {
    display: block;
    margin: 0 0 10px;
}

    .hp-cart-field span {
        display: block;
        font-size: 13px;
        color: #555;
        margin-bottom: 4px;
    }

    .hp-cart-field b {
        color: var(--c-red);
    }

    .hp-cart-field input,
    .hp-cart-field textarea {
        width: 100%;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 9px 11px;
        font-size: 14px;
        font-family: inherit;
        resize: vertical;
    }

        .hp-cart-field input:focus,
        .hp-cart-field textarea:focus {
            outline: none;
            border-color: var(--c-green);
            box-shadow: 0 0 0 3px rgba(31, 122, 52, .12);
        }

.hp-cart-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.hp-cart-row--muted {
    color: #888;
}

.hp-cart-row--total {
    border-top: 1px dashed var(--c-line);
    margin-top: 6px;
    padding-top: 12px;
    font-size: 16px;
}

    .hp-cart-row--total b {
        color: var(--c-red);
        font-size: 20px;
    }

.hp-cart-alert {
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    background: #fff1f1;
    color: #a32121;
    font-size: 13.5px;
}

.hp-cart-btn {
    display: inline-block;
    border: 0;
    border-radius: 24px;
    padding: 11px 26px;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    text-align: center;
}

.hp-cart-btn--primary {
    background: var(--c-green);
    color: #fff;
}

    .hp-cart-btn--primary:hover {
        background: #17622a;
        color: #fff;
    }

.hp-cart-btn:disabled {
    background: #9bbfa4;
    cursor: not-allowed;
}

.hp-cart-submit {
    width: 100%;
    margin-top: 12px;
}

    .hp-cart-submit.is-loading {
        cursor: wait;
    }

.hp-cart-hint {
    font-size: 12px;
    color: #888;
    margin: 8px 0 0;
    text-align: center;
}

.hp-cart-empty, .hp-cart-success {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .05);
    text-align: center;
    padding: 44px 16px;
    color: #666;
}

    .hp-cart-empty svg {
        color: #d8cfb6;
        margin-bottom: 10px;
    }

.hp-cart-success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: #eaf6ec;
    color: var(--c-green);
    font-size: 34px;
    line-height: 64px;
    font-weight: 800;
}

.hp-cart-success h2 {
    color: var(--c-green);
    font-weight: 800;
    font-size: 22px;
}

.hp-cart-split-note {
    font-size: 13.5px;
    color: #8a6d1d;
    background: #f6f1e3;
    border-radius: 8px;
    padding: 8px 12px;
    max-width: 460px;
    margin: 10px auto;
}

.hp-cart-success-list {
    list-style: none;
    padding: 0;
    margin: 14px auto 20px;
    max-width: 460px;
    text-align: left;
}

    .hp-cart-success-list li {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 12px;
        border: 1px solid var(--c-line);
        border-radius: 8px;
        margin-bottom: 8px;
        font-size: 14px;
    }

    .hp-cart-success-list b {
        color: #222;
    }

/* ================= RESPONSIVE ================= */
@media (max-width: 991.98px) {
    .hp-cart-layout {
        grid-template-columns: 1fr;
    }

    .hp-cart-side {
        position: static;
    }
}

@media (max-width: 575.98px) {
    .hp-cart-title {
        font-size: 19px;
    }

    .hp-cart-items {
        padding: 4px 12px 8px;
    }

    .hp-cart-item {
        grid-template-columns: 56px minmax(0, 1fr) auto;
        grid-template-areas:
            "thumb info remove"
            "thumb qty  line";
        row-gap: 8px;
        column-gap: 10px;
    }

    .hp-cart-thumb {
        grid-area: thumb;
        width: 56px;
        height: 56px;
        align-self: start;
    }

    .hp-cart-info {
        grid-area: info;
    }

    .hp-cart-remove {
        grid-area: remove;
        align-self: start;
    }

    .hp-cart-qty {
        grid-area: qty;
        justify-self: start;
    }

    .hp-cart-line {
        grid-area: line;
        justify-self: end;
    }

    .hp-cart-box {
        padding: 14px;
    }
}
/* ================= NHÀ THUỐC BÁN + NHÓM THEO ĐƠN (bổ sung 02/10) ================= */
.hp-cart-split-hint {
    list-style: none;
    margin: 10px 0 2px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff8e6;
    border: 1px solid #f3dfa8;
    color: #7a5a00;
    font-size: 13px;
    line-height: 1.45;
}

.hp-cart-group-head {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 0 6px;
    border-bottom: 1px dashed var(--c-line);
}

.hp-cart-group-name {
    font-weight: 700;
    color: var(--c-navy);
    font-size: 14.5px;
    min-width: 0;
    overflow-wrap: anywhere;
}

    .hp-cart-group-name i {
        color: #1f7a34;
        margin-right: 4px;
    }

.hp-cart-group-tag {
    flex: 0 0 auto;
    font-size: 12px;
    color: #555;
    background: #f1f3f5;
    border-radius: 10px;
    padding: 2px 9px;
}

.hp-cart-unit {
    font-size: 12px;
    color: #999;
    margin-left: 1px;
}

.hp-cart-seller {
    font-size: 12px;
    color: #6c757d;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

    .hp-cart-seller i {
        font-size: 11px;
        color: #1f7a34;
        margin-right: 2px;
    }

.hp-cart-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.hp-cart-badge {
    background: #1f7a34;
}
