/* ═══════════════════════════════════════════
   MATRIX STORE — Modern B2B Ecommerce UI
   ═══════════════════════════════════════════ */

:root {
  --navy:        #0f2044;
  --navy2:       #1a3360;
  --blue:        #1d4ed8;
  --blue-light:  #3b82f6;
  --orange:      #f97316;
  --orange-dark: #ea6c0a;
  --red:         #dc2626;
  --green:       #16a34a;
  --bg:          #f1f5f9;
  --bg2:         #e8edf5;
  --white:       #ffffff;
  --border:      #e2e8f0;
  --border2:     #cbd5e1;
  --text:        #0f172a;
  --text2:       #475569;
  --text3:       #94a3b8;
  --font:        'DM Sans', sans-serif;
  --mono:        'DM Mono', monospace;
  --radius:      10px;
  --radius-sm:   6px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:      0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:   0 16px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --transition:  0.18s cubic-bezier(0.4,0,0.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────── */
header {
  background: var(--navy);
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  z-index: 200;
}

.header-inner {
  max-width: 100%;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo img {
  height: 36px;
}

.logo-text { line-height: 1.1; }

.logo-main {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
}

.logo-sub {
  display: block;
  font-size: 9.5px;
  font-weight: 400;
  color: rgba(255,255,255,0.45);
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-tagline {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.3px;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--orange);
  border: none;
  color: #fff;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.2px;
  box-shadow: 0 2px 8px rgba(249,115,22,0.35);
}

.export-btn:hover {
  background: var(--orange-dark);
  box-shadow: 0 4px 14px rgba(249,115,22,0.45);
  transform: translateY(-1px);
}

.export-btn:active { transform: translateY(0); }

/* ── Layout ──────────────────────────────── */
.wrapper {
  flex: 1;
  overflow: hidden;
  display: flex;
}

/* ── Sidebar (Desktop: vertical left panel) ── */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

.sidebar-label {
  padding: 16px 16px 6px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text3);
  text-transform: uppercase;
}

#sidebar-menu {
  list-style: none;
}

#sidebar-menu > li {
  position: relative;
}

#sidebar-menu > li > a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sidebar-menu > li > a:hover {
  color: var(--blue);
  background: #f0f5ff;
  border-left-color: var(--blue-light);
}

#sidebar-menu > li.active > a {
  color: var(--navy);
  font-weight: 700;
  border-left-color: var(--navy);
  background: #eef2ff;
}

/* Sub-category items (desktop only) */
#sidebar-menu li ul {
  list-style: none;
  background: #fafbff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

#sidebar-menu li ul li a {
  display: block;
  padding: 8px 16px 8px 28px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text3);
  cursor: pointer;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: var(--transition);
}

#sidebar-menu li ul li a:hover {
  color: var(--blue);
  background: #f0f5ff;
  border-left-color: var(--blue-light);
}

#sidebar-menu li ul li.active a {
  color: var(--navy);
  font-weight: 600;
  background: #eef2ff;
  border-left-color: var(--navy);
}

/* ── Main Content ────────────────────────── */
main.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

main.main-content::-webkit-scrollbar { width: 5px; }
main.main-content::-webkit-scrollbar-track { background: transparent; }
main.main-content::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Section ─────────────────────────────── */
.product-section {
  animation: fadeUp 0.3s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
}

.section-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  background: var(--bg2);
  border: 1px solid var(--border2);
  padding: 2px 10px;
  border-radius: 20px;
}

/* ── Product Grid ────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

/* ── Product Card ────────────────────────── */
.product-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.product-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border2);
  transform: translateY(-2px);
}

/* Image area */
.card-img-wrap {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  height: 150px;
  position: relative;
}

.card-img-wrap img {
  max-width: 110px;
  max-height: 110px;
  object-fit: contain;
  transition: transform var(--transition);
}

.product-card:hover .card-img-wrap img {
  transform: scale(1.06);
}

/* Card body */
.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
}

.product-code {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--blue);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.product-name {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.45;
  flex: 1;
}

.product-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.5px;
  margin-top: 2px;
}

.product-price.na {
  font-size: 13px;
  font-weight: 500;
  color: var(--text3);
}

/* MOQ badge */
.moq-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--orange-dark);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 4px;
  padding: 2px 7px;
  width: fit-content;
}

/* Quantity control */
.qty-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.quantity-control {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex: 1;
  transition: border-color var(--transition);
}

.quantity-control:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29,78,216,0.1);
}

.quantity-control button {
  width: 34px;
  height: 34px;
  background: var(--bg);
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 300;
  line-height: 1;
  user-select: none;
}

.quantity-control button:hover {
  background: var(--blue);
  color: #fff;
}

