/* ==========================================================================
   Modern Product Page Async CSS - Misaki1987 Custom (Complete & Fixed)
   Features:
     1. Micro Review Header Link
     2. Anime Button & Trust Badges
     3. Two-Column Lower Layout
     4. PC Sticky & Mobile 2-Col "Customers Also Viewed" (Cover/Center Crop)
     5. 100% Full-width FAQ Accordion
     6. Personalized Recommendation Grid (Show More Support)
     7. Lightbox & Cart Modal
   ========================================================================== */

/* --- 1. 顶部微型评价条交互特效 --- */
.rating-review-link {
  transition: color 0.2s ease !important;
}
.rating-review-link:hover {
  color: var(--moe, #cc0066) !important;
  text-decoration: underline !important;
}

/* --- 2. 提问/收藏与信任徽章特效 --- */
.anime-link {
  background: #fff !important;
  border: 2px solid #4a148c !important;
  border-radius: 8px !important;
  text-decoration: none !important;
  box-shadow: 3px 3px 0px #cc0066 !important;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  white-space: nowrap !important;
}
.anime-link span {
  font-size: 12px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px;
}
.ask-link { color: #4a148c !important; border-color: #4a148c !important; }
.ask-link svg { stroke: #4a148c !important; flex-shrink: 0; }
.wishlist-link { color: #cc0066 !important; border-color: #4a148c !important; }
.wishlist-link svg { stroke: #cc0066 !important; flex-shrink: 0; }
.anime-link:hover {
  transform: translateY(-2px) !important;
  box-shadow: 4px 4px 0px #4a148c !important;
  background-color: #fff !important;
}
.anime-link:active {
  transform: translateY(1px) !important;
  box-shadow: 2px 2px 0px #4a148c !important;
}

.trust-badges-container {
  background-color: #fdfdfd;
}
.trust-item {
  text-align: center;
  transition: transform 0.3s ease;
}
.trust-icon {
  background: #fff;
  border: 1px solid #ffe6f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}
.trust-icon svg {
  width: 22px;
  height: 22px;
  transition: all 0.3s ease;
}
.trust-item span {
  display: block;
  font-size: 11px;
  color: #555;
  font-weight: 500;
  white-space: nowrap;
}
.trust-item:hover {
  transform: translateY(-3px);
}
.trust-item:hover .trust-icon {
  background-color: #cc0066;
  border-color: #cc0066;
  box-shadow: 0 4px 12px rgba(204, 0, 102, 0.2);
}
.trust-item:hover svg {
  stroke: #ffffff !important;
}

/* --- 3. 下半部流式排版框架 --- */
.product-lower-wrapper {
  width: 100%;
  margin-top: 30px;
  border-top: 1px solid #eee;
  padding-top: 30px;
  display: flex;
  gap: 30px;
  align-items: flex-start;
}
.lower-main-content {
  flex: 1;
  min-width: 0;
}
.lower-main-content div[class*="-container"],
.lower-main-content #productDescription {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin-bottom: 20px;
  border-left: 4px solid var(--moe, #cc0066);
  padding-left: 10px;
}

/* --- 4. Customers Also Viewed 侧边栏（PC 端基准） --- */
.lower-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  background: #fff;
  border: 1.5px solid #eee;
  border-radius: 12px;
  padding: 16px 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  box-sizing: border-box;
}
.sidebar-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--purple-primary, #4a148c);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #f5f5f5;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}
.sidebar-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--moe, #cc0066);
  border-radius: 2px;
  display: inline-block;
}
.side-viewed-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
}
.side-viewed-list::-webkit-scrollbar {
  display: none;
}
.side-viewed-item {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none !important;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
  border: 1px solid #f0f0f0;
  background: #fafafa;
  flex-shrink: 0;
}
.side-viewed-item:hover {
  background: #faf8fd;
  border-color: #eee4f7;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* PC 端侧栏固定 68x90 视口：方图自动裁去左右两边 */
.side-img-box {
  width: 68px;
  height: 90px;
  max-width: 68px;
  flex: 0 0 68px;
  border-radius: 6px;
  overflow: hidden;
  background: #fbfbfb;
  position: relative;
}
.side-img-box img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;             /* 核心：等比填满，裁去两侧 */
  object-position: center top !important;   /* 居中偏上对齐，保留人物面部 */
  display: block !important;
}
.side-meta-box {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.side-meta-name {
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  color: #333;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.side-viewed-item:hover .side-meta-name {
  color: var(--purple-primary, #4a148c);
}
.side-meta-price {
  font-size: 13px;
  font-weight: 800;
  color: var(--moe, #cc0066);
}
.btn-side-scroll {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.95);
  border: 1.5px solid #eee;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: all 0.2s;
  outline: none;
  padding: 0;
}
.btn-side-scroll svg {
  width: 16px;
  height: 16px;
  stroke: var(--purple-primary, #4a148c);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.btn-side-scroll:hover {
  background: var(--moe, #cc0066);
  border-color: var(--moe, #cc0066);
}
.btn-side-scroll:hover svg {
  stroke: #fff;
}
.btn-side-scroll.nav-up { top: 48px; }
.btn-side-scroll.nav-down { bottom: 6px; }
.btn-sidebar-more { display: none; }

/* --- 5. 100% 满宽 FAQ 模块 --- */
.faq-full-container {
  margin-top: 35px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}
.faq-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.faq-header-bar .section-title {
  margin-bottom: 0;
}
.link-light-review {
  font-size: 13px;
  color: #888;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.link-light-review:hover {
  color: var(--moe, #cc0066);
  text-decoration: underline;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-item {
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.faq-toggle {
  display: none;
}
.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  cursor: pointer;
  font-weight: 600;
  color: #444;
  font-size: 14px;
  transition: 0.2s;
  user-select: none;
}
.faq-question:hover {
  background: #fdfdfd;
  color: var(--moe, #cc0066);
}
.faq-question .icon {
  font-size: 20px;
  font-weight: normal;
  color: #ccc;
  transition: 0.3s;
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.faq-answer p {
  padding: 15px;
  margin: 0;
  color: #666;
  font-size: 13px;
  line-height: 1.6;
  border-top: 1px solid #f9f9f9;
}
.faq-toggle:checked + .faq-question + .faq-answer {
  max-height: 500px;
}
.faq-toggle:checked + .faq-question .icon {
  transform: rotate(45deg);
  color: var(--moe, #cc0066);
}

/* --- 6. 16 款个性化推荐网格与 Show More --- */
.history-recommend-wrapper {
  margin-top: 45px;
  padding-top: 25px;
  border-top: 2px solid #f5f5f5;
  text-align: center;
}
.recommend-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin: 20px 0;
  text-align: left;
}
.recommend-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none !important;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.recommend-card:hover {
  transform: translateY(-3px);
  border-color: #eeddf2;
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

/* 推荐商品卡片图片视口：裁去方图两侧 */
.card-img-wrap {
  width: 100%;
  aspect-ratio: 0.76 / 1;
  background: #fbfbfb;
  overflow: hidden;
  position: relative;
}
.card-img-wrap img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;             /* 核心：等比填满，裁去两侧 */
  object-position: center top !important;   /* 居中偏上对齐 */
  display: block !important;
}
.card-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price {
  font-size: 14px;
  font-weight: 800;
  color: var(--moe, #cc0066);
}

.recommend-item-hidden {
  display: none !important;
}
.fade-in {
  animation: fadeIn 0.3s ease-in-out forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-recommend-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  background: #fdf2f7;
  color: var(--moe, #cc0066);
  border: 1.5px solid var(--moe, #cc0066);
  border-radius: 25px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s ease;
  margin: 10px auto;
  outline: none;
}
.btn-recommend-more:hover {
  background: var(--moe, #cc0066);
  color: #fff;
  box-shadow: 0 4px 12px rgba(204,0,102,0.25);
}

/* --- 7. 画廊弹窗与加购弹窗 --- */
.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999999;
  display: none;
  align-items: center;
  justify-content: center;
}
.custom-modal.active {
  display: flex;
}
.modal-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(5px);
}
.modal-content-wrapper {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000000;
}
#modalFullImage {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(0,0,0,0.5);
  object-fit: contain;
}
.modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: #fff;
  cursor: pointer;
  z-index: 10002;
  width: 30px;
  height: 30px;
}
.nav-btn {
  background: transparent;
  border: none;
  color: white;
  padding: 20px;
  cursor: pointer;
  z-index: 10001;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.nav-btn.prev { left: -60px; }
.nav-btn.next { right: -60px; }
.nav-btn svg { width: 40px; height: 40px; stroke-width: 3; }
.nav-btn:hover { color: var(--moe, #cc0066); }

.add-cart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.add-cart-modal.active {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background: #fff;
  width: 90%;
  max-width: 400px;
  padding: 30px 20px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.add-cart-modal.active .modal-content {
  transform: scale(1);
}
.modal-icon {
  margin-bottom: 15px;
  color: var(--moe, #cc0066);
}
.modal-content h3 {
  margin: 0 0 10px;
  color: #333;
  font-size: 22px;
}
.modal-content p {
  color: #666;
  font-size: 14px;
  margin: 0 0 25px;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-checkout {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--moe, #cc0066);
  color: #fff !important;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 16px;
  transition: background 0.2s;
  box-sizing: border-box;
}
.btn-checkout:hover {
  background: #a30052;
}
.btn-continue {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid #ddd;
  color: #666;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-continue:hover {
  border-color: #999;
  color: #333;
  background: #f9f9f9;
}

/* ==========================================================================
   8. 核心响应式断点（重点修复移动端侧边栏）
   ========================================================================== */
@media (max-width: 991px) {
  .product-lower-wrapper {
    flex-direction: column !important;
    gap: 30px !important;
  }
  
  .lower-sidebar {
    width: 100% !important;
    position: static !important;
    box-sizing: border-box !important;
    padding: 16px 12px !important;
  }
  
  .btn-side-scroll {
    display: none !important;
  }

  /* 移动端双列网格 */
  .side-viewed-list {
    max-height: none !important;
    overflow-y: visible !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    padding: 0 !important;
  }
  
  .side-viewed-item.mobile-hidden {
    display: none !important;
  }

  /* ★ 修复：移动端卡片变成标准的电商纵向小卡片 ★ */
  .side-viewed-item {
    display: flex !important;
    flex-direction: column !important;
    background: #fff !important;
    padding: 0 !important;              /* 移除内边距，使图片完全顶格饱满 */
    border: 1px solid #eee !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    gap: 0 !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
  }
  .side-viewed-item:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06) !important;
  }

  /* ★ 修复：图片视口铺满宽度，方图自动裁去左右两边 ★ */
  .side-img-box {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    flex: none !important;
    aspect-ratio: 0.76 / 1 !important;  /* 抱枕竖长比例 */
    background: #fbfbfb !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    position: relative !important;
  }

  /* 强制图片撑满卡片上半部分，居中裁切 */
  .side-img-box img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: cover !important;             /* 核心：铺满视口，切除方图左右留白 */
    object-position: center top !important;   /* 居中偏上，展示立绘面部与上半身 */
    display: block !important;
  }

  /* 独立文字容器，保证信息紧凑规整 */
  .side-meta-box {
    padding: 10px 8px !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .side-meta-name {
    font-size: 12px !important;
    line-height: 1.35 !important;
    color: #333 !important;
    margin-bottom: 6px !important;
    height: 32px !important;                   /* 锁定两行文字高度，卡片整齐划一 */
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .side-meta-price {
    font-size: 13px !important;
    font-weight: 800 !important;
    color: var(--moe, #cc0066) !important;
  }

  /* 移动端 Show More 胶囊按钮 */
  .btn-sidebar-more {
    display: block !important;
    width: 100% !important;
    margin-top: 15px !important;
    padding: 10px 0 !important;
    background: #fdf2f7 !important;
    color: var(--moe, #cc0066) !important;
    border: 1.5px solid var(--moe, #cc0066) !important;
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    text-align: center !important;
    text-transform: uppercase !important;
    transition: all 0.2s !important;
  }
  .btn-sidebar-more:hover {
    background: var(--moe, #cc0066) !important;
    color: #fff !important;
  }
}

@media (max-width: 768px) {
  .recommend-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .card-info {
    padding: 8px !important;
  }
  .card-name {
    font-size: 12px !important;
  }
  .nav-btn {
    padding: 10px !important;
  }
  .nav-btn.prev { left: -10px !important; }
  .nav-btn.next { right: -10px !important; }
  .trust-badges-container {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important; /* 单行横排 4 个，高度立刻压缩 60% */
    gap: 6px !important;
    padding: 12px 6px !important;
    margin: 15px 0 !important;
    background: #faf8fb !important; /* 浅淡柔和底色，增加整体区块感 */
    border: 1px solid #f0e6f2 !important;
    border-radius: 8px !important;
  }

  .trust-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    gap: 4px !important;
  }

  .trust-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border: 1px solid #eeddf0 !important;
    background: #fff !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 5px rgba(204, 0, 102, 0.05) !important;
  }

  .trust-icon svg {
    width: 16px !important;
    height: 16px !important;
  }

  .trust-item span {
    font-size: 10px !important;
    font-weight: 700 !important;
    color: #444 !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    transform: scale(0.95); /* 稍微收紧微调 */
  }
}

@media (max-width: 480px) {
  .action-links-container {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .anime-link {
    height: 36px !important;
    padding: 0 4px !important;
  }
  .anime-link span {
    font-size: 11px !important;
  }
  .anime-link svg {
    width: 15px !important;
    height: 15px !important;
  }
}