/* ==========================================================================
   HÒA PHÁT (maymocxaydung.vn) — PRODUCT MEDIA HUB (VIDEO • MÔ TẢ • THÔNG SỐ • CATALOGUE • HDSD)
   Theme tương thích: Sapo EGA Techstore - Clean - Breadcrumb (Bootstrap 4.3 + FA5)
   Tiền tố độc lập: .hp-mh-* (0% xung đột CSS với theme gốc)
   ========================================================================== */

:root {
  --hp-mh-accent: #dd0115;
  --hp-mh-accent-dark: #b40010;
  --hp-mh-navy: #174374;
  --hp-mh-zalo: #0068ff;
  --hp-mh-text: #1f2937;
  --hp-mh-muted: #64748b;
  --hp-mh-border: #e5e7eb;
  --hp-mh-bg: #ffffff;
  --hp-mh-surface: #f8fafc;
}

/* ---------- 1. STICKY HORIZONTAL NAVIGATION BAR (Chuẩn phong cách Lạc Hồng) ---------- */
.hp-mh-nav-section {
  position: sticky;
  top: 0;
  z-index: 95;
  margin-top: 12px;
  margin-bottom: 14px;
  transition: box-shadow 0.2s ease;
}

.hp-mh-nav-section.is-stuck {
  margin-top: 0;
}

.hp-mh-nav-card {
  background: var(--hp-mh-bg);
  border: 1px solid var(--hp-mh-border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  padding: 6px 12px;
}

.hp-mh-nav-section.is-stuck .hp-mh-nav-card {
  border-radius: 0 0 10px 10px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
}

.hp-mh-nav-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0;
  margin: 0;
  list-style: none;
}

.hp-mh-nav-list::-webkit-scrollbar {
  display: none;
}

.hp-mh-nav-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--hp-mh-text) !important;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none !important;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.hp-mh-nav-btn i,
.hp-mh-nav-btn svg {
  font-size: 14px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #475569;
  transition: color 0.18s ease;
}

.hp-mh-nav-btn:hover {
  background: #fef2f2;
  color: var(--hp-mh-accent) !important;
  border-color: rgba(221, 1, 21, 0.25);
}

.hp-mh-nav-btn:hover i,
.hp-mh-nav-btn:hover svg {
  color: var(--hp-mh-accent);
}

.hp-mh-nav-btn.is-active {
  border-color: var(--hp-mh-text);
  background: #ffffff;
  color: #111827 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.hp-mh-nav-btn.is-active i,
.hp-mh-nav-btn.is-active svg {
  color: var(--hp-mh-accent);
}

.hp-mh-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.hp-mh-card-title svg {
  width: 22px;
  height: 22px;
  color: var(--hp-mh-accent);
  flex-shrink: 0;
}

/* Badge số lượng video / tài liệu nhỏ gọn */
.hp-mh-badge-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #fee2e2;
  color: var(--hp-mh-accent);
  margin-left: 2px;
}

/* ---------- 2. VIDEO SECTION CARD ---------- */
.hp-mh-video-section {
  margin-bottom: 16px;
  scroll-margin-top: 76px;
}

.hp-mh-video-section.is-hidden {
  display: none !important;
}

.hp-mh-video-card {
  background: var(--hp-mh-bg);
  border: 1px solid var(--hp-mh-border);
  border-radius: 8px;
  padding: 18px 20px 20px;
}

.hp-mh-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--hp-mh-border);
}

.hp-mh-card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--hp-mh-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hp-mh-card-title i {
  color: var(--hp-mh-accent);
  font-size: 20px;
}

.hp-mh-card-sub {
  font-size: 13px;
  color: var(--hp-mh-muted);
}

.hp-mh-video-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.hp-mh-video-grid.has-playlist {
  grid-template-columns: minmax(0, 1fr) 310px;
}

/* Main player stage (16:9 default & 9:16 Shorts centered clean frame) */
.hp-mh-player-stage {
  position: relative;
  width: 100%;
  background: #0f172a;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
}

.hp-mh-player-ratio {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
}

.hp-mh-player-stage.is-shorts {
  max-width: 390px;
  margin: 0 auto;
}

.hp-mh-player-stage.is-shorts .hp-mh-player-ratio {
  padding-top: 177.78%; /* 9:16 */
}

