/**
 * dopic.app - International Stamp Maker & Custom Stationery Studio
 * Minimalist Clean Studio Aesthetic (Matching steam-avatar orderliness)
 */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --surface: #ffffff;
  --card-bg: #ffffff;
  --bg: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-elevated: 0 12px 30px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
}

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

html {
  background: #f8fafc !important;
  color-scheme: light;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f8fafc !important;
  color: #0f172a !important;
  line-height: 1.5;
  min-height: 100vh;
  background-image: 
    radial-gradient(ellipse 70% 40% at 50% -10%, rgba(99, 102, 241, 0.06), transparent),
    radial-gradient(circle at 100% 100%, rgba(6, 182, 212, 0.04), transparent);
  background-attachment: fixed;
}

/* Hero Section */
.hero-sec {
  max-width: 960px;
  margin: 2.2rem auto 1.25rem auto;
  padding: 0 1.25rem;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 0.75rem;
  border: 1px solid #c7d2fe;
}
.hero-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.hero-sub {
  font-size: 0.95rem;
  color: #475569;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Studio Main Layout */
.studio-grid {
  max-width: 1240px;
  margin: 1.5rem auto 3.5rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.75rem;
  align-items: start;
}
@media (max-width: 960px) {
  .studio-grid { grid-template-columns: 1fr; }
}

/* Left Controls Panel */
.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-card);
}

/* Grouped Section Box (steam-avatar style) */
.sec-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.sec-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sec-badge {
  font-size: 0.72rem;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}
.sec-sub-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

/* Preset Chips Row */
.preset-chips-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (max-width: 600px) {
  .preset-chips-row { grid-template-columns: repeat(2, 1fr); }
}

.demo-avatar-chip {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  color: #334155;
  padding: 0.55rem 0.4rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.demo-avatar-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}
.demo-avatar-chip.active {
  background: #eef2ff;
  border-color: var(--primary);
  color: #4338ca;
  box-shadow: 0 0 0 1px var(--primary);
}
.demo-avatar-chip .chip-icon {
  font-size: 1.05rem;
}


/* Shape Selector Row */
.shape-selector-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.shape-btn {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  color: #334155;
  padding: 0.55rem 0.35rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.shape-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}
.shape-btn.active {
  border-color: var(--primary);
  background: #eef2ff;
  color: #4338ca;
  box-shadow: 0 0 0 1px var(--primary);
}

/* Border Choice Row */
.border-choice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 0.15rem;
}
.border-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
}
.border-btns-group {
  display: flex;
  gap: 6px;
}
.border-choice-btn {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.border-choice-btn:hover {
  border-color: var(--primary);
}
.border-choice-btn.active {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

/* Form Groups & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}
.form-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: #0f172a;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.15s ease;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.field-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}
.btn-link-action {
  font-size: 0.75rem;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
}
.btn-primary-sm {
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}
.val-badge {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 800;
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #c7d2fe;
}
.clean-range {
  width: 100%;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Swatches */
.swatch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stamp-swatch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  transition: all 0.15s ease;
}
.stamp-swatch:hover {
  border-color: var(--primary);
  background: #f8fafc;
}
.stamp-swatch.active {
  border-color: var(--primary);
  background: #eef2ff;
  color: #4338ca;
  font-weight: 700;
  box-shadow: 0 0 0 1px var(--primary);
}
.swatch-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Icon Choice Grid */
.icon-select-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}
@media (max-width: 600px) {
  .icon-select-grid { grid-template-columns: repeat(5, 1fr); }
}

.icon-choice-btn {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 7px 2px;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all 0.15s ease;
}
.icon-choice-btn:hover {
  border-color: var(--primary);
  background: #f8fafc;
  transform: scale(1.05);
}
.icon-choice-btn.active {
  border-color: var(--primary);
  background: #eef2ff;
  box-shadow: 0 0 0 1px var(--primary);
}

.custom-icon-alert {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ecfdf5;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
}

/* Surface Preview Selector */
.surface-btn-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.surface-btn {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 4px;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.15s ease;
}
.surface-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8fafc;
}
.surface-btn.active {
  border-color: var(--primary);
  background: #eef2ff;
  color: #4338ca;
  box-shadow: 0 0 0 1px var(--primary);
}

/* Signature Panel */
.sig-mode-wrap {
  margin-bottom: 0.5rem;
  padding: 10px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
}
.sig-tabs-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.btn-sig-tab {
  flex: 1;
  padding: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-sig-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}
.sig-drop-box {
  padding: 12px;
  background: #ffffff;
  border: 2px dashed #818cf8;
  border-radius: 8px;
  cursor: pointer;
}
.btn-sig-sub {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
}

/* Right Stage Card */
.stage-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 90px;
  box-shadow: var(--shadow-elevated);
}
.stage-header-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}
.stage-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 3px 10px;
  border-radius: 20px;
}
.stage-zoom-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Canvas Viewport */
.canvas-wrap {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #faf8f5;
  border-radius: 16px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03), 0 10px 28px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: background 0.3s ease;
}
.checkerboard-bg {
  background-image: 
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%), 
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%), 
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #ffffff;
}
#stampCanvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.stage-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.85rem;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  width: 100%;
}

/* Dual Download Buttons (Matching steam-avatar pc-export-buttons-group) */
.pc-export-buttons-group {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 10px;
  width: 100%;
  margin-top: 1rem;
}
@media (max-width: 480px) {
  .pc-export-buttons-group { grid-template-columns: 1fr; }
}

.btn-download-main {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn-download-png {
  background: var(--primary);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
.btn-download-png:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.btn-download-jpg {
  background: #ffffff;
  color: #334155;
  border: 1.5px solid var(--border-strong);
}
.btn-download-jpg:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
}
