/* ═══════════════════════════════════════════════════════════════════════
   GiFanatix Configurator — Frame Overlay Stylesheet
   Full-screen overlay frame (FPD lightbox pattern).
   All classes prefixed .gfx- to avoid theme collisions.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Custom font faces (self-hosted) ──────────────────────────────── */
@font-face {
  font-family: 'GFX Segoe Black';
  src: url('../fonts/segoe-ui-black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'GFX Old English';
  src: url('../fonts/oldenglishtextmt.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'GFX Street Breaker';
  src: url('../fonts/street-breaker.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

/* ── "Customize It" button on WC product page ─────────────────────── */

.gfx-customize-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 14px 24px;
  margin: 12px 0;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #c8102e 0%, #a00d24 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.25s, transform 0.15s, box-shadow 0.25s;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.35);
}

.gfx-customize-btn:hover {
  background: linear-gradient(135deg, #e01535 0%, #c8102e 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(200, 16, 46, 0.45);
}

.gfx-customize-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(200, 16, 46, 0.3);
}

/* ── Theme isolation boundary ─────────────────────────────────────── */

.gfx-frame {
  all: initial;
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  flex-direction: column;
  background: #ffffff;
  color: #1a1a1a;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  box-sizing: border-box;
}

.gfx-frame *,
.gfx-frame *::before,
.gfx-frame *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.gfx-frame.gfx-frame-visible {
  display: flex;
}

body.gfx-frame-open {
  overflow: hidden !important;
}

/* ── FRAME HEADER ─────────────────────────────────────────────────── */

.gfx-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: #f4f4f8;
  border-bottom: 1px solid #e0e0e8;
  flex-shrink: 0;
}

.gfx-logo {
  font-size: 18px;
  font-weight: 800;
  color: #1a1a1a;
  letter-spacing: 1px;
}

.gfx-logo span {
  color: #c8102e;
}

.gfx-breadcrumb {
  flex: 1;
  font-size: 13px;
  color: #777;
}

/* ── Tour "How it works" button ───────────────────────────────────── */

.gfx-tour-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: none;
  border: 1px solid #c8102e;
  color: #c8102e;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.gfx-tour-btn:hover {
  background: #c8102e;
  color: #fff;
}

.gfx-tour-btn svg {
  flex-shrink: 0;
}

/* ── Driver.js overrides: must sit above the frame (z-index 999999) ── */

.driver-overlay,
#driver-highlighted-element-stage {
  z-index: 1000000 !important;
}

.driver-popover {
  z-index: 1000001 !important;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22) !important;
  max-width: 320px !important;
}

.driver-popover-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #1a1a1a !important;
  margin-bottom: 6px !important;
}

.driver-popover-description {
  font-size: 13px !important;
  color: #444 !important;
  line-height: 1.55 !important;
}

.driver-popover-footer button {
  font-size: 12px !important;
  border-radius: 6px !important;
}

.driver-popover-footer .driver-popover-next-btn {
  background: #c8102e !important;
  border-color: #c8102e !important;
  color: #fff !important;
}

.driver-popover-footer .driver-popover-next-btn:hover {
  background: #a00d24 !important;
  border-color: #a00d24 !important;
}

.driver-popover-progress-text {
  font-size: 11px !important;
  color: #999 !important;
}

.gfx-header-close {
  background: none;
  border: 1px solid #444;
  color: #666;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.gfx-header-close:hover {
  background: #c8102e;
  color: #fff;
  border-color: #c8102e;
}

/* ── FRAME BODY + LAYOUT ──────────────────────────────────────────── */

.gfx-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.gfx-layout {
  display: flex;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100%;
}

/* ══════════════════════════════════════════════════════════════════════
   LEFT: DESIGNER PANEL (spec §3.1)
   ══════════════════════════════════════════════════════════════════════ */

.gfx-designer-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Product Tabs (Tier 1 — spec §3.2) ────────────────────────────── */

.gfx-product-tabs {
  display: flex;
  gap: 6px;
}

