/* =========================================================
   Deay Bypass — category / products page
   ========================================================= */
.cat { position: relative; min-height: 78vh; padding: 120px 0 80px; overflow: hidden; }
.cat-glow {
  position: absolute; left: 50%; top: -280px; width: 1200px; height: 700px; transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 45% at 50% 40%, rgba(99, 102, 241, .16), transparent 70%);
  pointer-events: none;
}
.cat > .container { position: relative; }

/* breadcrumb */
.crumbs {
  display: flex; align-items: center; gap: 8px; margin-bottom: 18px;
  padding-left: 12px; border-left: 2px solid var(--accent);
  font-size: 14px; color: var(--muted);
  animation: rise .7s ease both;
}
.crumbs a { transition: color .2s; }
.crumbs a:hover { color: #fff; }
.crumb-sep svg { width: 14px; height: 14px; opacity: .6; }
.crumb-current { color: var(--text); font-weight: 600; }

/* panel */
.cat-panel {
  padding: 26px; border-radius: 22px;
  border: 1px solid var(--line); background: linear-gradient(180deg, #111215, #0b0c0e);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  animation: rise .8s .08s ease both;
}
.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; font-size: clamp(22px, 3vw, 28px); font-weight: 700; letter-spacing: -.01em; }
.cat-head svg { width: 26px; height: 26px; color: var(--accent-2); flex: none; }
.cat-head b { font-weight: 700; }

/* category cards */
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cat-card {
  display: block; overflow: hidden; border-radius: 16px;
  border: 1px solid var(--line); background: #0e0f12;
  transition: border-color .3s, transform .3s;
  animation: rise .7s var(--d, 0s) ease both;
}
.cat-card:hover { border-color: var(--line-2); transform: translateY(-4px); }
.cat-cover { position: relative; aspect-ratio: 16 / 7; overflow: hidden; background: #15161a; }
.cat-cover img, .prod-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.cat-card:hover .cat-cover img, .cat-card:hover .gen-cover, .prod:hover .prod-cover img, .prod:hover .gen-cover { transform: scale(1.04); }
.cat-info { padding: 14px 18px 18px; }
.cat-info h2 { font-size: 19px; font-weight: 700; line-height: 1.3; }
.cat-info span { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13.5px; color: var(--muted); }
.cat-info svg { width: 15px; height: 15px; }

/* generated cover art (เมื่อยังไม่มีรูป) */
.gen-cover {
  position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  transition: transform .5s ease;
}
.gen-cover::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 25% 15%, rgba(255, 255, 255, .28), transparent 45%),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, .07) 0 2px, transparent 2px 16px);
}
.gen-cover::after {
  content: ""; position: absolute; right: -12%; bottom: -40%; width: 70%; aspect-ratio: 1;
  border-radius: 50%; border: 18px solid rgba(255, 255, 255, .08);
}
.gc-logo { position: absolute; left: 14px; top: 14px; width: 28px; height: 28px; z-index: 1; }
.gc-name {
  position: relative; z-index: 1; padding: 0 16px; text-align: center;
  font-size: clamp(22px, 3.2vw, 38px); font-weight: 800; line-height: 1.05; letter-spacing: .01em; text-transform: uppercase;
  color: #fff; text-shadow: 0 6px 24px rgba(0, 0, 0, .45);
}
.gc-badge {
  position: absolute; left: 12px; bottom: 12px; z-index: 1;
  padding: 4px 11px; border-radius: 9px;
  background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, .18);
  font-size: 15px; font-weight: 800;
}