.quantity-control button:active {
  background: var(--navy);
}

.quantity-control input {
  flex: 1;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--white);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  padding: 0;
  height: 34px;
  outline: none;
  min-width: 0;
}

.quantity-control input::-webkit-outer-spin-button,
.quantity-control input::-webkit-inner-spin-button { -webkit-appearance: none; }
.quantity-control input[type=number] { -moz-appearance: textfield; }

/* EOL card */
.product-card.eol {
  opacity: 0.55;
}

.product-card.eol .card-img-wrap {
  background: #f1f5f9;
  filter: grayscale(0.6);
}

/* Badges */
.badge-eol {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 7px;
  border-radius: 4px;
  z-index: 2;
}

.badge-na {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg2);
  color: var(--text3);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
}

/* ── Cart FAB ─────────────────────────────── */
#cart-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: var(--navy);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  color: #fff;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

#cart-fab:hover {
  background: var(--navy2);
  transform: scale(1.06);
  box-shadow: 0 20px 48px rgba(15,32,68,0.4);
}

#cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--orange);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Overlay ─────────────────────────────── */
#cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,32,68,0.4);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 1100;
}

#cart-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Cart Panel ──────────────────────────── */
#selected-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100%;
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1200;
  transition: right 0.32s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.1);
}

#selected-panel.open { right: 0; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--navy);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
}

#panel-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.7);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

#panel-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

#selected-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.empty-bag {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text3);
  font-size: 13px;
}

.empty-bag svg { opacity: 0.25; }

.selected-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
  background: var(--white);
}

.selected-item:hover { border-color: var(--border2); background: #fafcff; }

.selected-item-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.selected-item .sku {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--blue);
  font-weight: 500;
}

.selected-item .name {
  font-size: 12px;
  color: var(--text2);
  margin: 3px 0;
  line-height: 1.4;
}

.selected-item .money {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.selected-item .money .subtotal {
  color: var(--navy);
  font-weight: 700;
}

/* ── Cart Summary ────────────────────────── */
.cart-summary {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  background: #f8fafc;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  color: var(--text2);
  margin-bottom: 10px;
}

.summary-row .val { font-weight: 600; color: var(--text); }
.summary-row.muted { font-size: 12px; color: var(--text3); }

.summary-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.summary-row.total-row {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0;
}

.summary-row.total-row .val {
  font-size: 22px;
  color: var(--orange);
}

/* ═══════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════ */
/* ═══════════════════════════════════════════
   RESPONSIVE — Tablet (max 1024px)
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .sidebar { width: 170px; }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Mobile (max 768px)
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Header ── */
  .header-tagline { display: none; }
  .header-inner   { padding: 0 14px; height: 56px; }
  .logo-main      { font-size: 17px; }
  .logo-sub       { display: none; }
  .logo img       { height: 30px; }
  .export-btn     { padding: 7px 14px; font-size: 12.5px; }

  /* ── Wrapper: stack vertically on mobile ── */
  .wrapper { flex-direction: column; }

  /* ── Sidebar → horizontal scrollable nav bar ── */
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: visible;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
  }

  /* Keep scrollbar visible on mobile */
  .sidebar::-webkit-scrollbar         { height: 4px; width: auto; }
  .sidebar::-webkit-scrollbar-track   { background: var(--bg); }
  .sidebar::-webkit-scrollbar-thumb   { background: var(--border2); border-radius: 2px; }

  .sidebar-label { display: none; }

  #sidebar-menu {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  #sidebar-menu > li { flex-shrink: 0; }

  #sidebar-menu > li > a {
    padding: 11px 14px;
    font-size: 12.5px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  #sidebar-menu > li > a:hover {
    border-left-color: transparent;
    border-bottom-color: var(--blue-light);
  }

  #sidebar-menu > li.active > a {
    border-left-color: transparent;
    border-bottom-color: var(--navy);
  }

  /* Hide sub-category items completely on mobile */
  #sidebar-menu li ul { display: none !important; }

  /* ── Main ── */
  main.main-content { padding: 14px 12px; }

  .section-header { margin-bottom: 14px; padding-bottom: 10px; }
  .section-header h2 { font-size: 18px; }

  /* ── Product Grid — 2 columns ── */
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* ── Product Card ── */
  .card-img-wrap      { height: 110px; padding: 14px; }
  .card-img-wrap img  { max-width: 80px; max-height: 80px; }
  .card-body          { padding: 10px; gap: 5px; }
  .product-code       { font-size: 10px; }
  .product-name       { font-size: 11.5px; }
  .product-price      { font-size: 17px; }
  .product-price.na   { font-size: 12px; }
  .moq-badge          { font-size: 10px; padding: 2px 6px; }

  .quantity-control button { width: 30px; height: 30px; font-size: 16px; }
  .quantity-control input  { height: 30px; font-size: 13px; }

  /* ── Cart Panel ── */
  #selected-panel { width: 100%; right: -100%; }
  .panel-header   { padding: 14px 16px; }
  .cart-summary   { padding: 14px 16px; }
  .summary-row.total-row .val { font-size: 20px; }

  /* ── Cart FAB ── */
  #cart-fab { width: 52px; height: 52px; right: 16px; bottom: 16px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Small Mobile (max 380px)
   ═══════════════════════════════════════════ */