.gfx-product-tab {
  flex: 1;
  padding: 10px 6px;
  border: 1px solid #d8d8e8;
  border-radius: 8px;
  background: #eeeef8;
  color: #666;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.gfx-product-tab:hover {
  background: #e8e8f5;
  color: #1a1a1a;
}

.gfx-product-tab.gfx-active {
  background: #c8102e;
  color: #fff;
  border-color: #c8102e;
}

.gfx-product-tab.gfx-locked {
  opacity: 0.65;
  cursor: pointer;
}

.gfx-lock-icon {
  font-size: 11px;
  margin-left: 2px;
}

/* ── View Tabs (Tier 2 — spec §3.3) ──────────────────────────────── */

.gfx-view-tabs {
  display: flex;
  gap: 4px;
}

.gfx-view-tab {
  flex: 1;
  padding: 7px 4px;
  border: 1px solid #d8d8ec;
  border-radius: 6px;
  background: transparent;
  color: #777;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.gfx-view-tab:hover {
  color: #444;
  background: #eeeef8;
}

.gfx-view-tab.gfx-active {
  color: #c8102e;
  background: #eeeef8;
  border-color: #c8102e;
}

/* ── Canvas Area (spec §3.4) ──────────────────────────────────────── */

.gfx-canvas-area {
  position: relative;
  background: #f8f8fc;
  border: 1px solid #dcdcec;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 520px;
}

/* Product wrap — one per product+view combo (9 total) */
.gfx-product-wrap {
  position: relative;
  width: 500px;
  height: 780px;
  display: block;
}

.gfx-product-wrap.gfx-view-hidden {
  display: none;
}

/* ── Fabric canvas — main interactive layer ─────────────────────── */

.gfx-fabric-canvas {
  display: block;
  width: 500px !important;
  height: 780px !important;
}

/* The <canvas> element inside the wrapper (inserted by Fabric) */
.gfx-product-wrap canvas {
  display: block;
}

/* ── Legacy layers (img + zone divs) — hidden once Fabric is ready ─ */
.gfx-legacy-layer {
  display: none !important;
}

.gfx-product-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
}

/* ── Canvas toolbar (delete / undo / redo) ──────────────────────── */

.gfx-canvas-toolbar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(26,26,26,0.88);
  border-radius: 8px;
  margin-bottom: 8px;
  backdrop-filter: blur(6px);
}

.gfx-canvas-toolbar.gfx-tb-visible {
  display: flex;
}

.gfx-tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.gfx-tb-btn:hover {
  background: rgba(255,255,255,0.18);
}

#gfx-tb-delete:hover {
  background: rgba(200,16,46,0.7);
  border-color: #c8102e;
}

.gfx-tb-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-left: 6px;
  white-space: nowrap;
}

/* ── Fabric.js control handle overrides ─────────────────────────── */
/* The upper canvas (interaction layer) Fabric creates */
.gfx-product-wrap .upper-canvas {
  cursor: crosshair;
}

.canvas-container {
  position: relative !important;
}

.gfx-canvas-hint {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: #888;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════════
   ZONE OVERLAY SYSTEM (spec §3.5)
   ══════════════════════════════════════════════════════════════════════ */

.gfx-zone {
  position: absolute;
  border: 2px dashed rgba(224, 26, 26, 0.85);
  background: rgba(220, 30, 30, 0.06);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 2;
}

/* Zone rotation is now set per-zone in the admin Edit Zone panel (css_rotation column).
   The CSS overlay divs use inline style set by the template; no hardcoded rules needed here. */

/* Hover state */
.gfx-zone:hover {
  background: rgba(220, 30, 30, 0.16);
  border-color: rgba(224, 26, 26, 1);
  z-index: 10;
}

/* Required zone — solid red border (spec §3.5 table) */
.gfx-zone.gfx-required {
  border-style: solid;
  border-color: rgba(224, 26, 26, 0.9);
  background: rgba(220, 30, 30, 0.09);
}

/* Filled zone — green (spec §3.5 table) */
.gfx-zone.gfx-filled {
  border: 2px solid rgba(0, 200, 83, 0.7);
  background: rgba(0, 200, 83, 0.08);
}

/* Active zone — blue glow (spec §3.5 table) */
.gfx-zone.gfx-active {
  border: 2px solid rgba(33, 150, 243, 0.8);
  background: rgba(33, 150, 243, 0.1);
  box-shadow: 0 0 12px rgba(33, 150, 243, 0.35);
  z-index: 5;
}

/* ── Zone Number Badges (spec §3.6) ───────────────────────────────── */

.gfx-zone-num {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c8102e;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 3;
}

/* Required zones show ★ */
.gfx-zone.gfx-required .gfx-zone-num {
  font-size: 9px;
}

/* Required zones get a micro star ::after (spec §3.6) */
.gfx-zone.gfx-required .gfx-zone-num::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  background: #ffeb3b;
  border-radius: 50%;
}

