/* ==========================================================================
   LXY Metal Crafts — 3D Online Coin & Medal Designer Styles
   ========================================================================== */

.designer-hero {
  background: var(--bg-muted);
  color: var(--navy-900);
  padding: 32px 0 30px;
  border-bottom: 1px solid var(--border-light);
}

.designer-hero-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.designer-hero h1 {
  color: var(--navy-900);
  font-size: clamp(2rem, 3.2vw, 2.75rem);
  font-weight: 500;
  margin-bottom: 6px;
}

.designer-hero p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  max-width: 62ch;
}

.designer-upload-btn {
  white-space: normal;
  text-align: center;
  max-width: 100%;
}

.designer-workspace {
  padding: 28px 0 64px;
}

.designer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 460px);
  gap: 28px;
  align-items: start;
}

/* Left Stage Panel */
.stage-card {
  position: sticky;
  top: 88px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.stage-segmented {
  display: inline-flex;
  background: var(--bg-muted);
  padding: 2px;
  border-radius: var(--radius-sm);
  gap: 2px;
}

.stage-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.stage-seg-btn.active {
  background: var(--bg-surface);
  color: var(--navy-900);
}

.stage-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.stage-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--navy-800);
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.stage-icon-btn:hover {
  border-color: var(--gold-500);
  background: var(--gold-100);
}

.stage-icon-btn.active {
  background: var(--navy-900);
  color: #FFFFFF;
  border-color: var(--navy-900);
}

.stage-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 440px;
  background: radial-gradient(circle at 52% 40%, #1D2536 0%, #0E131D 66%, #080B12 100%);
  overflow: hidden;
  user-select: none;
}

.stage-viewport canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
}

.stage-viewport canvas:active {
  cursor: grabbing;
}

.stage-2d-wrap {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 28px;
  background: radial-gradient(circle at 50% 45%, #1E293B 0%, #0F172A 100%);
}

.stage-2d-wrap.visible {
  display: flex;
}

.stage-2d-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.stage-2d-item span {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-on-dark-muted);
}

.stage-2d-preview {
  width: min(260px, 38vw);
  height: min(260px, 38vw);
  border-radius: 50%;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.12);
}

.stage-overlay-hint {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: rgba(18, 23, 34, 0.78);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #CBD5E1;
  font-size: 0.74rem;
  pointer-events: none;
}

.stage-side-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: rgba(18, 23, 34, 0.82);
  border: 1px solid rgba(212, 188, 140, 0.35);
  color: var(--gold-400);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

.stage-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.88);
  color: #E2E8F0;
  font-size: 0.88rem;
  z-index: 5;
}

.stage-footer {
  padding: 14px 18px;
  background: var(--bg-page);
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-specs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.stage-specs-bar strong {
  color: var(--navy-900);
}

.stage-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--gold-100);
  border: 1px solid var(--gold-200);
  color: var(--navy-900);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* Right Controls Panel */
.controls-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.controls-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-page);
}

.ctrl-tab {
  border: none;
  background: transparent;
  padding: 13px 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.ctrl-tab:hover {
  color: var(--navy-900);
}

.ctrl-tab.active {
  color: var(--navy-900);
  background: var(--bg-surface);
  border-bottom-color: var(--gold-500);
}

.controls-body {
  padding: 20px;
}

.ctrl-panel {
  display: none;
}

.ctrl-panel.active {
  display: block;
}

.ctrl-group {
  margin-bottom: 18px;
}

.ctrl-group:last-child {
  margin-bottom: 0;
}

.ctrl-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 8px;
}

.ctrl-label small {
  font-weight: 500;
  color: var(--text-muted);
}

.pill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pill-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.opt-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--navy-800);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition), color var(--transition);
  text-align: center;
}

.opt-btn:hover {
  border-color: var(--navy-900);
}

.opt-btn.active {
  background: var(--navy-900);
  color: #F7F5F1;
  border-color: var(--navy-900);
  font-weight: 500;
  box-shadow: none;
}

/* Swatch buttons */
.plating-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.plating-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-page);
  color: var(--navy-900);
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.plating-btn:hover {
  border-color: var(--gold-500);
}

.plating-btn.active {
  border-color: var(--gold-500);
  background: var(--gold-100);
  box-shadow: inset 0 0 0 1px var(--gold-500);
}

.plating-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(15, 23, 42, 0.2);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.45), inset 0 -2px 4px rgba(0, 0, 0, 0.25);
}

.color-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.18);
  transition: var(--transition);
}

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

.color-dot.active {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--gold-500);
}

.color-picker-wrap {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px dashed var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: conic-gradient(from 0deg, #ef4444, #f59e0b, #10b981, #3b82f6, #8b5cf6, #ef4444);
}

.color-picker-wrap input[type="color"] {
  position: absolute;
  inset: -6px;
  width: 44px;
  height: 44px;
  opacity: 0;
  cursor: pointer;
}

/* Inputs */
.ctrl-input,
.ctrl-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--navy-900);
  font-size: 0.88rem;
  transition: var(--transition);
}

.ctrl-input:focus,
.ctrl-select:focus {
  border-color: var(--gold-500);
  outline: none;
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.15);
}

.ctrl-range {
  width: 100%;
  accent-color: var(--gold-500);
}

/* Icon Picker */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-page);
  color: var(--navy-800);
  cursor: pointer;
  transition: var(--transition);
}

.icon-card svg {
  width: 24px;
  height: 24px;
}

.icon-card span {
  font-size: 0.7rem;
  font-weight: 600;
}

.icon-card:hover {
  border-color: var(--gold-500);
  background: var(--gold-100);
}

.icon-card.active {
  background: var(--navy-900);
  color: var(--gold-400);
  border-color: var(--navy-900);
}

/* Upload Box */
.logo-upload-box {
  border: 1.5px dashed var(--border-medium);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  background: var(--bg-page);
  cursor: pointer;
  transition: var(--transition);
}

.logo-upload-box:hover {
  border-color: var(--gold-500);
  background: var(--gold-100);
}

.logo-upload-box p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.logo-upload-preview {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-muted);
  margin-top: 10px;
  font-size: 0.8rem;
}

.logo-upload-preview.visible {
  display: flex;
}

.logo-upload-preview img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 4px;
  background: #FFFFFF;
  padding: 2px;
}

/* Irregular Shape Callout (Warm Stone — harmonizes with controls panel) */
.irregular-callout {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 1px solid var(--border-light);
  border-left: 2px solid var(--gold-500);
  color: var(--navy-900);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.irregular-callout strong {
  font-size: 0.84rem;
  color: var(--navy-900);
}

.irregular-callout p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.irregular-callout a {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--navy-900);
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-top: 2px;
}

/* Bottom CTA inside Controls */
.controls-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls-cta-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

/* Presets Strip (single-row scroll on mobile — zero jagged wrapping) */
.preset-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 18px;
  padding-bottom: 2px;
}

.preset-strip::-webkit-scrollbar {
  display: none;
}

.preset-chip {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--navy-800);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}

.preset-chip:hover {
  border-color: var(--navy-900);
  background: var(--bg-muted);
}

/* Responsive */
@media (max-width: 980px) {
  .designer-grid {
    grid-template-columns: 1fr;
  }

  .stage-card {
    position: static;
  }

  .stage-viewport {
    min-height: 360px;
  }
}