@media (max-width: 380px) {
  .product-grid  { gap: 8px; }
  .card-img-wrap { height: 95px; }
  .card-body     { padding: 8px; }
  .product-price { font-size: 15px; }

  .export-btn svg ~ * { display: none; }
  .export-btn         { padding: 7px 10px; }
}

/* ═══════════════════════════════════════════
   PRODUCT DETAIL PAGE
   ═══════════════════════════════════════════ */
.product-detail {
  animation: fadeUp 0.3s ease both;
}

.detail-back-link {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}

.detail-back-link:hover {
  color: var(--navy);
}

.detail-main {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.detail-gallery {
  flex: 0 1 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-img-main {
  position: relative;
  cursor: zoom-in;
  min-height: 320px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.detail-img-main img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.detail-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-thumb {
  width: 64px;
  height: 64px;
  padding: 6px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition);
}

.detail-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.detail-thumb:hover {
  border-color: var(--border2);
}

.detail-thumb.active {
  border-color: var(--blue);
  border-width: 2px;
}

.detail-info {
  flex: 1 1 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  line-height: 1.3;
}

.detail-description {
  font-size: 13.5px;
  color: var(--text2);
  line-height: 1.6;
  margin: 0;
}

.detail-info .product-price {
  font-size: 26px;
}

.detail-qty {
  max-width: 180px;
  margin-top: 8px;
}

.step-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-top: 4px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--navy);
  background: var(--white);
  border: 1.5px solid var(--border2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.step-download-btn:hover {
  border-color: var(--navy);
}

.step-download-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.step-status {
  font-size: 12.5px;
  min-height: 16px;
}

.step-status.error {
  color: var(--red);
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.specs-table th,
.specs-table td {
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.specs-table tr:last-child th,
.specs-table tr:last-child td {
  border-bottom: none;
}

.specs-table th {
  width: 35%;
  background: var(--bg);
  color: var(--text2);
  font-weight: 600;
}

.specs-table td {
  color: var(--text);
}

.specs-empty {
  color: var(--text3);
  font-style: italic;
  text-align: center;
}

/* ═══════════════════════════════════════════
   IMAGE LIGHTBOX
   ═══════════════════════════════════════════ */

.detail-zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 100px;
  background: rgba(15, 32, 68, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.detail-img-main:hover .detail-zoom-hint { opacity: 1; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(9, 18, 38, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightbox-in 0.16s ease-out;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-stage {
  width: 100%;
  height: 100%;
  padding: 64px 20px 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.14s ease-out;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;      /* we handle pinch/drag ourselves */
}

.lightbox-img.zoomed   { cursor: grab; }
.lightbox-img.dragging { transition: none; cursor: grabbing; }

.lightbox-close,
.lightbox-nav,
.lightbox-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition), border-color var(--transition);
}

.lightbox-close:hover,
.lightbox-nav:hover,
.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 62px;
  border-radius: var(--radius);
  font-size: 30px;
  line-height: 1;
}

.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }

.lightbox-toolbar {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 100px;
  background: rgba(15, 32, 68, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.lightbox-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
}

.lightbox-btn.reset { font-size: 12px; }

.lightbox-zoom,
.lightbox-counter {
  min-width: 52px;
  text-align: center;
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
}

.lightbox-counter {
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 480px) {
  .detail-main      { flex-direction: column; }
  .detail-img-main  { min-height: 220px; }
  .detail-thumb     { width: 52px; height: 52px; }

  .detail-zoom-hint  { opacity: 1; }   /* no hover on touch — always show it */
  .lightbox-stage    { padding: 56px 8px 84px; }
  .lightbox-nav      { width: 34px; height: 52px; font-size: 24px; }
  .lightbox-nav.prev { left: 6px; }
  .lightbox-nav.next { right: 6px; }
  .lightbox-toolbar  { bottom: 14px; gap: 5px; padding: 6px 9px; }
  .lightbox-btn      { min-width: 30px; height: 30px; padding: 0 9px; }
  .lightbox-zoom,
  .lightbox-counter  { min-width: 42px; font-size: 11px; }
}