/**
 * Module Products - giao diện ngoài site (theme solar)
 * Chỉ được nạp trên các trang của module products (xem modules/products/functions.php).
 */
.pd-page { padding: 8px 0 48px; }

/* ---- Đầu trang danh sách ---- */
.pd-head { margin-bottom: 20px; }
.pd-title { font-size: 1.75rem; font-weight: 800; color: var(--smt-navy); margin: 0 0 8px; }
.pd-intro { color: var(--smt-text-soft); max-width: 860px; line-height: 1.65; }

/* Ô điều hướng danh mục con */
.pd-subcats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.pd-subcat {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
    border: 1px solid var(--smt-border); border-radius: 999px; background: #fff;
    color: var(--smt-text-soft); font-weight: 600; font-size: .9rem; text-decoration: none;
    transition: border-color .2s, color .2s, box-shadow .2s;
}
.pd-subcat img { width: 26px; height: 26px; object-fit: contain; }
.pd-subcat:hover { border-color: var(--smt-orange); color: var(--smt-orange); box-shadow: 0 4px 14px rgba(15,43,82,.08); }

/* ---- Bố cục danh sách: cột lọc + kết quả ---- */
@media (min-width: 992px) {
    .pd-layout.has-filters { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
    .pd-sidebar { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; scrollbar-width: thin; }
    .pd-filter-actions { display: none; }
}
.pd-results { min-width: 0; transition: opacity .2s; }
.pd-results.is-loading { opacity: .45; pointer-events: none; }

.pd-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; color: var(--smt-text-mute); font-size: .9rem; }
.pd-count { margin-right: auto; }
.pd-sort .form-select { min-width: 170px; border-color: var(--smt-border); }
.pd-filter-toggle {
    display: inline-flex; align-items: center; gap: 8px; padding: .4rem .9rem; border: 1px solid var(--smt-border);
    border-radius: 8px; background: #fff; color: var(--smt-navy); font-weight: 700; font-size: .9rem;
}
.pd-filter-toggle:hover, .pd-filter-toggle:focus { border-color: var(--smt-orange); color: var(--smt-orange); }
.pd-filter-toggle .badge { background: var(--smt-orange); font-size: .7rem; }
.pd-filter-icon {
    width: 16px; height: 16px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M3 5h18l-7 8.5V20l-4-2v-4.5z%27/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27%3E%3Cpath d=%27M3 5h18l-7 8.5V20l-4-2v-4.5z%27/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Khung lọc */
.pd-filter-form { width: 100%; }
.pd-filter-heading { font-size: 1.1rem; font-weight: 800; color: var(--smt-navy); margin: 0; }
.pd-fgroup { border: 1px solid var(--smt-border); border-radius: 12px; padding: 12px 14px 8px; margin-bottom: 14px; background: #fff; }
.pd-fgroup-title { float: none; width: auto; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--smt-navy); margin: 0 0 8px; padding: 0; }
.pd-fgroup-list { max-height: 260px; overflow-y: auto; scrollbar-width: thin; margin-right: -6px; padding-right: 6px; }
.pd-fopt { margin-bottom: 6px; font-size: .92rem; }
.pd-fopt .form-check-input { cursor: pointer; }
.pd-fopt .form-check-input:checked { background-color: var(--smt-orange); border-color: var(--smt-orange); }
.pd-fopt .form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(245,146,30,.25); border-color: var(--smt-orange); }
.pd-fopt .form-check-label { cursor: pointer; color: var(--smt-text-soft); }
.pd-fopt .pd-fopt-link, .pd-fopt .pd-fopt-link:link, .pd-fopt .pd-fopt-link:visited { color: inherit; text-decoration: none; }
.pd-fopt .pd-fopt-link:hover { color: var(--smt-orange); }
.pd-fopt-count { color: var(--smt-text-mute); font-size: .8rem; }
.pd-filter-actions { position: sticky; bottom: 0; padding: 12px 0 4px; background: #fff; }
.pd-filter-actions .btn { font-weight: 700; padding: .7rem; background: var(--smt-orange); border-color: var(--smt-orange); }

/* Lựa chọn đang lọc */
.pd-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.pd-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 12px; border-radius: 999px;
    background: #fff4ea; border: 1px solid #ffd8b5; color: #b85400; font-size: .85rem; font-weight: 600; text-decoration: none;
}
.pd-chip:hover { background: #ffe6cf; color: #8f4100; }
.pd-chip-x { font-size: 1.1rem; line-height: 1; }
.pd-chip-clear { font-size: .85rem; font-weight: 600; color: var(--smt-text-mute); text-decoration: underline; }
.pd-chip-clear:hover { color: var(--smt-orange); }

/* ---- Thẻ sản phẩm ---- */
.pd-card {
    height: 100%; display: flex; flex-direction: column; background: #fff; border-radius: 14px; overflow: hidden;
    border: 1px solid var(--smt-border); transition: box-shadow .25s ease, transform .25s ease, border-color .25s;
}
.pd-card:hover { box-shadow: 0 16px 34px rgba(15,43,82,.12); transform: translateY(-3px); border-color: transparent; }
.pd-card-media { position: relative; display: block; aspect-ratio: 1 / 1; background: #fff; overflow: hidden; }
.pd-card-media img { width: 100%; height: 100%; object-fit: contain; padding: 12px; transition: transform .35s ease; }
.pd-card:hover .pd-card-media img { transform: scale(1.04); }
.pd-card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; flex: 1; border-top: 1px solid var(--smt-border); }
.pd-card-brand { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--smt-text-mute); margin-bottom: 4px; }
.pd-card-title { font-size: .95rem; font-weight: 700; line-height: 1.35; margin: 0 0 10px; min-height: 2.7em; }
.pd-card-title a {
    color: var(--smt-navy); text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pd-card-title a:hover { color: var(--smt-orange); }
.pd-card-price { margin-top: auto; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }

.pd-price { font-weight: 800; color: #d9480f; font-size: 1.05rem; }
.pd-price-contact { color: var(--smt-orange); }
.pd-price-old { color: var(--smt-text-mute); font-size: .85rem; }
.pd-price-lg { font-size: 1.75rem; }

.pd-badge {
    position: absolute; top: 10px; z-index: 1; padding: 3px 8px; border-radius: 6px;
    font-size: .75rem; font-weight: 700; color: #fff; line-height: 1.4;
}
.pd-badge-sale { left: 10px; background: #e03131; }
.pd-badge-hot { right: 10px; background: var(--smt-orange); }
.pd-badge-inline { position: static; margin-left: 4px; vertical-align: middle; }

.pd-empty { padding: 48px 16px; text-align: center; color: var(--smt-text-mute); background: var(--smt-bg-soft); border-radius: 12px; }
.pd-pages { margin-top: 28px; display: flex; justify-content: center; }
.pd-cat-content { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--smt-border); color: var(--smt-text-soft); line-height: 1.75; }

/* ---- Chi tiết: gallery ---- */
.pd-gallery { position: sticky; top: 90px; }
.pd-stage {
    position: relative; aspect-ratio: 1 / 1; background: #fff; border: 1px solid var(--smt-border); border-radius: 16px;
    overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.pd-stage-image { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.pd-stage img, .pd-stage-image img { width: 100%; height: 100%; object-fit: contain; padding: 16px; }
.pd-stage video, .pd-stage iframe { width: 100%; height: 100%; border: 0; background: #000; object-fit: contain; }
.pd-stage-video { position: relative; width: 100%; height: 100%; padding: 0; border: 0; background: #000; cursor: pointer; }
.pd-stage-video img { object-fit: cover; padding: 0; opacity: .9; }
.pd-play-icon {
    position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; transform: translate(-50%, -50%);
    border-radius: 50%; background: rgba(224, 49, 49, .92); box-shadow: 0 6px 20px rgba(0,0,0,.3); transition: transform .2s;
}
.pd-play-icon::after {
    content: ""; position: absolute; left: 54%; top: 50%; transform: translate(-50%, -50%);
    border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff;
}
.pd-stage-video:hover .pd-play-icon { transform: translate(-50%, -50%) scale(1.08); }
.pd-play-sm { width: 28px; height: 28px; }
.pd-play-sm::after { border-width: 6px 0 6px 10px; }

.pd-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.pd-thumb {
    flex: 0 0 72px; height: 72px; padding: 0; border: 2px solid var(--smt-border); border-radius: 10px;
    background: #fff; overflow: hidden; cursor: pointer; transition: border-color .2s;
}
.pd-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.pd-thumb.active, .pd-thumb:hover { border-color: var(--smt-orange); }
.pd-thumb-video { position: relative; display: block; width: 100%; height: 100%; background: #222 center / cover no-repeat; }

/* ---- Chi tiết: thông tin ---- */
.pd-info-cat { display: inline-block; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--smt-orange); text-decoration: none; margin-bottom: 6px; }
.pd-info-title { font-size: 1.75rem; font-weight: 800; color: var(--smt-navy); line-height: 1.3; margin: 0 0 12px; }
.pd-info-meta { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--smt-text-mute); font-size: .9rem; }
.pd-info-meta strong { color: var(--smt-text); }
.pd-stock { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: .8rem; }
.pd-stock-in { background: #e6fcf5; color: #0c8a5f; }
.pd-stock-out { background: #fff5f5; color: #c92a2a; }
.pd-info-price { padding: 14px 18px; background: var(--smt-bg-soft); border-radius: 12px; margin-bottom: 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.pd-price-note { width: 100%; color: var(--smt-text-mute); font-size: .85rem; }

.pd-highlights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.pd-highlights > div { padding: 10px 12px; border: 1px solid var(--smt-border); border-radius: 10px; }
.pd-highlights dt { font-size: .75rem; font-weight: 600; color: var(--smt-text-mute); text-transform: uppercase; letter-spacing: .03em; }
.pd-highlights dd { margin: 2px 0 0; font-weight: 700; color: var(--smt-navy); }
.pd-hometext { color: var(--smt-text-soft); line-height: 1.7; margin-bottom: 20px; }

.pd-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pd-actions .btn { flex: 1 1 200px; padding: .85rem 1.25rem; font-weight: 700; border-radius: .5rem; }
.pd-btn-call { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--smt-navy); color: #fff; border: 0; }
.pd-btn-call:hover { background: var(--smt-navy-deep); color: #fff; }
.pd-call-icon {
    width: 16px; height: 16px; background: currentColor; flex: 0 0 16px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.12.9.34 1.79.65 2.65a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.43-1.22a2 2 0 0 1 2.11-.45c.86.31 1.75.53 2.65.65A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.12.9.34 1.79.65 2.65a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.43-1.22a2 2 0 0 1 2.11-.45c.86.31 1.75.53 2.65.65A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---- Chi tiết: mô tả / thông số / liên quan ---- */
/* Tab Mô tả / Thông số: 2 nút căn giữa, nút đang chọn nền cam nhạt */
.pd-tabs { margin-top: 40px; padding: 20px; background: #fff; border: 1px solid var(--smt-border); border-radius: 14px; scroll-margin-top: 100px; }
.pd-tab-nav { display: flex; justify-content: center; gap: 12px; margin-bottom: 20px; }
.pd-tab-btn {
    flex: 0 1 240px; padding: 11px 20px; border: 1px solid var(--smt-border); border-radius: 10px;
    background: #fff; color: var(--smt-navy); font-weight: 700; font-size: 1rem; line-height: 1.3;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.pd-tab-btn:hover { border-color: var(--smt-orange); color: var(--smt-orange); }
.pd-tab-btn.active { background: #fff4e6; border-color: #fdd8a8; color: var(--smt-orange); }
.pd-tabs .pd-section { margin-top: 0; }
/* Nhóm thông số đóng/mở */
.pd-spec-group + .pd-spec-group { margin-top: 10px; }
.pd-spec-head {
    position: relative; display: block; width: 100%; padding: 13px 44px 13px 16px; border: 0; border-radius: 10px;
    background: var(--smt-bg-soft); color: var(--smt-navy); font-weight: 700; font-size: 1rem; text-align: left;
}
.pd-spec-head::after {
    content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; margin-top: -2px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-50%) rotate(225deg);
    transition: transform .2s ease;
}
.pd-spec-head.collapsed::after { transform: translateY(-50%) rotate(45deg); margin-top: -4px; }
.pd-spec-head:hover { color: var(--smt-orange); }
.pd-spec-group .pd-specs-table { border: 0; }
.pd-spec-group .pd-specs-table th { background: transparent; }
.pd-spec-group .pd-specs-table tr:nth-child(even) td { background: transparent; }
.pd-spec-group .pd-specs-table tr:last-child th, .pd-spec-group .pd-specs-table tr:last-child td { border-bottom: 0; }
.pd-section { margin-top: 32px; scroll-margin-top: 140px; }
.pd-section-title { font-size: 1.35rem; font-weight: 800; color: var(--smt-navy); margin-bottom: 16px; }
.pd-section .bodytext { color: var(--smt-text-soft); line-height: 1.8; }
/* Heading trong bài mô tả: bài thường dán từ nơi khác có cả h1/h2 rất to -> thu về cùng thang cỡ
   chữ với nội dung (tiêu đề sản phẩm ở trên vẫn là chữ lớn nhất trang) */
.pd-section .bodytext h1, .pd-section .bodytext h2, .pd-section .bodytext h3,
.pd-section .bodytext h4, .pd-section .bodytext h5, .pd-section .bodytext h6 {
    color: var(--smt-navy); font-weight: 700; line-height: 1.4; margin: 28px 0 12px;
}
.pd-section .bodytext h1 { font-size: 1.375rem; }
.pd-section .bodytext h2 { font-size: 1.25rem; }
.pd-section .bodytext h3 { font-size: 1.125rem; margin-top: 22px; }
.pd-section .bodytext h4, .pd-section .bodytext h5, .pd-section .bodytext h6 { font-size: 1rem; margin: 18px 0 8px; }
.pd-section .bodytext > :first-child { margin-top: 0; }
.pd-section .bodytext img { max-width: 100%; height: auto; border-radius: 8px; }
.pd-section .bodytext iframe { max-width: 100%; }
.pd-specs-table { border: 1px solid var(--smt-border); margin: 0; }
.pd-specs-table th, .pd-specs-table td { padding: 11px 16px; border-color: var(--smt-border); }
.pd-specs-table th { width: 38%; background: var(--smt-bg-soft); font-weight: 600; color: var(--smt-text-soft); }
.pd-specs-table tr:nth-child(even) td { background: #fbfcfe; }

/* Lightbox phóng to ảnh */
.pd-lightbox .modal-content { background: transparent; border: 0; }
.pd-lightbox .btn-close { position: absolute; right: 0; top: -40px; }
.pd-lightbox-img { width: 100%; max-height: 85vh; object-fit: contain; background: #fff; border-radius: 12px; }

@media (max-width: 991.98px) {
    .pd-gallery { position: static; }
    .pd-info-title, .pd-title { font-size: 1.4rem; }
    .pd-price-lg { font-size: 1.45rem; }
    .pd-tabs { padding: 14px; }
    .pd-section .bodytext h1 { font-size: 1.25rem; }
    .pd-section .bodytext h2 { font-size: 1.125rem; }
    .pd-section .bodytext h3 { font-size: 1.0625rem; }
}
@media (max-width: 575.98px) {
    .pd-tab-nav { gap: 8px; }
    .pd-tab-btn { flex: 1 1 0; padding: 10px 8px; font-size: .9rem; }
    .pd-spec-group .pd-specs-table th, .pd-spec-group .pd-specs-table td { padding: 9px 10px; }
    .pd-card-body { padding: 10px 10px 12px; }
    .pd-card-title { font-size: .875rem; }
    .pd-price { font-size: .95rem; }
    .pd-thumb { flex-basis: 60px; height: 60px; }
    .pd-specs-table th { width: 45%; }
}
@media (max-width: 575.98px) {
    .pd-toolbar { gap: 8px; }
    .pd-count { order: 3; width: 100%; }
    .pd-sort { margin-left: auto; }
    .pd-sort .form-select { min-width: 150px; }
}

/* ---- Chi tiết: ô phiên bản (mỗi ô 1 sản phẩm/URL) + ô biến thể (màu sắc...) ---- */
.pd-options { margin: 0 0 16px; }
.pd-options-label { font-weight: 700; color: var(--smt-navy); font-size: .95rem; margin-bottom: 8px; }
.pd-options-label strong { font-weight: 600; color: var(--smt-text-soft); }
.pd-options-list { display: grid; gap: 10px; }
.pd-options-group { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.pd-options-variant { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.pd-opt {
    position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 12px;
    border: 1px solid var(--smt-border); border-radius: 10px; background: #fff; color: var(--smt-text);
    text-decoration: none; line-height: 1.3; transition: border-color .2s, box-shadow .2s;
}
.pd-options .pd-opt { color: var(--smt-text); } /* thắng a:link màu cam của custom.css */
.pd-opt:hover { border-color: var(--smt-orange); color: var(--smt-text); box-shadow: 0 2px 10px rgba(15,43,82,.08); }
.pd-opt.active { border-color: #d9480f; box-shadow: inset 0 0 0 1px #d9480f; }
.pd-opt.active::after {
    content: ""; position: absolute; top: -1px; right: -1px; width: 20px; height: 18px; border-radius: 0 10px 0 8px;
    background: #d9480f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.pd-opt-group { flex-direction: column; justify-content: center; text-align: center; gap: 2px; }
.pd-opt-group .pd-opt-name { font-weight: 700; color: var(--smt-navy); font-size: .9rem; }
.pd-opt-price { font-size: .85rem; font-weight: 600; color: var(--smt-text-mute); }
.pd-opt-price.is-contact { color: var(--smt-orange); }
.pd-opt-group.active .pd-opt-price { color: #d9480f; }
.pd-opt-variant img { width: 36px; height: 36px; flex: 0 0 36px; object-fit: contain; border-radius: 6px; background: var(--smt-bg-soft); }
.pd-opt-variant .pd-opt-name { font-weight: 600; font-size: .9rem; }
.pd-options .pd-opt-variant.is-out { color: var(--smt-text-mute); background: var(--smt-bg-soft); }
.pd-opt-variant.is-out img { opacity: .45; filter: grayscale(1); }
@media (max-width: 575.98px) {
    .pd-options-group, .pd-options-variant { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
