/* ============================================================
   PRODUCT DETAIL (product-detail.php)
   Gallery + zoom, info panel, tabs, sticky mobile bar.
   ============================================================ */

.detail-page { padding-bottom: 8px; }
.detail-page .breadcrumb.dark { padding: 16px 0 12px; font-size: .82rem; }
.detail-page .breadcrumb.dark [aria-current] { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.detail-layout { display: grid; gap: 24px; margin-bottom: 40px; }

/* ---------- gallery ---------- */
.gallery { min-width: 0; }
.gallery-main {
  position: relative; overflow: hidden; aspect-ratio: 1; cursor: zoom-in;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
}
.gallery-main img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s var(--ease);
  will-change: transform;
}
.gallery-main.zooming img { transform: scale(2); transition: transform .2s ease-out; }
.gallery-main img.swap { animation: gallerySwap .45s var(--ease); }
@keyframes gallerySwap { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
.gallery-main .discount { top: 14px; left: 14px; font-size: .8rem; padding: 5px 11px; }
.zoom-hint {
  position: absolute; right: 12px; bottom: 12px; z-index: 1; display: none; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: .75rem; font-weight: 600; color: var(--primary-deep);
  background: rgba(255,255,255,.92); border-radius: 999px; box-shadow: var(--shadow-sm); pointer-events: none;
  transition: opacity .25s;
}
.gallery-main.zooming .zoom-hint { opacity: 0; }
@media (hover: hover) and (pointer: fine) { .zoom-hint { display: inline-flex; } }

.gallery-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.gallery-thumb {
  position: relative; display: block; padding: 0; overflow: hidden; aspect-ratio: 1;
  background: var(--bg-soft); border: 2px solid var(--line); border-radius: var(--radius-m);
  transition: border-color .25s, transform .3s var(--ease), box-shadow .3s;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease), opacity .25s; opacity: .78; }
.gallery-thumb:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.gallery-thumb:hover img { transform: scale(1.08); opacity: 1; }
.gallery-thumb.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8,152,204,.2); }
.gallery-thumb.is-active img { opacity: 1; }

/* ---------- info panel ---------- */
.detail-info { min-width: 0; }
.category-tag {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; margin-bottom: 12px;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--primary-dark); background: var(--primary-light); border-radius: 999px;
  transition: background .2s, color .2s;
}
.category-tag:hover { background: var(--primary-btn); color: #fff; }
.detail-title { font-size: clamp(1.55rem, 5.5vw, 2.3rem); margin-bottom: 6px; color: var(--brand-navy); }
.detail-sku { margin-bottom: 18px; font-size: .9rem; color: var(--ink-soft); }
.detail-sku strong { color: var(--ink); }

.detail-price-box {
  position: relative; overflow: hidden; margin-bottom: 14px; padding: 16px 18px;
  background: var(--primary-tint);
  border: 1px solid #B5E3F3; border-radius: var(--radius-m);
}
.detail-price-box::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent); }
.price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.detail-price { font-family: var(--font-head); font-weight: 800; font-size: 2rem; line-height: 1.1; color: var(--brand-navy); }
.detail-price-box .old-price { font-size: 1.05rem; }
.save-tag { padding: 3px 10px; font-size: .78rem; font-weight: 700; color: #fff; background: var(--accent-strong); border-radius: 6px; }
.tax-note { display: block; margin-top: 6px; font-size: .82rem; color: var(--ink-soft); }

.stock-status { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 6px 14px; font-size: .88rem; font-weight: 700; border-radius: 999px; }
.stock-status .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.stock-status.in  { color: var(--ok); background: var(--ok-tint); }
.stock-status.in .dot { animation: pulse 2s infinite; }
.stock-status.low { color: var(--warn); background: var(--warn-tint); }
.stock-status.out { color: var(--accent-strong); background: var(--accent-tint); }
.detail-short { margin-bottom: 20px; color: var(--ink-soft); }

.purchase-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.qty-selector {
  display: inline-flex; align-items: stretch; height: 54px; overflow: hidden;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-s);
  transition: border-color .2s, box-shadow .2s;
}
.qty-selector:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(8,152,204,.16); }
.qty-selector button {
  display: grid; place-items: center; width: 46px; border: 0; background: var(--bg-soft); color: var(--primary-dark);
  transition: background .2s, color .2s;
}
.qty-selector button:hover:not(:disabled) { background: var(--primary-btn); color: #fff; }
.qty-selector button:disabled { color: var(--ink-faint); cursor: not-allowed; opacity: .6; }
.qty-selector input {
  width: 56px; padding: 0; text-align: center; font: inherit; font-size: 1.05rem; font-weight: 700; color: var(--ink);
  border: 0; border-inline: 1.5px solid var(--line); background: #fff; -moz-appearance: textfield; appearance: textfield;
}
.qty-selector input:focus { outline: none; }
.qty-selector input::-webkit-outer-spin-button, .qty-selector input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.purchase-row .add-main { flex: 1 1 180px; min-height: 54px; }

.btn.pulse { animation: addPulse .5s var(--ease); }
@keyframes addPulse { 0% { transform: scale(1); } 35% { transform: scale(.95); } 70% { transform: scale(1.04); } 100% { transform: scale(1); } }

.detail-actions-secondary { display: grid; gap: 10px; margin-bottom: 20px; }
.detail-perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.detail-perk {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; text-align: center;
  font-size: .76rem; font-weight: 600; line-height: 1.3; color: var(--ink-soft);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-m);
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.detail-perk .icon { color: var(--primary); transition: transform .35s var(--ease); }
.detail-perk:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--shadow-md); }
.detail-perk:hover .icon { transform: scale(1.15) rotate(-6deg); }