/* Filled zones — badge turns green (spec §3.6) */
.gfx-zone.gfx-filled .gfx-zone-num {
  background: #00c853;
}

/* ── Zone Tooltip (spec §3.5) ─────────────────────────────────────── */

.gfx-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #eeeef8;
  color: #333;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 20;
  border: 1px solid #d8d8e8;
}

.gfx-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #e0e0f0;
}

.gfx-zone:hover .gfx-tooltip {
  opacity: 1;
}

/* ── Zone Inner Content (spec §3.5 — #zone-display-{ID}) ─────────── */

.gfx-zone-inner {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Text preview inside zone */
.gfx-zone-text-preview {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: inline-block;
}

/* ══════════════════════════════════════════════════════════════════════
   ZONE POSITION CLASSES — 19 zones (spec §3.5 table)
   All use percentage coordinates: top / left / width / height
   ══════════════════════════════════════════════════════════════════════ */

/* Shirt Front */
.gfx-sf1 { top: 26%; left: 10%; width: 26%; height: 18%; }
.gfx-sf2 { top: 26%; left: 60%; width: 26%; height: 18%; }
.gfx-sf3 { top: 81%; left: 6%;  width: 85%; height: 10%; }

/* Shirt Right */
.gfx-sr1 { top: 28%; left: 10%; width: 40%; height: 32%; }

/* Shirt Left */
.gfx-sl1 { top: 20%; left: 48%; width: 40%; height: 32%; }

/* Shirt Back */
.gfx-sb1 { top: 10%; left: 10%; width: 75%; height: 12%; }
.gfx-sb2 { top: 24%; left: 8%;  width: 80%; height: 32%; }
.gfx-sb3 { top: 77%; left: 4%;  width: 90%; height: 11%; }

/* Pant Front */
.gfx-pf1 { top: 12%; left: 6%;  width: 38%; height: 26%; }
.gfx-pf2 { top: 12%; left: 54%; width: 38%; height: 26%; }
.gfx-pf3 { top: 60%; left: 4%;  width: 38%; height: 26%; }
.gfx-pf4 { top: 60%; left: 56%; width: 38%; height: 26%; }

/* Pant Right */
.gfx-pr1 { top: 24%; left: 28%; width: 42%; height: 46%; }

/* Pant Left */
.gfx-pl1 { top: 24%; left: 24%; width: 42%; height: 46%; }

/* Pant Back */
.gfx-pb1 { top: 5%;  left: 8%;  width: 82%; height: 18%; }
.gfx-pb2 { top: 72%; left: 4%;  width: 38%; height: 18%; }
.gfx-pb3 { top: 72%; left: 56%; width: 38%; height: 18%; }

/* Belt */
.gfx-bl1 { top: 52%; left: 4%;  width: 88%; height: 22%; }
.gfx-bl2 { top: 12%; left: 4%;  width: 88%; height: 22%; }

/* ══════════════════════════════════════════════════════════════════════
   RIGHT: CONTROL PANEL
   ══════════════════════════════════════════════════════════════════════ */

.gfx-control-panel {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Product info header */
.gfx-product-info {
  background: #f8f8fc;
  border: 1px solid #dcdcec;
  border-radius: 10px;
  padding: 16px;
}

.gfx-product-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
}

.gfx-product-subtitle {
  font-size: 12px;
  color: #777;
  margin-top: 2px;
}

.gfx-product-price {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 800;
  color: #c8102e;
}

/* Section cards */
.gfx-section-card {
  background: #f8f8fc;
  border: 1px solid #dcdcec;
  border-radius: 10px;
  overflow: hidden;
}

.gfx-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f0f0f8;
  border-bottom: 1px solid #e0e0e8;
}

