/* Product Detail Page Styles - CSP Compliant */

/* Product Action Buttons - Material Design 3 Compliant (40px minimum) */
/* ✅ FIXED: Đảm bảo tuân thủ rule Material Design 3 - Touch targets >= 40px */
.product-action-btn,
.add-to-cart-btn,
.buy-now-btn {
  min-height: var(--touch-target-min) !important;
  /* 44px từ variables.css - cao hơn yêu cầu tối thiểu 40px của Material Design 3 */
  height: var(--touch-target-min) !important;
  /* Fixed height for consistency - đảm bảo tuân thủ rule */
  box-sizing: border-box !important;
  /* Đảm bảo border và padding được tính vào chiều cao */
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  /* Đảm bảo nội dung được căn giữa */
}

/* Plan Tooltip Positioning - CSP Compliant */
.plan-tooltip-positioned {
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
}

/* Plan Cards Grid - Responsive Layout */
.plan-cards-grid {
  display: grid;
}

/* Mobile: 2 plan trên 1 hàng */
@media (max-width: 639px) {
  .plan-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet: 3 plan trên 1 hàng */
@media (min-width: 640px) and (max-width: 1023px) {
  .plan-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop: 3 plan trên 1 hàng */
@media (min-width: 1024px) {
  .plan-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Plan Card Compact Styles - Uniform sizing */
.plan-card-label {
  height: 100%;
  will-change: transform;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: var(--z-index-base);
}

.plan-card-label:hover {
  z-index: var(--z-index-notifications) !important;
}

.plan-card-label:hover .plan-tooltip {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateX(-50%) translateY(0) !important;
  z-index: var(--z-index-notifications) !important;
}

.plan-card-content {
  min-height: 120px;
  height: 100%;
}

/* Grid auto-rows for equal height */
@supports (grid-auto-rows: 1fr) {
  .auto-rows-fr {
    grid-auto-rows: 1fr;
  }
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* ========================================================================
   TRUST BADGES - Infinite marquee scroll (mô phỏng partner logos block)
   Modes: Scroll animation | Static (via data-badge-scroll attribute)
   ======================================================================== */

/* Badge item base */
.trust-badge {
  box-sizing: border-box;
  height: var(--touch-target-min) !important;
  min-height: var(--touch-target-min) !important;
  display: flex;
  align-items: center;
}

/* Track - Full-width container với overflow hidden + gradient fade */
.trust-badges-track {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 0.375rem 0;
}

/* Gradient fade tại 2 mép — tạo hiệu ứng "vô tận" */
.trust-badges-track::before,
.trust-badges-track::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  z-index: 2;
  pointer-events: none;
}

.trust-badges-track::before {
  left: 0;
  background: linear-gradient(to right, #fff, transparent);
}

.trust-badges-track::after {
  right: 0;
  background: linear-gradient(to left, #fff, transparent);
}

/* Scroll inner container */
.trust-badges-scroll {
  display: flex;
  gap: 16px;
  width: max-content;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Keyframes — scroll tới 33.333% vì có 3 group duplicate */
@keyframes badge-scroll-left {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-33.333333%);
  }
}

/* Animation class */
.animate-badge-scroll-left {
  animation: badge-scroll-left 25s linear infinite;
}

/* Speed variants */
.duration-badge-slow {
  animation-duration: 40s;
}

.duration-badge-normal {
  animation-duration: 25s;
}

.duration-badge-fast {
  animation-duration: 15s;
}

/* Pause on hover */
.trust-badges-track:hover .trust-badges-scroll {
  animation-play-state: paused;
}

/* Static mode: data-badge-scroll="false" — tắt animation, hiển thị centered */
.trust-badges-track[data-badge-scroll="false"] {
  overflow: visible;
  padding: 0.375rem 1rem;
}

.trust-badges-track[data-badge-scroll="false"]::before,
.trust-badges-track[data-badge-scroll="false"]::after {
  display: none;
}

.trust-badges-track[data-badge-scroll="false"] .trust-badges-scroll {
  animation: none !important;
  width: auto;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Static mode: ẩn badge thứ 7+ và duplicate groups */
.trust-badges-track[data-badge-scroll="false"] .badge-scroll-only {
  display: none !important;
}

/* Accessibility - Tắt animation khi user ưu tiên giảm chuyển động */
@media (prefers-reduced-motion: reduce) {
  .trust-badges-scroll {
    animation: none !important;
  }

  .trust-badges-track {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .trust-badges-track::-webkit-scrollbar {
    display: none;
  }
}

/* Mobile responsive: badge nhỏ hơn */
@media (max-width: 639px) {
  .trust-badges-scroll {
    gap: 10px;
  }

  .trust-badge {
    padding: 0.375rem 0.625rem !important;
  }

  .trust-badge span {
    font-size: 0.75rem !important;
    line-height: 1rem !important;
  }

  .trust-badge svg {
    width: 1rem !important;
    height: 1rem !important;
  }

  .trust-badges-track::before,
  .trust-badges-track::after {
    width: 30px;
  }
}

/* Tablet responsive */
@media (min-width: 640px) and (max-width: 1023px) {
  .trust-badges-scroll {
    gap: 14px;
  }

  .trust-badge span {
    font-size: 0.8125rem !important;
    line-height: 1.125rem !important;
  }

  .trust-badge svg {
    width: 1.125rem !important;
    height: 1.125rem !important;
  }

  .trust-badges-track::before,
  .trust-badges-track::after {
    width: 50px;
  }
}

/* Product Detail Tabs - Premium Design */
.tabs-header {
  border-radius: 0;
}

.tab-btn {
  padding: 0.625rem 1.75rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: var(--font-size-base);
  transition: all 0.25s ease;
  color: var(--text-primary, #1a1a1a);
  background: #ffffff;
  border: 1.5px solid #e0e0e0;
  position: relative;
  white-space: nowrap;
  cursor: pointer;
  letter-spacing: 0.01em;
}

.tab-btn.active {
  color: var(--primary-color, #3b82f6);
  font-weight: 600;
  background: #ffffff;
  border-color: var(--primary-color, #3b82f6);
  box-shadow: none;
}

.tab-btn:hover:not(.active) {
  background: #fafafa;
  border-color: #bdbdbd;
  box-shadow: none;
}

/* Tab Mobile Responsive - CHỈ áp dụng trên mobile (< 640px) */
@media (max-width: 639px) {

  .tabs-header.mobile-tabs-header,
  .tabs-header {
    padding: 0.5rem 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
  }

  .tab-list-container.mobile-tab-list,
  .tab-list-container {
    gap: 0.5rem !important;
    justify-content: flex-start !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
    overflow-x: visible !important;
    flex-wrap: nowrap !important;
    width: 100%;
  }

  .tab-btn {
    padding: 0.5rem 0.375rem !important;
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    position: relative;
    color: var(--text-primary, #1a1a1a) !important;
    font-size: var(--font-size-sm) !important;
    line-height: 1.25rem !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap;
    margin: 0 !important;
    flex-shrink: 0;
  }

  .tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    border-radius: 3px 3px 0 0;
    transition: background 0.3s ease;
  }

  .tab-btn.active {
    color: var(--primary-hover) !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-weight: 700 !important;
  }

  .tab-btn.active::after {
    background: var(--primary-hover) !important;
  }

  .tab-btn:hover:not(.active) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-primary) !important;
  }
}

/* Desktop (>= 640px): Giữ nguyên style cũ */
@media (min-width: 640px) {
  .tab-list-container {
    gap: 30px;
  }

  .tab-btn::after {
    display: none !important;
  }
}

.tab-badge {
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
}

/* Tabs Content */
.tabs-content-wrapper {
  min-height: 400px;
  list-style: none !important;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in;
  list-style: none !important;
}

.tab-content.active {
  display: block;
  list-style: none !important;
}

/* Product Introduction Content - StreamField Styling */
.product-introduction-content {
  max-width: none;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  color: var(--text-primary);
}

.product-introduction-content h1,
.product-introduction-content h2,
.product-introduction-content h3 {
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.product-introduction-content h2 {
  font-size: var(--font-size-h3);
}

.product-introduction-content h3 {
  font-size: var(--font-size-h4);
}

.product-introduction-content p {
  color: var(--text-primary);
  line-height: var(--line-height-relaxed);
  margin-bottom: 1rem;
}

/* IMPORTANT: Remove bullets from StreamField block containers */
.product-introduction-content>div,
.product-introduction-content>* {
  list-style: none !important;
  list-style-type: none !important;
  display: block !important;
}

/* Only add list styles for actual ul/ol elements with .richtext or inside richtext content */
.product-introduction-content .richtext ul,
.product-introduction-content [data-block-key] ul {
  margin-bottom: 1rem;
  margin-left: 1.5rem;
  list-style-type: disc;
}

.product-introduction-content .richtext ol,
.product-introduction-content [data-block-key] ol {
  margin-bottom: 1rem;
  margin-left: 1.5rem;
  list-style-type: decimal;
}

.product-introduction-content .richtext li,
.product-introduction-content [data-block-key] li {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  display: list-item;
}

.product-introduction-content img {
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin: 1rem 0;
}

.product-introduction-content blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 1rem;
  font-style: italic;
  margin: 1rem 0;
  color: var(--text-secondary);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Better shadow for selected cards */
.peer:checked~.plan-card-content {
  box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.3), 0 10px 10px -5px rgba(59, 130, 246, 0.2);
}

/* Tooltip - Z-index cao để không bị đè bởi các plan khác */
.plan-tooltip {
  z-index: var(--z-index-notifications) !important;
  position: absolute !important;
}

/* Responsive Tooltip */
@media (max-width: 1023px) {
  .plan-tooltip {
    max-width: 280px;
  }
}

/* ========================================================================
   REVIEW COMPONENTS — CSP-compliant styles (extracted from inline styles)
   ======================================================================== */

/* Reviews list container */
.reviews-list-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Review card */
.review-card {
  padding: 1.5rem;
  border-radius: 16px;
}

/* Review header */
.review-header {
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Verified purchase badge */
.verified-badge {
  color: #16a34a !important;
}

/* Star colors */
.review-stars,
.review-star-filled {
  color: #facc15 !important;
}

.review-star-empty {
  color: #d1d5db;
}

/* Rating big display */
.rating-star-big-filled {
  font-size: 2rem;
  color: #facc15 !important;
}

.rating-star-big-empty {
  font-size: 2rem;
  color: #d1d5db;
}

.rating-score-big {
  font-size: 2.5rem;
  color: #000000;
}

/* Review title */
.review-title {
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 0.5rem;
  font-size: 1.0625rem;
}

/* Review content */
.review-content {
  color: #64748b;
  line-height: 1.7;
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

/* Rating bar via <progress> (no inline style width) */
.rating-bar-progress {
  width: 100%;
  height: 10px;
  border: 0;
  border-radius: 9999px;
  overflow: hidden;
  background-color: #e5e7eb;
  appearance: none;
  -webkit-appearance: none;
}

.rating-bar-progress::-webkit-progress-bar {
  background-color: #e5e7eb;
  border-radius: 9999px;
}

.rating-bar-progress::-webkit-progress-value {
  background: linear-gradient(to right, #facc15, #eab308);
  border-radius: 9999px;
  transition: width 0.5s ease;
}

.rating-bar-progress::-moz-progress-bar {
  background: linear-gradient(to right, #facc15, #eab308);
  border-radius: 9999px;
  transition: width 0.5s ease;
}

/* Recommendation box */
.recommendation-box {
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.1) 0%, rgba(22, 163, 74, 0.15) 100%);
  color: #16a34a;
  font-weight: 700;
  font-size: 0.875rem;
  white-space: nowrap;
}

/* Write review button override — consistent green */
.btn-write-review {
  color: #ffffff !important;
  font-weight: 600 !important;
  background: #16a34a !important;
}

.btn-write-review span {
  color: #ffffff !important;
  font-weight: 600 !important;
}

.btn-write-review *,
.btn-write-review::before,
.btn-write-review::after {
  color: #ffffff !important;
}

.btn-write-review:hover {
  color: #ffffff !important;
  background: #15803d !important;
}

.btn-write-review:hover *,
.btn-write-review:hover span {
  color: #ffffff !important;
}

.btn-write-review-gradient {
  color: #ffffff !important;
  font-weight: 600 !important;
  background: linear-gradient(to right, #16a34a, #15803d) !important;
}

.btn-write-review-gradient span {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Submit button green */
.btn-submit-green {
  background: #16a34a !important;
}

/* Reviews layout grid */
.reviews-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

/* Pagination: uses unified-pagination from cms-common.css */

/* Reply button hover */
.reply-btn:hover {
  border-color: #16a34a !important;
  color: #16a34a !important;
}

/* Avatar styles */
.reviewer-avatar-wrapper {
  position: relative;
  width: 48px;
  height: 48px;
}

.reviewer-avatar-img {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
}

.reviewer-avatar-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  display: flex !important;
}

.reviewer-avatar-img.hidden {
  display: none !important;
}

/* Rating select overlay */
.review-rating-select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 20rem;
}

.review-rating-select {
  color: #000000;
  background-color: white;
  position: relative;
  z-index: 2;
}

.review-rating-select-wrapper:has(.review-rating-overlay[style*="flex"]) .review-rating-select,
.review-rating-select-wrapper:not(:has(.review-rating-overlay[style*="none"])) .review-rating-select:not([value=""]) {
  color: transparent;
}

.review-rating-select option {
  color: #000000;
}

.review-rating-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  padding-left: 0.75rem;
  padding-right: 2.5rem;
  font-size: 0.875rem;
}

.review-rating-overlay .stars {
  color: #facc15;
}

/* ========================================================================
   REVIEW RESPONSIVE — Mobile / Tablet / Desktop
   ======================================================================== */

/* Mobile: 1 column, sidebar on top */
@media (max-width: 639px) {
  .reviews-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .product-reviews-content {
    padding: 1rem !important;
  }

  .rating-summary-sidebar {
    order: -1;
  }

  .rating-summary-sidebar>div {
    position: static !important;
    padding: 1rem !important;
  }

  .rating-big {
    margin-bottom: 1rem !important;
  }

  .rating-big .flex.items-center {
    flex-direction: row !important;
    gap: 0.5rem !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
  }

  .rating-big span.text-6xl {
    font-size: 1.75rem !important;
  }

  .rating-big .text-3xl {
    font-size: 1.5rem !important;
  }

  .rating-bars {
    margin-bottom: 1rem !important;
  }

  .rating-bar-row {
    margin-bottom: 0.75rem !important;
    gap: 0.375rem !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    min-width: 0 !important;
  }

  .rating-bar-label {
    width: auto !important;
    min-width: 2.5rem !important;
    font-size: 0.7rem !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .rating-bar-progress {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .rating-bar-percent {
    width: auto !important;
    min-width: 2rem !important;
    font-size: 0.65rem !important;
    flex-shrink: 0 !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  .review-card {
    padding: 1rem !important;
  }

  .review-header {
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }

  .review-header .flex-1 {
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .reviewer-name {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    align-items: center !important;
    word-break: break-word !important;
  }

  .reviewer-name span.font-bold {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  .verified-badge {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .review-images {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }

  .review-images img {
    height: 80px !important;
  }

  #review-form-container {
    padding: 1rem !important;
  }

  #review-form-section {
    margin-top: 1.5rem !important;
    padding-top: 1rem !important;
  }

  .like-btn,
  .reply-btn {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem !important;
  }

  .review-title {
    font-size: 1rem !important;
  }

  .review-content {
    font-size: 0.875rem !important;
    line-height: 1.6 !important;
  }

  .product-reviews-content>div:first-child h3 {
    font-size: 1.25rem !important;
  }

  #review-count-badge {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.5rem !important;
  }
}

/* Tablet: 1 column, compact sidebar */
@media (min-width: 640px) and (max-width: 1023px) {
  .reviews-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .rating-summary-sidebar {
    order: -1;
  }

  .rating-summary-sidebar>div {
    position: static !important;
    max-width: 500px;
    margin: 0 auto;
  }

  .review-card {
    padding: 1.25rem !important;
  }

  .review-images {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* Desktop: 2 columns (sidebar + reviews) */
@media (min-width: 1024px) {
  .reviews-layout {
    grid-template-columns: 300px 1fr !important;
  }
}
