/* ============================================================
   Specs Table — Thông số kỹ thuật section (#specs)
   Loads on all product pages via mitn-specs handle.
   ============================================================ */

/* ─── Collapsible spec groups ─────────────────────────────────── */
.specs-groups {
    display: flex;
    flex-direction: column;
    gap: var(--s-3, 0.75rem);
}

.specs-group {
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
}

.specs-group__head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--s-2, 0.5rem);
    padding: 10px var(--s-4, 1rem);
    background: #f2f4f72e;
    border: none;
    cursor: pointer;
    font-size: var(--fs-sm, 0.875rem);
    font-weight: 700;
    line-height: 1.4; /* không thừa kế line-height lớn của theme (33.6px) — nếu không đầu nhóm bị cao dư ~16px tạo "khối trắng" dưới chữ */
    color: var(--color-text-primary, #111);
    font-family: inherit;
    text-align: left;
}

.specs-group__head:hover { background: var(--color-surface-raised, #f0f2f5); }

.specs-group__head br { display: none; }

.specs-group__head svg.ico {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-brand-primary, #dd3333);
    fill: currentColor;
}

.specs-group__head i[class*="fa-"] {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: var(--color-brand-primary, #dd3333);
    font-size: 0.95em;
}

.specs-group__chevron {
    margin-left: auto;
    width: 18px;
    height: 18px;
    line-height: 18px;
    flex-shrink: 0;
    text-align: center;
    color: var(--color-text-muted, #4b5563);
    fill: currentColor;
    font-size: 14px;
    transition: transform 0.2s ease;
}

.specs-group.is-collapsed .specs-group__chevron {
    transform: rotate(180deg);
}

.specs-group__body { padding: 0; }
.specs-group.is-collapsed .specs-group__body { display: none; }

/* ─── Body table ──────────────────────────────────────────────── */
.specs-group__body table {
    width: 100%;
    border-collapse: collapse;
}

.specs-group__body td {
    padding: var(--s-3, 0.75rem) var(--s-4, 1rem);
    font-size: var(--fs-sm, 0.875rem);
    border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
    vertical-align: top;
}

.specs-group__body tr:last-child td { border-bottom: none; }

.specs-group__body td:first-child {
    color: var(--color-text-muted, #4b5563);
    width: 45%;
}

.specs-group__body td:last-child {
    color: var(--color-text-primary, #111);
    font-weight: 500;
}

.specs-group__body strong {
    font-weight: 800;
    color: var(--color-brand-primary, #dd3333);
}

/* ─── Desktop: 2 cột cặp nhãn/giá trị mỗi hàng ──────────────────
   Giữ nguyên markup <table> (mobile vẫn 1 cột, xếp dọc như mặc định);
   từ 881px biến <table> thành CSS grid 4 cột bằng display:contents
   trên tbody/tr để <td> trồi lên làm grid item trực tiếp — nhờ vậy
   :first-child/:last-child vẫn tính theo <tr> gốc nên style nhãn/giá
   trị (màu, weight) không đổi, chỉ layout đổi. Hàng cuối lẻ tự rơi
   xuống chiếm nửa trái, không cần biết trước tổng số hàng. */
@media (min-width: 881px) {
    .specs-group__body table {
        display: grid;
        /* auto = co theo đúng độ dài nhãn dài nhất trong bảng (không ép
           tỉ lệ % cố định) — nhãn ngắn ("USB") không lãng phí chỗ, nhãn
           dài ("Thời gian trang đầu (đen / màu)") không bị vỡ dòng. */
        grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
        column-gap: var(--s-2, 0.5rem);
    }
    .specs-group__body tbody,
    .specs-group__body tr {
        display: contents;
    }
    /* width:45% (dành cho bảng 1 cột mobile) tính theo track grid — reset
       về auto để <td> lấp đầy cột nhãn (đã auto-size theo max-content). */
    .specs-group__body td:first-child {
        width: auto;
    }
    /* tr:last-child (dưới) đã lo hàng thật-cuối (lẻ hoặc chẵn); dòng này
       lo thêm nửa TRÁI của cặp cuối khi tổng số hàng chẵn — khớp khi hàng
       áp chót đứng ở vị trí lẻ, tức là nó ghép cặp với hàng cuối cùng. */
    .specs-group__body tr:nth-last-child(2):nth-child(odd) td {
        border-bottom: none;
    }
}

/* ─── Ink cost table wrapper ──────────────────────────────────── */
.ink-tblwrap {
    overflow-x: auto;
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    border-radius: var(--radius-lg, 12px);
    margin-bottom: var(--s-4, 1rem);
}

.ink-tblwrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm, 0.875rem);
    min-width: 520px;
}

.ink-tblwrap th,
.ink-tblwrap td {
    padding: var(--s-3, 0.75rem) var(--s-4, 1rem);
    text-align: left;
    border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
}

.ink-tblwrap th {
    background: var(--color-surface-sunken, #f2f4f7);
    font-weight: 700;
    color: var(--color-text-primary, #111);
}

/* Highlight "đề xuất" column (last) */
.ink-tblwrap th:last-child {
    background: var(--color-brand-surface, #fef1f1);
    color: var(--color-brand-primary, #dd3333);
    border-top: 3px solid var(--color-brand-primary, #dd3333);
}

.ink-tblwrap td:last-child {
    background: var(--color-brand-surface, #fef1f1);
}

.ink-tblwrap tr:last-child td { border-bottom: none; }

.ink-tblwrap td .ink-oem-link,
.ink-tblwrap td .ink-oem-link:visited {
    display: inline-block;
    margin-left: var(--s-2, 0.5rem);
    font-size: var(--fs-xs, 0.75rem);
    color: var(--color-text-muted, #6b7280);
    text-decoration: underline !important;
    text-underline-offset: 2px;
    white-space: nowrap;
}
.ink-tblwrap td .ink-oem-link:hover { color: var(--color-brand-primary, #dd3333) !important; }

.ink-tblwrap td .ink-gt-link,
.ink-tblwrap td .ink-gt-link:visited {
    display: inline-block;
    margin-left: var(--s-2, 0.5rem);
    font-size: var(--fs-xs, 0.75rem);
    color: var(--color-brand-primary, #dd3333);
    text-decoration: underline !important;
    text-underline-offset: 2px;
    white-space: nowrap;
}
.ink-tblwrap td .ink-gt-link:hover { color: #b91c1c !important; }

.ink-tblwrap td:first-child {
    font-weight: 500;
    color: var(--color-text-muted, #4b5563);
}

/* ─── Bundle section gộp trong #ink ─────────────────────────── */
.compare-names { font-size: 18px; font-weight: inherit; }
.bundle-section { margin-top: var(--s-8, 2rem); }

/* ─── Pick callout (savings highlight) ───────────────────────── */
.pick {
    font-size: var(--fs-sm, 0.875rem);
    background: var(--color-surface-sunken, #f2f4f7);
    border-left: 3px solid var(--color-brand-primary, #dd3333);
    padding: var(--s-3, 0.75rem) var(--s-4, 1rem);
    border-radius: 0 var(--radius-md, 8px) var(--radius-md, 8px) 0;
    line-height: 1.6;
    color: var(--color-text-body, #1f2937);
}

.pick br { display: none; }

.pick svg {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
    color: var(--color-brand-primary, #dd3333);
    margin-right: var(--s-2, 0.5rem);
}

.pick i[class*="fa-"] {
    display: inline-block;
    vertical-align: middle;
    color: var(--color-brand-primary, #dd3333);
    margin-right: var(--s-2, 0.5rem);
}

/* ─── Mobile: bảng so sánh mực gộp thành thẻ dọc ─────────────────
   Ma trận chuyển vị (hàng = tiêu chí, cột = Chính hãng / Greentech).
   Mỗi hàng thành 1 thẻ: ô tiêu chí làm tiêu đề, các ô giá trị hiện
   nhãn cột qua ::before. Bỏ min-width + cuộn ngang. */
@media (max-width: 600px) {
    .ink-tblwrap {
        overflow-x: visible;
        border: none;
        border-radius: 0;
    }
    .ink-tblwrap table { min-width: 0; }
    .ink-tblwrap thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .ink-tblwrap tbody tr {
        display: block;
        margin-bottom: var(--s-3, 0.75rem);
        border: 1px solid var(--color-border-subtle, #e5e7eb);
        border-radius: var(--radius-md, 8px);
        overflow: hidden;
    }

    .ink-tblwrap tbody td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: var(--s-3, 0.75rem);
        padding: var(--s-2, 0.5rem) var(--s-3, 0.75rem);
        text-align: right;
        border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
    }
    .ink-tblwrap tbody tr td:last-child { border-bottom: none; }

    /* Nhãn cột hiện bên trái mỗi ô giá trị */
    .ink-tblwrap tbody td::before {
        flex: 0 0 auto;
        margin-right: auto;
        font-weight: 700;
        font-size: var(--fs-xs, 0.75rem);
        color: var(--color-text-muted, #4b5563);
        text-align: left;
    }

    /* Ô tiêu chí (cột đầu) làm tiêu đề thẻ, không có nhãn ::before */
    .ink-tblwrap tbody td:first-child {
        background: var(--color-surface-sunken, #f2f4f7);
        font-weight: 700;
        color: var(--color-text-primary, #111);
        text-align: left;
        justify-content: flex-start;
    }
    .ink-tblwrap tbody td:first-child::before { content: none; }

    /* Link "Xem chi tiết" gọn lại trong ô hẹp */
    .ink-tblwrap tbody td .ink-oem-link,
    .ink-tblwrap tbody td .ink-gt-link { margin-left: 0; }
}

/* ============================================================
   Khối "Mực in & chi phí vận hành" — thẻ CPP nổi bật + bảng tóm
   tắt gọn (theo mockup Product-Page-MFCL8690CDW.html #muc-chi-phi).
   ============================================================ */

/* ─── Thẻ CPP nổi bật (đen / màu) ─────────────────────────────── */
.ink-cppcard-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s-3, 0.75rem);
    margin-bottom: var(--s-3, 0.75rem);
}
@media (max-width: 420px) {
    .ink-cppcard-row { gap: var(--s-2, 0.5rem); }
}

.ink-cppcard {
    background: var(--color-savings-bg, #d1fae5);
    border: 1px solid var(--color-savings, #047857);
    border-radius: var(--radius-lg, 12px);
    padding: var(--s-4, 1rem) var(--s-5, 1.25rem);
    margin-bottom: 0;
    min-width: 0;
}
@media (max-width: 420px) {
    .ink-cppcard { padding: var(--s-3, 0.75rem) var(--s-3, 0.75rem); }
}

.ink-cppcard__hd {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--s-2, 0.5rem);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-primary, #111);
}

.ink-cppcard__dots { display: inline-flex; align-items: center; flex-shrink: 0; }

.ink-cppcard__big {
    font-family: var(--font-numeric);
    font-variant-numeric: tabular-nums;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-savings, #047857);
    line-height: 1.2;
    margin: 6px 0 4px;
}
.ink-cppcard__big span { font-size: var(--fs-md, 1.0625rem); font-weight: 700; }

.ink-cppcard__cmp {
    display: flex;
    align-items: center;
    gap: var(--s-2, 0.5rem);
    flex-wrap: wrap;
    font-size: var(--fs-sm, 0.875rem);
    color: var(--color-text-subtle, #6b7280);
}

@media (max-width: 420px) {
    .ink-cppcard__hd { font-size: 0.6875rem; }
    .ink-cppcard__big span { font-size: 0.9375rem; }
    .ink-cppcard__cmp { font-size: 0.75rem; }
}
.ink-cppcard__cmp s { color: var(--color-text-subtle, #6b7280); }

.ink-cppcard__save {
    background: var(--color-savings, #047857);
    color: #fff;
    font-weight: 700;
    font-size: var(--fs-xs, 0.75rem);
    padding: 3px 10px;
    border-radius: var(--radius-pill, 999px);
    white-space: nowrap;
}

/* ─── Chú thích cơ sở tính ─────────────────────────────────────── */
.ink-cost-basis {
    font-size: var(--fs-xs, 0.75rem);
    color: var(--color-text-subtle, #6b7280);
    margin: 2px 0 var(--s-5, 1.25rem);
	max-width: 875px;
}

/* ─── Bảng tóm tắt gọn (hàng = loại mực) ──────────────────────── */
.ink-cost-tblwrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--color-border-subtle, #e5e7eb);
    border-radius: var(--radius-lg, 12px);
}

.ink-cost-tbl {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: var(--fs-sm, 0.875rem);
}

.ink-cost-tbl th,
.ink-cost-tbl td {
    padding: var(--s-3, 0.75rem) var(--s-4, 1rem);
    text-align: left;
    border-bottom: 1px solid var(--color-border-subtle, #e5e7eb);
    vertical-align: middle;
}

.ink-cost-tbl thead th {
    background: var(--color-surface-sunken, #f2f4f7);
    font-weight: 700;
    font-size: 11px;
    color: var(--color-text-primary, #111);
}

.ink-cost-tbl tbody tr:last-child td { border-bottom: none; }

.ink-cost-tbl__code {
    display: block;
    margin-top: 2px;
    font-size: var(--fs-xs, 0.75rem);
    color: var(--color-text-subtle, #6b7280);
}
.ink-cost-tbl__code .ink-gt-link { margin-left: var(--s-1, 0.25rem); }

.ink-cost-tbl__good { color: var(--color-savings, #047857); font-weight: 700; }

/* Ô chưa có dữ liệu (chính hãng / Greentech) — không để trống */
.ink-cost-tbl__na,
.ink-cppcard__na {
    color: var(--color-text-subtle, #6b7280);
    font-style: italic;
    font-weight: 400;
    white-space: nowrap;
}
.ink-cppcard__na { font-size: var(--fs-md, 1.0625rem); }

.ink-cost-tbl__total td { background: var(--color-savings-bg, #d1fae5); }