.gfx-section-badge {
  font-size: 11px;
  font-weight: 600;
  color: #777;
  background: #eeeef8;
  padding: 2px 8px;
  border-radius: 10px;
}

.gfx-section-body {
  padding: 12px 16px;
}

/* ── Size Selector ────────────────────────────────────────────────── */

.gfx-size-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gfx-size-btn {
  padding: 8px 14px;
  border: 1px solid #d8d8e8;
  border-radius: 6px;
  background: #eeeef8;
  color: #666;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.gfx-size-btn:hover {
  border-color: #444;
  color: #444;
}

.gfx-size-btn.gfx-selected {
  background: #c8102e;
  border-color: #c8102e;
  color: #fff;
}

/* ── Gi Color Selector ────────────────────────────────────────────── */

.gfx-gi-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gfx-gi-color-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #333;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.gfx-gi-color-btn:hover {
  transform: scale(1.1);
}

.gfx-gi-color-btn.gfx-selected {
  border-color: #c8102e;
  box-shadow: 0 0 8px rgba(200, 16, 46, 0.4);
}

.gfx-gi-color-label {
  font-size: 9px;
  color: #777;
  text-align: center;
  margin-top: 2px;
}

/* ── Zone Editor ──────────────────────────────────────────────────── */

.gfx-zone-editor {
  background: #f8f8fc;
  border: 1px solid #dcdcec;
  border-radius: 10px;
  overflow: hidden;
  display: none;
}

.gfx-zone-editor.gfx-visible {
  display: block;
}

.gfx-zone-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f0f0f8;
  border-bottom: 1px solid #e0e0e8;
  font-size: 13px;
  font-weight: 700;
  color: #333;
}

.gfx-zone-editor-close {
  background: none;
  border: none;
  color: #777;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s;
}

.gfx-zone-editor-close:hover {
  color: #c8102e;
}

/* Option tabs inside editor */
.gfx-option-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e0e0e8;
}

.gfx-option-tab {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: #f0f0f8;
  color: #777;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.gfx-option-tab:hover {
  color: #444;
}

.gfx-option-tab.gfx-active {
  background: #e8e8f5;
  color: #c8102e;
  border-bottom: 2px solid #c8102e;
}

.gfx-zone-editor-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Confirm / Clear buttons */
.gfx-confirm-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #00c853;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.gfx-confirm-btn:hover {
  background: #00a844;
}

.gfx-clear-btn {
  width: 100%;
  padding: 8px;
  margin-top: 8px;
  border: 1px solid #555;
  border-radius: 8px;
  background: transparent;
  color: #666;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}

.gfx-clear-btn:hover {
  background: #c8102e;
  color: #fff;
  border-color: #c8102e;
}

/* Form labels */
.gfx-label {
  font-size: 12px;
  font-weight: 600;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: block;
  margin-bottom: 6px;
}

/* Text input */
.gfx-text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8d8e8;
  border-radius: 8px;
  background: #ffffff;
  color: #1a1a1a;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.gfx-text-input:focus {
  border-color: #c8102e;
}

/* Upload button */
.gfx-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
  border: 2px dashed #b0b0cc;
  border-radius: 10px;
  background: #f4f4f8;
  color: #777;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.gfx-upload-btn:hover {
  border-color: #c8102e;
  color: #c8102e;
}

/* Thread-color dots */
.gfx-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gfx-color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.gfx-color-dot:hover {
  transform: scale(1.15);
}

