/* ═══════════════════════════════════════════════════════
   DETAIL PAGE FIX — shops/detail.tpl
   Fix: gallery height, tabs display, bodytext, layout
   ═══════════════════════════════════════════════════════ */

/* ── 1. FIX CONTAINER & LAYOUT ──────────────────────── */
.fix-container {
    width: 100%;
    max-width: 100%;
    padding: 0;
}
.gutter-x0 { --bs-gutter-x: 0; }

.b2b-product-detail {
    background: #fff;
    padding: 24px 16px;
    margin-bottom: 24px;
}

.b2b-detail-wrap {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 36px;
    align-items: flex-start;
}

@media (max-width: 900px) {
    .b2b-detail-wrap { grid-template-columns: 1fr; }
}

/* ── 2. FIX GALLERY HEIGHT (root cause #1) ──────────── */
/* Vấn đề: padding-bottom trick + height:0 khiến ảnh ẩn
   khi container chưa có chiều cao xác định              */

.gallery-top {
    width: 100%;
    height: 420px !important;        /* fix cứng chiều cao */
    box-shadow: 0 0 6px rgba(0,0,0,.10);
    border-radius: 6px;
    background: #f8f9fa;
    overflow: hidden;
}

.gallery-top .swiper-wrapper {
    height: 100% !important;
}

.gallery-top .swiper-slide {
    height: 420px !important;        /* override padding-bottom trick */
    padding-bottom: 0 !important;    /* tắt padding trick */
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

.gallery-top .swiper-slide img {
    position: static !important;     /* tắt position:absolute cũ */
    transform: none !important;      /* tắt translate(-50%,-50%) */
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 420px !important;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Thumbnails */
.gallery-thumbs {
    margin-top: 10px !important;
    background: #fff;
    padding: 8px;
    border-radius: 4px;
}

.gallery-thumbs .swiper-slide {
    border: 2px solid #ebebeb;
    cursor: pointer;
    background: #fff;
    overflow: hidden;
    height: 72px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.gallery-thumbs .swiper-slide .p-100 {
    padding-bottom: 0 !important;   /* tắt padding trick trong thumb */
    height: 72px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.gallery-thumbs .swiper-slide img,
.gallery-thumbs .swiper-slide .p-100 img {
    position: static !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 68px !important;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.gallery-thumbs .swiper-slide.swiper-slide-thumb-active {
    border-color: #F57C00;
}
.gallery-thumbs .swiper-slide:hover {
    border-color: #F57C00;
}

/* ── 3. FIX TABS (root cause #2) ───────────────────── */
/* Các class này hoàn toàn thiếu trong shops.css        */

.b2b-tabs-section {
    margin-top: 32px;
    border: 1px solid #e0e6ef;
    border-radius: 8px;
    overflow: hidden;
}

.b2b-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e6ef;
    overflow-x: auto;
    scrollbar-width: none;
}
.b2b-tabs::-webkit-scrollbar { display: none; }

.b2b-tabs__btn {
    padding: 14px 22px;
    border: none;
    background: none;
    font-size: 13.5px;
    font-weight: 600;
    color: #526070;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all .18s;
    font-family: inherit;
}
.b2b-tabs__btn:hover {
    color: #0D2B5B;
    background: rgba(13,43,91,.04);
}
.b2b-tabs__btn.active {
    color: #0D2B5B;
    background: #fff;
    border-bottom-color: #F57C00;
}

/* Tab panes — mặc định ẩn */
.b2b-tab-pane {
    display: none;
    padding: 24px;
}
.b2b-tab-pane.active {
    display: block;
}

/* ── 4. FIX BODYTEXT / NỘI DUNG CHI TIẾT (root cause #2) ── */
.b2b-detail__bodytext,
.b2b-tab-pane .bodytext {
    font-size: 14.5px;
    line-height: 1.85;
    color: #333;
    word-break: break-word;
}

/* Reset headings trong CKEditor content */
.b2b-detail__bodytext h1,
.b2b-detail__bodytext h2,
.b2b-detail__bodytext h3,
.b2b-detail__bodytext h4,
.b2b-detail__bodytext h5,
.b2b-detail__bodytext h6,
.bodytext h1,.bodytext h2,.bodytext h3,
.bodytext h4,.bodytext h5,.bodytext h6 {
    font-weight: 700;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    line-height: 1.4;
    color: #111;
}
.b2b-detail__bodytext h2, .bodytext h2 { font-size: 1.4em; color: #0D2B5B; }
.b2b-detail__bodytext h3, .bodytext h3 { font-size: 1.2em; }

.b2b-detail__bodytext p, .bodytext p { margin-bottom: 1em; }

.b2b-detail__bodytext ul,
.b2b-detail__bodytext ol,
.bodytext ul, .bodytext ol {
    padding-left: 20px;
    margin-bottom: 1em;
}
.b2b-detail__bodytext ul { list-style: disc; }
.b2b-detail__bodytext ol { list-style: decimal; }
.b2b-detail__bodytext li, .bodytext li { margin-bottom: 5px; }

.b2b-detail__bodytext img, .bodytext img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.b2b-detail__bodytext table, .bodytext table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    font-size: 13.5px;
}
.b2b-detail__bodytext table td,
.b2b-detail__bodytext table th,
.bodytext table td, .bodytext table th {
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    text-align: left;
}
.b2b-detail__bodytext table th, .bodytext table th {
    background: #f8f9fa;
    font-weight: 700;
    color: #0D2B5B;
}
.b2b-detail__bodytext table tr:nth-child(even) td {
    background: #f8f9fa;
}

/* ── 5. SPECS TABLE ─────────────────────────────────── */
.b2b-specs-wrap {
    overflow-x: auto;
}
.b2b-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.b2b-specs-table th,
.b2b-specs-table td {
    padding: 10px 14px;
    border: 1px solid #e0e6ef;
    text-align: left;
    vertical-align: top;
}
.b2b-specs-table th {
    background: #f0f4f8;
    font-weight: 700;
    color: #0D2B5B;
    width: 38%;
    white-space: nowrap;
}
.b2b-specs-table tr:nth-child(even) td { background: #f8f9fa; }
.b2b-specs-table tr:hover td { background: #EBF5FB; }

/* ── 6. TRUST BADGES ────────────────────────────────── */
.b2b-trust-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.b2b-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #F0FAF0;
    border: 1px solid #C8E6C9;
    border-radius: 4px;
    font-size: 12px;
    color: #2E7D32;
    font-weight: 600;
}

/* ── 7. MOBILE ──────────────────────────────────────── */
@media (max-width: 768px) {
    .gallery-top { height: 300px !important; }
    .gallery-top .swiper-slide { height: 300px !important; }
    .gallery-top .swiper-slide img { max-height: 300px !important; }
    .b2b-tabs__btn { padding: 11px 14px; font-size: 12.5px; }
    .b2b-tab-pane { padding: 16px; }
    .b2b-detail__bodytext { font-size: 13.5px; }
}