/* Khi chỉ có 1 video Shorts ở desktop, đặt bố cục 2 cột gọn gàng: khung Shorts bên trái + hộp tóm tắt tư vấn bên phải */
.hp-mh-shorts-single-wrap {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.hp-mh-shorts-aside {
  background: var(--hp-mh-surface);
  border: 1px solid var(--hp-mh-border);
  border-radius: 10px;
  padding: 18px;
}

.hp-mh-shorts-aside h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--hp-mh-navy);
  margin: 0 0 8px;
}

.hp-mh-shorts-aside p {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.55;
  margin: 0 0 12px;
}

.hp-mh-player-ratio iframe,
.hp-mh-facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Facade Lazy-Load (tối ưu tốc độ tải trang Google Core Web Vitals) */
.hp-mh-facade {
  cursor: pointer;
  background-color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hp-mh-facade img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
  transition: transform 0.35s ease, opacity 0.25s ease;
}

.hp-mh-facade:hover img {
  transform: scale(1.03);
  opacity: 1;
}

.hp-mh-play-btn {
  position: relative;
  z-index: 2;
  width: 68px;
  height: 48px;
  border-radius: 12px;
  background: rgba(221, 1, 21, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.hp-mh-facade:hover .hp-mh-play-btn {
  transform: scale(1.08);
  background: #ff0000;
}

.hp-mh-play-btn::after {
  content: "";
  display: block;
  margin-left: 4px;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #ffffff;
}

.hp-mh-facade-label {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  backdrop-filter: blur(4px);
}

/* Playlist sidebar (khi sản phẩm có nhiều video) */
.hp-mh-playlist {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}

.hp-mh-pl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  border: 1.5px solid var(--hp-mh-border);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.hp-mh-pl-item:hover {
  border-color: #fca5a5;
  background: #fef2f2;
}

.hp-mh-pl-item.is-active {
  border-color: var(--hp-mh-accent);
  background: #fff5f5;
}

.hp-mh-pl-thumb {
  flex: 0 0 96px;
  height: 58px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  background: #111827;
}

.hp-mh-pl-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hp-mh-pl-thumb .hp-mh-pl-badge {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
}

.hp-mh-pl-info {
  min-width: 0;
  flex: 1;
}

.hp-mh-pl-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--hp-mh-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hp-mh-pl-meta {
  font-size: 11.5px;
  color: var(--hp-mh-muted);
  margin-top: 3px;
}

/* Trạng thái dự phòng khi chưa nhập link video nhưng bật chế độ hiển thị CTA */
.hp-mh-video-fallback {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hp-mh-video-fallback-text h4 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--hp-mh-navy);
}

.hp-mh-video-fallback-text p {
  margin: 0;
  font-size: 13.5px;
  color: #475569;
}

/* ---------- 3. MODALS: CATALOGUE & HDSD (Bootstrap 4 + Fallback tự chủ) ---------- */
.hp-mh-modal .modal-dialog {
  max-width: 820px;
}

.hp-mh-modal .modal-content {
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.hp-mh-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--hp-mh-border);
  background: #ffffff;
}

.hp-mh-pill-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
}

.hp-mh-pill-badge--red {
  color: var(--hp-mh-accent);
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.hp-mh-pill-badge--blue {
  color: var(--hp-mh-navy);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.hp-mh-modal-title {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--hp-mh-text);
  line-height: 1.35;
}

.hp-mh-page-chip {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  margin-top: 2px;
}

.hp-mh-close-btn {
  border: 0;
  background: #f1f5f9;
  color: #334155;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.hp-mh-close-btn:hover {
  background: #fee2e2;
  color: var(--hp-mh-accent);
}

.hp-mh-modal-body {
  padding: 18px 20px;
  max-height: 62vh;
  overflow-y: auto;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--hp-mh-text);
}

.hp-mh-modal .modal-footer.hp-mh-modal-footer,
.hp-mh-modal-footer {
  display: block;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--hp-mh-border);
  background: #ffffff;
}

.hp-mh-modal-footer .hp-mh-action-row {
  margin-top: 0;
  width: 100%;
}

/* Khung ảnh Catalogue / Infographic HDSD giống Lạc Hồng */
.hp-mh-doc-frame {
  display: block;
  border: 1px solid var(--hp-mh-border);
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  margin-bottom: 14px;
  text-decoration: none !important;
}