.gfx-color-dot.gfx-selected {
  border-color: #c8102e;
  box-shadow: 0 0 6px rgba(200, 16, 46, 0.4);
}

.gfx-color-dot.gfx-c-white.gfx-selected { border-color: #777; }

/* Font buttons */
.gfx-font-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gfx-font-btn {
  padding: 6px 12px;
  border: 1px solid #d8d8e8;
  border-radius: 6px;
  background: #eeeef8;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.gfx-font-btn:hover {
  border-color: #444;
  color: #444;
}

.gfx-font-btn.gfx-selected {
  border-color: #c8102e;
  color: #c8102e;
  background: #fdf0f3;
}

/* Design grid */
.gfx-design-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.gfx-design-item {
  border: 2px solid #d0d0e0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  padding: 6px;
  transition: border-color 0.2s;
  position: relative;
  background: #eeeef8;
}

.gfx-design-item img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.gfx-design-item:hover {
  border-color: #444;
}

.gfx-design-item.gfx-selected {
  border-color: #00c853;
}

.gfx-design-item.gfx-selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  background: #00c853;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Text live-preview */
.gfx-text-live-preview {
  font-size: 12px;
  color: #777;
  padding: 8px 0;
  border-top: 1px solid #222;
  margin-top: 6px;
}

.gfx-text-live-preview strong {
  display: inline-block;
  letter-spacing: 0.5px;
}

/* ── Add-on Toggles ───────────────────────────────────────────────── */

.gfx-addon-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.gfx-addon-row + .gfx-addon-row {
  border-top: 1px solid #e0e0f0;
}

.gfx-addon-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  background: #333;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.25s;
}

.gfx-addon-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #888;
  transition: transform 0.25s, background 0.25s;
}

.gfx-addon-toggle.gfx-on {
  background: #c8102e;
}

.gfx-addon-toggle.gfx-on::after {
  transform: translateX(20px);
  background: #fff;
}

.gfx-addon-info {
  flex: 1;
}

.gfx-addon-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.gfx-addon-price {
  font-size: 12px;
  color: #c8102e;
  font-weight: 600;
}

/* ── Progress ─────────────────────────────────────────────────────── */

.gfx-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #777;
  margin-bottom: 6px;
}

.gfx-progress-bar {
  height: 6px;
  background: #222;
  border-radius: 3px;
  overflow: hidden;
}

.gfx-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #c8102e, #00c853);
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}

/* ── Checklist ────────────────────────────────────────────────────── */

.gfx-zone-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.gfx-zone-group-label {
  font-size: 11px;
  font-weight: 700;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 0 2px;
}

.gfx-zone-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.gfx-zone-item:hover {
  background: #eeeef8;
}

