/* BUG #48 fix (2026-05-08): customer-side visually-hidden helper.
   styles-customer.css 沒有這個 class (只有 admin styles.css 有 .is-visually-hidden).
   Phase B #2 SSR 用 <span class="is-visually-hidden">正在載入商品...</span>
   給 screen reader, customer page 必須自帶這個 rule, 否則文字直接顯示在 skeleton 上. */
.is-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* store-skeleton.css — Phase B #2 (2026-05-08)
 *
 * 骨架屏 (skeleton loading) 給商品詳情頁 + 收藏夾.
 * 商城首頁 (`/store`) 和 `/m/store` 的 store-card-v2--skeleton 已經在
 * styles-customer.css 內. 這檔補另外 2 處沒覆蓋到的.
 *
 * Trigger:
 *   - /store/item/:id 初始 SSR HTML <div class="store-detail-skeleton">
 *     在 store-item.js fetch /api/items/:id 完之前顯示
 *   - /profile/wishlist 初始 grid 用 .dp-wishlist-card--skeleton 6 張
 *     在 fetch /api/me/watchlist 完之前顯示
 */

@keyframes store-skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================================================
 * 商品詳情頁 骨架 (/store/item/:id)
 * ============================================================================ */

.store-detail-skeleton {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 32px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .store-detail-skeleton {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 12px;
  }
}

.store-detail-skeleton__gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.store-detail-skeleton__main-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: store-skeleton-shimmer 1.4s linear infinite;
}

.store-detail-skeleton__thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.store-detail-skeleton__thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: store-skeleton-shimmer 1.4s linear infinite;
}

.store-detail-skeleton__info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.store-detail-skeleton__line {
  height: 16px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: store-skeleton-shimmer 1.4s linear infinite;
}

.store-detail-skeleton__line--title {
  height: 28px;
  width: 80%;
}

.store-detail-skeleton__line--price {
  height: 36px;
  width: 50%;
  margin-top: 8px;
}

.store-detail-skeleton__line--short { width: 40%; }
.store-detail-skeleton__line--medium { width: 65%; }
.store-detail-skeleton__line--long { width: 90%; }

.store-detail-skeleton__btn {
  height: 48px;
  width: 100%;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(56, 189, 248, 0.10) 25%,
    rgba(56, 189, 248, 0.20) 50%,
    rgba(56, 189, 248, 0.10) 75%
  );
  background-size: 200% 100%;
  animation: store-skeleton-shimmer 1.4s linear infinite;
  margin-top: 12px;
}

/* ============================================================================
 * 收藏夾卡片 骨架 (/profile/wishlist)
 * ============================================================================ */

.dp-wishlist-card--skeleton {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.dp-wishlist-card--skeleton::before {
  content: "";
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: store-skeleton-shimmer 1.4s linear infinite;
}

.dp-wishlist-card--skeleton .dp-wishlist-card__skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: store-skeleton-shimmer 1.4s linear infinite;
}

.dp-wishlist-card--skeleton .dp-wishlist-card__skeleton-line--short { width: 50%; }
.dp-wishlist-card--skeleton .dp-wishlist-card__skeleton-line--medium { width: 80%; }

/* Phase B #9 (2026-05-08): respect prefers-reduced-motion — kill shimmer */
@media (prefers-reduced-motion: reduce) {
  .store-detail-skeleton__main-img,
  .store-detail-skeleton__thumb,
  .store-detail-skeleton__line,
  .store-detail-skeleton__btn,
  .dp-wishlist-card--skeleton::before,
  .dp-wishlist-card--skeleton .dp-wishlist-card__skeleton-line {
    animation: none;
    background: rgba(255, 255, 255, 0.06);
  }
}

/* ============================================================================
 * Phase D #5 (2026-05-08): 您可能還喜歡推薦商品 grid
 * 用 store-skeleton.css 因為已經 link 在 /store/item/:id (避免再開新 file)
 * ============================================================================ */

.dp-item-related {
  margin-top: 32px;
  padding: 24px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(116, 245, 255, 0.10);
}

.dp-item-related__loading {
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  padding: 24px;
}

.dp-item-related__title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
  color: #f0fdff;
  letter-spacing: 0.02em;
}

.dp-item-related__grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1024px) {
  .dp-item-related__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .dp-item-related__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .dp-item-related { padding: 16px 12px; }
}
@media (max-width: 420px) {
  .dp-item-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.dp-item-related__card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
}

.dp-item-related__card:hover,
.dp-item-related__card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(116, 245, 255, 0.45);
  background: rgba(34, 211, 238, 0.08);
  outline: none;
}

.dp-item-related__media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.dp-item-related__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dp-item-related__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.dp-item-related__body {
  padding: 10px 12px 12px;
}

.dp-item-related__title {
  font-size: 13px;
  line-height: 1.35;
  color: #f0fdff;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
  letter-spacing: 0;
}

.dp-item-related__price {
  font-size: 14px;
  font-weight: 700;
  color: #22d3ee;
  letter-spacing: 0;
}

@media (prefers-reduced-motion: reduce) {
  .dp-item-related__card { transition: none; }
}