.hp-mh-doc-frame img {
  display: block;
  max-width: 100% !important;
  max-height: 520px;
  width: auto !important;
  height: auto !important;
  margin: 0 auto !important;
  object-fit: contain;
}

.hp-mh-doc-caption {
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--hp-mh-muted);
  text-align: center;
  background: #f8fafc;
  border-top: 1px solid var(--hp-mh-border);
}

/* Nội dung HDSD / Catalogue dạng bài viết rich HTML từ Sapo Pages hoặc Metafield */
.hp-mh-rich-content {
  font-size: 14.5px;
  line-height: 1.65;
  color: #1f2937;
}

.hp-mh-rich-content h2,
.hp-mh-rich-content h3,
.hp-mh-rich-content h4 {
  color: var(--hp-mh-navy);
  font-weight: 700;
  margin-top: 14px;
  margin-bottom: 8px;
}

.hp-mh-rich-content img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: 8px;
  margin: 10px auto;
  display: block;
}

.hp-mh-rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13.5px;
}

.hp-mh-rich-content table th,
.hp-mh-rich-content table td {
  border: 1px solid #cbd5e1;
  padding: 7px 10px;
}

.hp-mh-rich-content ul,
.hp-mh-rich-content ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

/* Khối lưu ý an toàn kỹ thuật Hòa Phát */
.hp-mh-safety-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #d97706;
  font-size: 13.5px;
  color: #78350f;
  line-height: 1.5;
}

/* Hộp nút CTA đôi giống Lạc Hồng (.lhcat-nut) */
.hp-mh-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.hp-mh-btn {
  flex: 1 1 200px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.hp-mh-btn--primary {
  background: var(--hp-mh-accent);
  color: #ffffff !important;
}

.hp-mh-btn--primary:hover {
  background: var(--hp-mh-accent-dark);
  color: #ffffff !important;
}

.hp-mh-btn--outline {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--hp-mh-text) !important;
}

.hp-mh-btn--outline:hover {
  border-color: var(--hp-mh-accent);
  color: var(--hp-mh-accent) !important;
}

.hp-mh-btn--zalo {
  background: var(--hp-mh-zalo);
  color: #ffffff !important;
}

.hp-mh-btn--zalo:hover {
  background: #0052cc;
  color: #ffffff !important;
}

/* Fallback box gọn gàng khi sản phẩm chưa có file Catalogue/HDSD riêng */
.hp-mh-empty-guide {
  background: var(--hp-mh-surface);
  border: 1px solid var(--hp-mh-border);
  border-radius: 10px;
  padding: 16px;
}

.hp-mh-empty-guide h4 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--hp-mh-navy);
}

.hp-mh-empty-guide p {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: #475569;
}

/* Ẩn block nguồn dữ liệu nếu Admin đặt trực tiếp trong Mô tả sản phẩm */
.hp-mh-inline-source-hidden {
  display: none !important;
}

/* ---------- 4. RESPONSIVE MOBILE & TABLET ---------- */
@media (max-width: 991px) {
  .hp-mh-video-grid.has-playlist {
    grid-template-columns: minmax(0, 1fr);
  }
  .hp-mh-playlist {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 6px;
  }
  .hp-mh-pl-item {
    flex: 0 0 230px;
  }
  .hp-mh-shorts-single-wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .hp-mh-nav-section {
    margin-top: 8px;
    margin-bottom: 10px;
  }
  .hp-mh-nav-card {
    padding: 5px 8px;
  }
  .hp-mh-nav-list {
    justify-content: flex-start;
    gap: 4px;
  }
  .hp-mh-nav-btn {
    padding: 6px 10px;
    font-size: 12.5px;
    gap: 5px;
  }
  .hp-mh-video-card {
    padding: 14px 12px 16px;
  }
  .hp-mh-card-title {
    font-size: 16px;
  }
  .hp-mh-modal-header {
    padding: 13px 14px;
  }
  .hp-mh-modal-body {
    padding: 14px;
    max-height: 58vh;
  }
  .hp-mh-modal-footer {
    padding: 10px 14px 12px;
  }
  .hp-mh-btn {
    flex: 1 1 100%;
    padding: 10px 14px;
    font-size: 14px;
  }
}