/* product cards */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.prod {
  display: flex; flex-direction: column; overflow: hidden; border-radius: 16px;
  border: 1px solid var(--line); background: #0e0f12;
  transition: border-color .3s, transform .3s;
  animation: rise .7s var(--d, 0s) ease both;
}
.prod:hover { border-color: var(--line-2); transform: translateY(-4px); }
.prod-cover { position: relative; aspect-ratio: 1; overflow: hidden; background: #15161a; }
.prod-cover .gc-name { font-size: clamp(20px, 2.4vw, 28px); }
.prod-cover .img-badge { position: absolute; left: 10px; bottom: 10px; }
.prod-body { display: flex; flex-direction: column; flex: 1; padding: 14px; }
.prod-body h3 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 700; line-height: 1.35; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #4ade80; box-shadow: 0 0 8px rgba(74, 222, 128, .7); }
.dot.out { background: #f87171; box-shadow: 0 0 8px rgba(248, 113, 113, .6); }
.prod-meta { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 14px; }
.prod-price { font-size: 17px; font-weight: 700; color: #4ade80; }
.prod-stock { font-size: 12.5px; color: var(--dim); }
.prod .btn { width: 100%; margin-top: auto; padding: 9px 14px; font-size: 14px; }

.prod-cover { display: block; }
.prod-body h3 a { transition: color .2s; }
.prod-body h3 a:hover { color: var(--accent-2); }

/* ---------- Product detail ---------- */
.prod-detail { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 32px; align-items: start; }
.pd-media {
  position: relative; aspect-ratio: 1; overflow: hidden;
  border-radius: 18px; border: 1px solid var(--line); background: #15161a;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.pd-media img { width: 100%; height: 100%; object-fit: cover; }
.pd-media .gc-name { font-size: clamp(30px, 4.4vw, 52px); }
.pd-media .gc-badge { font-size: 18px; left: 16px; bottom: 16px; }
.pd-title { font-size: clamp(26px, 3.4vw, 38px); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.pd-price {
  display: flex; align-items: baseline; gap: 8px; margin-top: 14px;
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: #15161a;
}
.pd-price b { font-size: 28px; font-weight: 700; color: #4ade80; }
.pd-price span { color: var(--muted); font-size: 15px; }
.pd-label { margin-top: 22px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; color: var(--dim); }
.pd-desc { margin-top: 8px; white-space: pre-line; font-size: 15px; line-height: 1.85; color: var(--text-2); }
.pd-desc.muted { color: var(--dim); }
.pd-buy {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px 16px;
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line);
}
.qty { display: inline-flex; align-items: center; overflow: hidden; border-radius: 10px; border: 1px solid var(--line-2); background: #0b0c0f; }
.qty button { width: 40px; height: 42px; font-size: 18px; color: var(--text-2); transition: background .2s; }
.qty button:hover:not(:disabled) { background: #1d1e23; }
.qty button:disabled { opacity: .35; cursor: not-allowed; }
.qty input {
  width: 54px; height: 42px; border: 0; background: none; text-align: center;
  color: var(--text); font: inherit; font-weight: 600; -moz-appearance: textfield; appearance: textfield;
}
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: none; }
.pd-stock { font-size: 13px; color: var(--dim); }
.pd-total { text-align: right; }
.pd-total small { display: block; font-size: 12px; color: var(--dim); }
.pd-total b { font-size: 26px; font-weight: 700; color: #4ade80; }
.pd-buy .btn { grid-column: 1 / -1; width: 100%; }
.pd-video { margin-top: 26px; animation: rise .8s .15s ease both; }
.pd-video h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 19px; font-weight: 700; }
.pd-video h2 svg { width: 22px; height: 22px; color: var(--accent-2); }
.pd-video-frame { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 16px; border: 1px solid var(--line); background: #000; }
.pd-video-frame iframe, .pd-video-frame video { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- Confirm purchase modal ---------- */
.buy-modal {
  position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fadeIn .2s ease;
}
.buy-modal[hidden] { display: none; }
.buy-card {
  width: min(520px, 100%); overflow: hidden; border-radius: 18px;
  border: 1px solid var(--line-2); background: #111215;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65);
  animation: popIn .3s cubic-bezier(.2, .8, .2, 1);
}
.buy-card h2 { padding: 18px 22px; border-bottom: 1px solid var(--line); text-align: center; font-size: 20px; font-weight: 700; }
.buy-body { padding: 16px 22px 18px; }
.buy-table { width: 100%; }
.buy-table th { padding: 8px; border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 500; color: var(--muted); text-align: center; }
.buy-table td { padding: 14px 8px; text-align: center; font-weight: 600; }
.buy-table td:first-child { text-align: left; }
.buy-table th:first-child { text-align: left; }
.buy-total { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.buy-total span { font-size: 20px; font-weight: 700; }
.buy-total b { font-size: 30px; font-weight: 700; color: #4ade80; }
.buy-accept { display: flex; align-items: center; gap: 9px; margin-top: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.buy-accept input { width: 17px; height: 17px; accent-color: var(--accent); }
.buy-accept a { color: var(--accent-2); font-weight: 600; }
.buy-accept a:hover { text-decoration: underline; }
.buy-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
.buy-actions .btn { width: 100%; padding: 11px 14px; }
.buy-next p { font-size: 14px; line-height: 1.75; color: var(--muted); }
.buy-next textarea {
  width: 100%; margin-top: 12px; padding: 12px; border-radius: 10px; resize: none;
  border: 1px solid var(--line-2); background: #0b0c0f; color: var(--text);
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
}
.buy-copy { margin-top: 10px; }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

.cat-empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.cat-empty a { display: inline-block; margin-top: 12px; color: var(--accent-2); font-weight: 600; }
.cat-empty a:hover { text-decoration: underline; }

@media (max-width: 860px) {
  .prod-detail { grid-template-columns: 1fr; gap: 22px; }
  .pd-media { max-width: 460px; }
}
@media (max-width: 760px) {
  .cat { padding-top: 100px; }
  .pd-buy { grid-template-columns: auto 1fr; }
  .pd-total { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; text-align: left; }
  .cat-panel { padding: 18px; border-radius: 18px; }
  .cat-grid { grid-template-columns: 1fr; }
  .prod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .prod-body { padding: 12px; }
  .prod-body h3 { font-size: 14px; }
}
@media (max-width: 380px) {
  .prod-grid { grid-template-columns: 1fr; }
}
