/* --------------------------------------------------------------------------
   CUSTOM SINGLE PRODUCT PAGE CSS (High-Fidelity Long Thanh style)
   -------------------------------------------------------------------------- */

:root {
  --primary-accent: #0254d8; /* Vivid Royal Blue matching Long Thanh style */
  --primary-accent-hover: #0143b1;
  --primary-light: rgba(2, 84, 216, 0.05);
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --text-foreground: #334155;
  --border-color: #e2e8f0;
  --bg-muted-light: #f8fafc;
  --success-color: #10b981;
  --error-color: #ef4444;
}

/* Base wrapper resets and utility */
.nhuanhatminh-single-product-wrapper {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-foreground);
  background-color: #ffffff;
  line-height: 1.6;
}

.nhuanhatminh-single-product-wrapper *,
.nhuanhatminh-single-product-wrapper *::before,
.nhuanhatminh-single-product-wrapper *::after {
  box-sizing: border-box;
}

/* Spacing & grid utilities */
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pt-5 { padding-top: 1.25rem; }
.pb-4 { padding-bottom: 1rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.pl-1 { padding-left: 0.25rem; }
.mr-3 { margin-right: 0.75rem; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.h-4 { height: 1rem; }
.w-4 { width: 1rem; }
.aspect-square { aspect-ratio: 1 / 1; }
.rounded { border-radius: 8px; }
.rounded-full { border-radius: 9999px; }

/* Display & Flex */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }
.gap-10 { gap: 2.5rem; }
.hidden { display: none; }
.relative { position: relative; }
.absolute { position: absolute; }
.bottom-4 { bottom: 1rem; }
.right-4 { right: 1rem; }
.overflow-hidden { overflow: hidden; }

/* Borders & Shadow */
.border-b { border-bottom: 1px solid var(--border-color); }
.border-t { border-top: 1px solid var(--border-color); }
.border { border: 1px solid var(--border-color); }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03); }
.shadow-md { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
.shadow-inner { box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.03); }

