/* Bộ chọn số lượng "− 🛒 N +" ở thẻ sản phẩm / "− [số] +" ở trang chi tiết (Views/Shared/_QtyStepper.cshtml, Content/js/product-qty-stepper.js)
   và nhãn phân loại thuốc nhỏ ở thẻ sản phẩm (Models/QtyStepper.cs: DrugClassBadge). */

/* ===== Thẻ sản phẩm: thanh số lượng nằm dưới giá, rộng hết thẻ ===== */
.product-footer-row.pq-row {
    flex-wrap: wrap !important;
    align-items: stretch !important;
    margin-top: auto !important;   /* thanh số lượng nằm sát đáy thẻ, thẳng hàng giữa các thẻ */
}

.product-cart-block.pq-block {
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    margin-top: 8px !important;
    z-index: auto !important;
}

.pq-bar {
    width: 100%;
}

/* Thanh số lượng rộng hết thẻ: sát mép trái / phải / đáy (khoảng cách do JS đo: --pq-ml, --pq-mr, --pq-mb) */
.product-cart-block.pq-block.pq-flush {
    flex: 0 0 auto !important;
    width: calc(100% - var(--pq-ml, 0px) - var(--pq-mr, 0px)) !important;
    margin-left: var(--pq-ml, 0px) !important;
    margin-right: var(--pq-mr, 0px) !important;
    margin-bottom: var(--pq-mb, 0px) !important;
}

.pq-flush .pq-limit {
    padding: 0 10px;
}

.pq-flush .pq-ctrl {
    height: 40px;
    border-width: 1px 0 0;           /* chỉ giữ viền trên; hai bên và đáy là viền của thẻ */
    border-radius: 0 0 11px 11px;    /* bo đáy khớp góc thẻ */
}

.pq-limit {
    margin: 0 0 5px;
    text-align: center;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.3;
}