.gfx-zone-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Icon colours by type */
.gfx-design-type   { background: #f3ecff; color: #7c3aed; }
.gfx-text-type     { background: #e8f4fd; color: #1976d2; }
.gfx-upload-type   { background: #e8f5e9; color: #2e7d32; }
.gfx-multi-type    { background: #fce4ec; color: #c2185b; }

.gfx-zone-name {
  flex: 1;
  font-size: 12px;
  color: #333;
}

.gfx-zone-status {
  font-size: 10px;
  font-weight: 600;
  color: #444;
}

.gfx-zone-status.gfx-done {
  color: #00c853;
}

.gfx-zone-status.gfx-required-tag {
  color: #c8102e;
}

.gfx-zone-item.gfx-done .gfx-zone-name {
  color: #a0a0a0;
}

.gfx-zone-item.gfx-done {
  border-left: 3px solid #00c853;
}

.gfx-zone-item.gfx-required-item {
  border-left: 3px solid #c8102e;
}

.gfx-zone-item.gfx-required-item .gfx-zone-name {
  font-weight: 600;
}

/* ── Price Breakdown ──────────────────────────────────────────────── */

.gfx-price-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gfx-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
  color: #444;
}

.gfx-price-row.gfx-included .gfx-price-amount {
  color: #00c853;
  font-weight: 600;
}

.gfx-price-label {
  flex: 1;
}

.gfx-price-amount {
  font-weight: 600;
  white-space: nowrap;
}

.gfx-price-row.gfx-total-row {
  border-top: 1px solid #d8d8e8;
  padding-top: 8px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
}

/* ── Order Preview ────────────────────────────────────────────────── */

.gfx-order-preview {
  font-size: 12px;
}

.gfx-order-preview-title {
  font-size: 11px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.gfx-order-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #e0e0f0;
}

.gfx-order-key {
  color: #777;
  font-weight: 600;
}

.gfx-order-val {
  color: #333;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Cart Button ──────────────────────────────────────────────────── */

.gfx-add-to-cart {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #c8102e 0%, #a00d24 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, opacity 0.2s;
  font-family: inherit;
}

.gfx-add-to-cart:hover:not(:disabled) {
  background: linear-gradient(135deg, #e01535 0%, #c8102e 100%);
}

.gfx-add-to-cart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gfx-add-to-cart svg {
  flex-shrink: 0;
}

.gfx-cart-hint {
  text-align: center;
  font-size: 11px;
  color: #777;
  min-height: 16px;
}

/* ── Scrollbar ────────────────────────────────────────────────────── */

.gfx-body::-webkit-scrollbar {
  width: 6px;
}

.gfx-body::-webkit-scrollbar-track {
  background: #ffffff;
}

.gfx-body::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.gfx-control-panel::-webkit-scrollbar {
  width: 4px;
}

.gfx-control-panel::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤ 768px)
   ══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .gfx-layout {
    flex-direction: column;
  }

  .gfx-control-panel {
    width: 100%;
  }

  .gfx-product-wrap {
    width: 100%;
    height: auto;
    max-height: 420px;
  }

  .gfx-canvas-area {
    min-height: auto;
  }

  /* Larger touch targets */
  .gfx-product-tab,
  .gfx-view-tab {
    min-height: 44px;
  }

  .gfx-size-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .gfx-gi-color-btn {
    width: 44px;
    height: 44px;
  }

  .gfx-design-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gfx-addon-toggle {
    width: 50px;
    height: 28px;
  }

  .gfx-addon-toggle::after {
    width: 22px;
    height: 22px;
  }

  .gfx-addon-toggle.gfx-on::after {
    transform: translateX(22px);
  }

  /* Sticky cart button on mobile */
  .gfx-add-to-cart {
    position: sticky;
    bottom: 0;
    z-index: 10;
  }

  /* Prevent iOS zoom on inputs */
  .gfx-text-input {
    font-size: 16px;
  }

  .gfx-confirm-btn {
    min-height: 44px;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — PHONE (≤ 480px)
   ══════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .gfx-body {
    padding: 8px;
  }

  .gfx-layout {
    gap: 12px;
  }

  .gfx-product-wrap {
    max-height: 360px;
  }

  .gfx-section-body {
    padding: 10px 12px;
  }

  .gfx-header {
    padding: 8px 12px;
  }

  .gfx-breadcrumb {
    font-size: 11px;
  }

  .gfx-text-input {
    padding: 8px 10px;
  }

  .gfx-upload-btn {
    padding: 10px;
    font-size: 12px;
  }
}

/* ── Design Picker — category grid ─────────────────────────────────────── */
.gfx-design-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.gfx-refresh-designs-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 7px;
  color: #555;
  transition: color 0.2s, border-color 0.2s;
  line-height: 1;
}
.gfx-refresh-designs-btn:hover { color: #1a1a1a; border-color: #888; }

.gfx-design-name {
  display: block;
  font-size: 10px;
  color: #555;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.gfx-no-designs {
  text-align: center;
  padding: 24px 12px;
  color: #888;
  font-size: 13px;
  line-height: 1.6;
  border: 1px dashed #ccc;
  border-radius: 8px;
  margin-bottom: 12px;
}
.gfx-no-designs strong { color: #444; }

/* Taller grid cells so design thumbnails breathe */
.gfx-design-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gfx-design-item img {
  width: 100%;
  height: 68px;
  object-fit: contain;
  display: block;
}