/* ---------- tabs ---------- */
.tabs-panel { margin-bottom: 48px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; box-shadow: var(--shadow-sm); }
.tab-buttons { display: flex; overflow-x: auto; scrollbar-width: none; background: var(--bg-soft); border-bottom: 1px solid var(--line); }
.tab-buttons::-webkit-scrollbar { display: none; }
.tab-button {
  position: relative; flex: 0 0 auto; min-height: 52px; padding: 0 20px; border: 0; background: transparent;
  font-weight: 700; font-size: .92rem; color: var(--ink-soft); white-space: nowrap;
  transition: color .2s, background .2s;
}
.tab-button::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: var(--primary); transform: scaleX(0); transition: transform .3s var(--ease);
}
.tab-button:hover { color: var(--primary-dark); background: var(--primary-tint); }
.tab-button.is-active { color: var(--brand-navy); background: #fff; }
.tab-button.is-active::after { transform: scaleX(1); }
.tab-pane { display: none; padding: 22px 18px; color: var(--ink-soft); }
.tab-pane.is-active { display: block; animation: rise .45s var(--ease) both; }
.tab-pane p:last-child { margin-bottom: 0; }
.text-link { color: var(--primary-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.spec-table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.spec-table th, .spec-table td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }
.spec-table tr:nth-child(odd) { background: var(--bg-soft); }
.spec-table th { width: 40%; font-weight: 700; color: var(--brand-navy); }
.spec-table td { color: var(--ink-soft); overflow-wrap: anywhere; }

/* ---------- related ---------- */
.related { margin-bottom: 24px; }
.related .section-heading { align-items: flex-start; }
.related .section-heading h2 { font-size: clamp(1.3rem, 4vw, 1.8rem); }

/* ---------- not found ---------- */
.notfound { margin: 40px 0 24px; }
.notfound-title { font-size: clamp(1.5rem, 5vw, 2rem); margin-bottom: 8px; }
.notfound-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; }

/* ---------- sticky mobile action bar ---------- */
.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.97); border-top: 1px solid var(--line);
  box-shadow: 0 -10px 28px rgba(3,75,105,.14);
  animation: stickyUp .5s var(--ease) both;
}
@keyframes stickyUp { from { transform: translateY(100%); } to { transform: none; } }
.sticky-price { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sticky-label { font-size: .72rem; font-weight: 600; color: var(--ink-faint); }
.sticky-price strong { font-family: var(--font-head); font-size: 1.35rem; color: var(--brand-navy); }
.sticky-bar .btn { flex: 1; max-width: 240px; min-height: 48px; }

/* ---------- >= 640px ---------- */
@media (min-width: 640px) {
  .detail-actions-secondary { grid-template-columns: 1fr 1fr; }
  .detail-perk { flex-direction: row; justify-content: center; text-align: left; font-size: .82rem; padding: 14px 10px; }
  .tab-pane { padding: 28px 30px; }
  .tab-button { padding: 0 28px; }
}

/* ---------- >= 960px ---------- */
@media (min-width: 960px) {
  .detail-layout { grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); gap: 48px; margin-bottom: 56px; align-items: start; }
  .gallery { position: sticky; top: 150px; }
  .sticky-bar { display: none; }
  .gallery-thumbs { gap: 14px; }
}