.pq-ctrl {
    display: flex;
    align-items: stretch;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.pq-btn {
    flex: none;
    width: 42px;
    padding: 0;
    border: 0;
    background: #ffffff;
    color: #166534;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease;
}

.pq-btn:hover:not(:disabled) {
    background: #f0fdf4;
}

.pq-btn:active:not(:disabled) {
    background: #dcfce7;
}

.pq-minus {
    color: #9ca3af;
    border-right: 1px solid #e5e7eb;
}

.pq-minus:hover:not(:disabled) {
    color: #166534;
}

.pq-plus {
    border-left: 1px solid #e5e7eb;
}

.pq-btn:disabled {
    color: #d1d5db;
    cursor: default;
}

.pq-mid {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 600;
    background: #ffffff;
}

/* đã có trong giỏ: số lượng nổi bật màu xanh */
.pq-bar.pq-has .pq-mid {
    color: #166534;
    background: #f0fdf4;
}

/* dòng báo lỗi từ máy chủ ngay dưới thanh số lượng */
.pq-msg {
    margin: 0 0 6px;
    padding: 5px 8px;
    border-radius: 6px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 11px;
    line-height: 1.35;
    text-align: left;
}

.pq-msg[hidden] {
    display: none;
}

.pq-busy {
    opacity: .6;
    pointer-events: none;
}

/* ===== Trang chi tiết: ô "− [số] +" dạng viên thuốc ===== */
.pq-detail {
    display: block;
    width: 100%;
    max-width: 240px;
    margin: 0;
}

/* hàng nút ở trang chi tiết: căn mép trên để dòng "Đặt tối đa" (nằm dưới ô cộng trừ) không đẩy lệch Mua ngay / Quan tâm / Tư vấn */
ul.product-page-actions-list > li {
    align-items: flex-start !important;
}

.pq-detail .pq-ctrl-pill {
    height: 38px;
    border: 1px solid #1a5740;
    border-radius: 999px;
    overflow: hidden;
}

.pq-detail .pq-btn {
    flex: 0 0 48px;
    width: 48px;
    height: 100%;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
    opacity: 1;
}

.pq-detail .pq-minus {
    -webkit-text-fill-color: currentColor;
}

.pq-detail .pq-plus {
    -webkit-text-fill-color: #166534;
}

.pq-detail .pq-minus {
    border-right: 1px solid #d1d5db;
}

.pq-detail .pq-plus {
    border-left: 1px solid #d1d5db;
}

.pq-detail .pq-input {
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
    opacity: 1;
    -webkit-text-fill-color: #111827;
    border: 0;
    outline: 0;
    background: #ffffff;
    color: #111827;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
}

.pq-detail .pq-input::-webkit-outer-spin-button,
.pq-detail .pq-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pq-detail.pq-has .pq-input {
    color: #166534;
}

.pq-detail .pq-limit {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.3;
    text-align: left;
}

/* ===== Nhãn phân loại thuốc ở thẻ sản phẩm (nằm ngay dưới tên) ===== */
.pdc {
    order: 3;
    align-self: flex-start;
    display: inline-block;
    margin: 2px 0 4px;
    padding: 1px 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: .2px;
    text-transform: uppercase;
    white-space: normal;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

.pdc-otc {
    color: #166534;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.pdc-rx {
    color: #9a3412;
    background: #fff7ed;
    border-color: #fed7aa;
}

.pdc-rx-te {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.pdc-rx-kte {
    color: #6d28d9;
    background: #f5f3ff;
    border-color: #ddd6fe;
}

.pdc-ksdb {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

@media (max-width: 576px) {
    .pq-ctrl {
        height: 34px;
    }
    .pq-btn {
        width: 38px;
        font-size: 20px;
    }
    .pq-mid {
        font-size: 13px;
    }
    .pdc {
        font-size: 8.5px;
        padding: 1px 5px;
        line-height: 1.3;
        letter-spacing: 0;
    }
}

/* ===== Khối "Thuốc kê đơn thiết yếu / không thiết yếu" trên trang chủ: tiêu đề lớn giữa khối, nền màu nổi ===== */
.card-drug-section {
    padding: 14px 14px 10px;
    border-radius: 14px;
}

.card-drug-te {
    background: #cfe3fb;
}

.card-drug-kte {
    background: #e4d9fb;
}

.drug-section-title {
    margin: 2px 0 14px;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.3;
    text-transform: uppercase;
}

.card-drug-te .drug-section-title {
    color: #1e3a8a;
}

.card-drug-kte .drug-section-title {
    color: #4c1d95;
}

@media (max-width: 767px) {
    .drug-section-title {
        font-size: 17px;
    }
    .hp-rx-extra {
        display: none;
    }
}

/* Khối Combo ưu đãi: tiêu đề lớn giữa khối trên nền hồng nổi (cùng kiểu hai khối thuốc kê đơn) */
.card-combos {
    background-color: #fecdd3 !important;
    border-radius: 14px;
}

.card-combos .combo-section-title {
    color: #9f1239;
}

.card-combos .category-tabs .nav-pills {
    display: none;
}

.card-combos .wrap-menu-tabs {
    justify-content: flex-end;
}

/* Nút "Xem thêm" nằm giữa, cuối danh sách sản phẩm của mỗi khối trang chủ */
.xem-them-bottom {
    clear: both;
    margin: 16px 0 6px;
    text-align: center;
}

.xem-them-bottom .btn-xem-them {
    display: inline-block;
}

.discovery-full-card.card-combos .wrap-menu-tabs {
    display: none !important;   /* thanh nền trắng trống phía trên danh sách: bỏ đi */
}

/* Thuốc kê đơn / không kê đơn giá tốt: tiêu đề lớn giữa khối, bỏ thanh tab trống */
.discovery-full-card.card-prescription .wrap-menu-tabs,
.discovery-full-card.card-non-prescription .wrap-menu-tabs {
    display: none !important;
}

.card-prescription .section-title-pres {
    color: #1e40af;
}

.card-non-prescription .section-title-nonpres {
    color: #065f46;
}

/* Sản phẩm khuyến mãi: tiêu đề lớn giữa khối, bỏ thanh tab trống */
.discovery-full-card.card-new-products .wrap-menu-tabs {
    display: none !important;
}

.card-new-products .section-title-promo {
    color: #b91c1c;
}

/* Sản phẩm bán chạy: tiêu đề lớn giữa khối, bỏ thanh tab trống */
.discovery-full-card.card-best-sellers .wrap-menu-tabs {
    display: none !important;
}

.card-best-sellers .section-title-best {
    color: #c2410c;
}

/* Trang chi tiết: 3 mục sản phẩm liên quan dùng tiêu đề lớn giữa khối; thanh tab chỉ còn nút "Xem thêm" căn giữa, không nền */
.detail-title-sec .nav-pills {
    display: none !important;
}

.discovery-full-card.detail-title-sec .wrap-menu-tabs {
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
    justify-content: center !important;
    margin: 0 0 12px !important;
}

.detail-title-sec .small-cate {
    margin: 0;
    padding: 0;
}

/* ===== Màn hình "Không tìm thấy sản phẩm" ===== */
.empty-products {
    max-width: 560px;
    margin: 30px auto;
    padding: 34px 24px 30px;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.empty-products-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #ecfdf5;
    color: #16a34a;
    font-size: 30px;
    line-height: 72px;
}

.empty-products-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 800;
    color: #1a5740;
}

.empty-products-text {
    margin: 0 0 10px;
    color: #475569;
    font-size: 14px;
}

.empty-products-tips {
    display: inline-block;
    margin: 4px 0 18px;
    padding: 0 0 0 18px;
    text-align: left;
    color: #64748b;
    font-size: 13px;
    line-height: 1.7;
}

.empty-products-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.empty-products-btn {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 999px;
    background: #1a5740;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none !important;
}

.empty-products-btn-alt {
    background: #ffffff;
    color: #1a5740 !important;
    border: 1px solid #1a5740;
}

/* Điện thoại / máy tính bảng: ô cộng trừ ở trang chi tiết rộng hết chiều ngang, thẳng hàng với các nút Mua ngay / Quan tâm / Tư vấn */
@media (max-width: 991px) {
    .pq-detail {
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
    }
}

/* ===== Dấu + / − vẽ bằng hình (không dùng chữ): luôn hiện rõ trên mọi điện thoại, không phụ thuộc phông chữ / màu chữ của trình duyệt ===== */
.pq-btn {
    position: relative;
    font-size: 0 !important;       /* ẩn ký tự chữ, thay bằng hình vẽ bên dưới (nút vẫn có aria-label cho trình đọc màn hình) */
    -webkit-text-fill-color: transparent;
    --pq-ic: #166534;
    --pq-bar: 2.5px;
    --pq-len: 14px;
}

.pq-btn::before,
.pq-btn::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    background: var(--pq-ic);
    border-radius: 2px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.pq-btn::before {
    width: var(--pq-len);
    height: var(--pq-bar);
}

.pq-btn::after {
    width: var(--pq-bar);
    height: var(--pq-len);
}

.pq-minus::after {
    display: none;                 /* dấu trừ chỉ có một thanh ngang */
}

.pq-minus {
    --pq-ic: #4b5563;
}

.pq-btn:disabled {
    --pq-ic: #cbd5e1;
}

.pq-detail .pq-btn {
    --pq-len: 16px;
    --pq-bar: 3px;
}

@media (max-width: 576px) {
    .pq-btn {
        --pq-len: 12px;
        --pq-bar: 2.5px;
    }
    .pq-detail .pq-btn {
        --pq-len: 16px;
        --pq-bar: 3px;
    }
}

/* Trang chi tiết trên điện thoại: product-detail-custom.css ép MỌI nút đang bị khóa trong hàng nút (button[disabled]) rộng 100%.
   Nút "−" bị khóa khi số lượng là 0 nên chiếm hết ô và đẩy số + dấu "+" ra ngoài. Trả lại kích thước cố định cho nút cộng / trừ. */
.product-page-actions-list .pq-detail .pq-btn,
.product-page-actions-list .pq-detail .pq-btn[disabled] {
    flex: 0 0 48px !important;
    width: 48px !important;
    max-width: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Thẻ sản phẩm: các nhãn (MUA CÓ GIỚI HẠN, hạn dùng, KM...) nằm trên, giá luôn ở dòng cuối cùng nên có hay không có khuyến mãi thì giá vẫn đứng yên ở cuối */
.product-price-block > * {
    order: 0;
}
.product-price-block::before {
    content: "";
    order: 1;
    flex: 0 0 100%;
    height: 0;
}
.product-price-block > .pq-limit {
    order: 2;
    flex: 0 0 100%;
    margin: 0;
    text-align: left;
}
.product-price-block > .product-caption-price-new-best {
    order: 3;
}
.product-price-block > .product-caption-price-old-best {
    order: 4;
}