/* Colors & BG */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f8fafc; }
.bg-white\/90 { background-color: rgba(255, 255, 255, 0.9); }
.bg-accent { background-color: var(--primary-accent); }
.hover\:bg-accent-hover:hover { background-color: var(--primary-accent-hover); }
.hover\:bg-white:hover { background-color: #ffffff; }
.text-primary { color: var(--primary-accent); }
.text-gray-400 { color: #94a3b8; }
.text-gray-500 { color: #64748b; }
.text-gray-600 { color: #475569; }
.text-gray-700 { color: #334155; }
.text-gray-800 { color: #1e293b; }
.text-gray-900 { color: #0f172a; }

/* Text settings */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }
.leading-snug { line-height: 1.375; }

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Container */
.container {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: 1.25rem;
  padding-left: 1.25rem;
}
@media (min-width: 640px) { .container { max-width: 640px; } }
@media (min-width: 768px) { .container { max-width: 768px; } }
@media (min-width: 1024px) { .container { max-width: 1020px; } }
@media (min-width: 1280px) { .container { max-width: 1220px; } }

/* Mobile: đảm bảo padding tối thiểu 16px mỗi bên trên màn hình nhỏ */
@media (max-width: 639px) {
  .container {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

/* Grid columns layout */
.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 1024px) {
  .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .lg\:col-span-6 { grid-column: span 6 / span 6; }
  .lg\:col-span-4 { grid-column: span 4 / span 4; }
  .lg\:col-span-8 { grid-column: span 8 / span 8; }
}

/* --------------------------------------------------------------------------
   BREADCRUMBS & PREV-NEXT NAVIGATION
   -------------------------------------------------------------------------- */
.woocommerce-breadcrumb {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
}

.woocommerce-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.woocommerce-breadcrumb a:hover {
  color: var(--primary-accent);
}

.woocommerce-breadcrumb .divider {
  margin: 0 6px;
  color: #cbd5e1;
}

.woocommerce-breadcrumb .breadcrumb-last {
  color: var(--text-dark);
  font-weight: 500;
}

.wd-product-nav a.wd-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  text-decoration: none;
  background-color: #ffffff;
  transition: all 0.2s ease;
}

.wd-product-nav a.wd-nav-btn:hover {
  background-color: var(--primary-accent);
  color: #ffffff;
  border-color: var(--primary-accent);
  box-shadow: 0 2px 4px rgba(2, 84, 216, 0.2);
}

/* --------------------------------------------------------------------------
   GALLERY STICKY & VERTICAL THUMBNAILS LAYOUT
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  .nm-product-gallery-col {
    position: sticky;
    top: 130px; /* Clears sticky header */
    align-self: start;
    height: auto;
  }
}

.nm-gallery-sticky-wrapper {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

.nm-gallery-thumbnails-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 80px;
  flex-shrink: 0;
  max-height: 480px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nm-gallery-thumbnails-col::-webkit-scrollbar {
  width: 4px;
}
.nm-gallery-thumbnails-col::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 2px;
}
.nm-gallery-thumbnails-col::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.nm-gallery-main-col {
  flex: 1;
  min-width: 0;
}

.gallery-thumb {
  cursor: pointer;
  opacity: 0.6;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.gallery-thumb:hover {
  opacity: 0.9;
  border-color: var(--primary-accent);
}

.gallery-thumb.active {
  opacity: 1;
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 2px rgba(2, 84, 216, 0.15);
}

.main-image-viewport {
  position: relative;
  width: 100%;
}

.main-image-viewport img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

@media (max-width: 1023px) {
  .nm-gallery-sticky-wrapper {
    flex-direction: column-reverse;
    gap: 12px;
  }
  .nm-gallery-thumbnails-col {
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    padding-bottom: 4px;
  }
  .gallery-thumb {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
  }
  .nm-gallery-main-col {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   SPECIFICATIONS TABLE
   -------------------------------------------------------------------------- */
.custom-specs-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  display: table;
}

.custom-specs-table tr {
  border-bottom: 1px solid #f1f5f9;
}

.custom-specs-table tr:last-child {
  border-bottom: none;
}

.custom-specs-table tr:nth-child(odd) {
  background-color: var(--bg-muted-light);
}

.custom-specs-table tr:nth-child(even) {
  background-color: #ffffff;
}

.custom-specs-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  padding: 12px 16px;
  font-size: 13px;
  width: 40%;
}

.custom-specs-table td {
  text-align: left;
  font-weight: 600;
  color: var(--text-dark);
  padding: 12px 16px;
  font-size: 13px;
  width: 60%;
}

/* --------------------------------------------------------------------------
   SWATCHES (Màu sắc)
   -------------------------------------------------------------------------- */
.nm-product-colors-selection {
  display: flex;
  align-items: center;
  margin-top: 1.5rem;
}
.nm-color-swatch-dot {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.nm-color-swatch-dot:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* --------------------------------------------------------------------------
   B2B ACTIONS & SLIDE FORM
   -------------------------------------------------------------------------- */
.b2b-hotline-btn {
  text-decoration: none;
  border: 1.5px solid var(--primary-accent) !important;
  color: var(--primary-accent) !important;
  background-color: #ffffff !important;
  height: 48px;
  font-size: 14px;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.b2b-hotline-btn:hover {
  background-color: var(--primary-light) !important;
  border-color: var(--primary-accent-hover) !important;
}

.b2b-form-slide-panel {
  border: 1px solid var(--border-color);
  background-color: var(--bg-muted-light);
}

.b2b-quick-form input {
  height: 42px;
  border: 1px solid var(--border-color);
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
}

.b2b-quick-form input:focus {
  background-color: #ffffff;
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 2px rgba(2, 84, 216, 0.08);
}

.b2b-quick-form button[type="submit"] {
  border: none;
  background-color: var(--primary-accent) !important;
  color: #ffffff !important;
  height: 44px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(2, 84, 216, 0.15);
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.b2b-quick-form button[type="submit"]:hover {
  background-color: var(--primary-accent-hover) !important;
}

.b2b-quick-form button[type="submit"]:active {
  transform: translateY(1px);
}

.b2b-message-box {
  display: none;
}

.b2b-message-box.success {
  display: block;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.b2b-message-box.error {
  display: block;
  background-color: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.b2b-message-box.loading {
  display: block;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
}

/* --------------------------------------------------------------------------
   FAQ SECTION ACCORDIONS (High Fidelity)
   -------------------------------------------------------------------------- */
.faq-accordion-item-title {
  user-select: none;
  font-family: 'Inter', sans-serif;
  line-height: 1.4;
  margin: 0;
}

.faq-accordion-item-title:hover {
  color: var(--primary-accent);
}

.faq-accordion-item.active .faq-accordion-item-title {
  color: var(--primary-accent);
}

.faq-accordion-item.active .faq-accordion-item-title svg {
  transform: rotate(45deg);
  color: var(--primary-accent);
}

.faq-accordion-item-content p {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.faq-accordion-item-content p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   RELATED PRODUCTS / SẢN PHẨM KHÁC (Slider System)
   -------------------------------------------------------------------------- */
.nm-related-products-section {
  overflow: hidden;
}

.nm-slider-nav .nm-slider-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.nm-slider-nav .nm-slider-btn:hover {
  background-color: var(--primary-accent);
  border-color: var(--primary-accent);
  color: #ffffff;
}

.nm-slider-nav .nm-slider-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.nm-related-slider-viewport {
  overflow: hidden;
  width: 100%;
}

.nm-related-slider-track {
  display: flex;
  gap: 24px;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.nm-related-slider-item {
  flex: 0 0 calc((100% - 72px) / 4);
  max-width: calc((100% - 72px) / 4);
  min-width: calc((100% - 72px) / 4);
  box-sizing: border-box;
}

@media (max-width: 1023px) {
  .nm-related-slider-item {
    flex: 0 0 calc((100% - 24px) / 2);
    max-width: calc((100% - 24px) / 2);
    min-width: calc((100% - 24px) / 2);
  }
  .nm-related-slider-track {
    gap: 24px;
  }
}

@media (max-width: 767px) {
  .nm-related-slider-item {
    flex: 0 0 100%;
    max-width: 100%;
    min-width: 100%;
  }
}

.related-product-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.3s ease;
  overflow: hidden;
  background-color: #ffffff;
}

.related-product-card:hover {
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
  border-color: rgba(2, 84, 216, 0.15);
}

.related-product-card img {
  transition: transform 0.3s ease;
}

.related-product-card:hover img {
  transform: scale(1.04);
}

.nm-card-colors {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nm-card-color-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.related-price {
  color: var(--primary-accent);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.05em;
}

.mini-specs-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f1f5f9;
  padding: 5px 0;
  font-size: 12px;
}

.mini-spec-row:last-child {
  border-bottom: none;
}

.mini-spec-label {
  color: var(--text-muted);
  font-weight: 500;
}

.mini-spec-value {
  color: var(--text-dark);
  font-weight: 600;
  text-align: right;
}

.forklift-compatibility-icons {
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.forklift-compatibility-icons span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.forklift-compatibility-icons svg {
  width: 18px;
  height: 18px;
}

/* --------------------------------------------------------------------------
   RESPONSIVE OVERRIDES
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .py-12 {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
  .gap-10 {
    gap: 1.5rem;
  }
  .b2b-card .grid-cols-2 {
    grid-template-columns: 1fr;
  }
  .related-product-card {
    border-radius: 8px;
  }

  /* ---------- FIX: Nội dung chi tiết sản phẩm không sát mép màn hình ---------- */
  .nhuanhatminh-single-product-wrapper {
    overflow-x: hidden;
  }

  /* Toàn bộ nội dung trong wrapper phải không vượt quá màn hình */
  .nhuanhatminh-single-product-wrapper *:not(script):not(style) {
    max-width: 100%;
  }

  /* Nội dung mô tả đầy đủ - canh lề 2 bên, không sát mép */
  .nm-product-full-description {
    overflow-x: hidden;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Tất cả ảnh, bảng, iframe trong nội dung mô tả không tràn */
  .nm-product-full-description img,
  .nm-product-full-description table,
  .nm-product-full-description iframe,
  .nm-product-full-description figure {
    max-width: 100% !important;
    height: auto !important;
    overflow-x: auto;
  }

  /* Bảng trong nội dung mô tả: cuộn ngang nếu quá rộng */
  .nm-product-full-description table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Text trong mô tả: canh đều 2 bên */
  .nm-product-full-description p,
  .nm-product-full-description li,
  .nm-product-full-description h2,
  .nm-product-full-description h3,
  .nm-product-full-description h4 {
    text-align: justify;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Section toàn bộ không overflow */
  .nhuanhatminh-single-product-wrapper section {
    overflow-x: hidden;
  }
}
