/* ============================================================
   DESIGN STUDIO — CSS
   Standalone stylesheet for design.html
============================================================ */
:root {
  --ds-primary:      #e8271e;
  --ds-primary-dark: #c01f17;
  --ds-bg:           #1a1a2e;
  --ds-surface:      #16213e;
  --ds-surface2:     #0f3460;
  --ds-panel-bg:     #ffffff;
  --ds-panel-border: #e5e7eb;
  --ds-text:         #1f2937;
  --ds-text-muted:   #6b7280;
  --ds-canvas-bg:    #2a2a3e;
  --ds-topbar-bg:    #111827;
  --ds-topbar-h:     56px;
  --ds-panel-w:      260px;
  --radius:          8px;
  --transition:      0.18s ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--ds-text);
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
select, input, textarea { font-family: inherit; font-size: 13px; }
ul { list-style: none; }

/* ============================================================
   TOP BAR
============================================================ */
.ds-topbar {
  height: var(--ds-topbar-h);
  background: var(--ds-topbar-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.ds-topbar-left,
.ds-topbar-center,
.ds-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ds-topbar-center { flex: 1; justify-content: center; }
.ds-topbar-right  { flex-shrink: 0; }

.ds-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,.6);
  font-size: .82rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.ds-back:hover { background: rgba(255,255,255,.08); color: #fff; }

.ds-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.9);
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: .92rem;
  border-left: 1px solid rgba(255,255,255,.1);
  padding-left: 12px;
}
.ds-logo-icon { color: var(--ds-primary); }

.ds-product-info {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 1px solid rgba(255,255,255,.1);
  padding-left: 12px;
}
.ds-product-name {
  color: rgba(255,255,255,.85);
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}

.ds-size-select {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  color: rgba(255,255,255,.8);
  padding: 5px 10px;
  cursor: pointer;
  outline: none;
  font-size: .82rem;
}
.ds-size-select:focus { border-color: var(--ds-primary); }

.ds-tool-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  font-size: .8rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.ds-tool-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.ds-tool-btn:disabled { opacity: .3; pointer-events: none; }
.ds-tool-btn[aria-pressed="true"] { background: rgba(232,39,30,.2); color: var(--ds-primary); }

.ds-zoom-label {
  color: rgba(255,255,255,.6);
  font-size: .8rem;
  min-width: 40px;
  text-align: center;
}

.ds-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,.1);
  flex-shrink: 0;
}

.ds-btn-cart {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--ds-primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 700;
  transition: all var(--transition);
  box-shadow: 0 3px 10px rgba(232,39,30,.35);
}
.ds-btn-cart:hover {
  background: var(--ds-primary-dark);
  transform: translateY(-1px);
}

/* ============================================================
   LAYOUT
============================================================ */
.ds-layout {
  display: flex;
  height: calc(100vh - var(--ds-topbar-h));
  overflow: hidden;
}

/* ============================================================
   PANELS
============================================================ */
.ds-panel {
  width: var(--ds-panel-w);
  background: var(--ds-panel-bg);
  border-right: 1px solid var(--ds-panel-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.ds-panel-right {
  border-right: none;
  border-left: 1px solid var(--ds-panel-border);
  overflow-y: auto;
}

/* Tabs */
.ds-tabs {
  display: flex;
  background: #f9fafb;
  border-bottom: 1px solid var(--ds-panel-border);
  flex-shrink: 0;
}
.ds-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--ds-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
}
.ds-tab:hover { color: var(--ds-primary); background: rgba(232,39,30,.04); }
.ds-tab.active {
  color: var(--ds-primary);
  border-bottom-color: var(--ds-primary);
  background: rgba(232,39,30,.04);
}

.ds-panel-content {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 20px;
  overflow-y: auto;
  flex: 1;
}
.ds-panel-content.active { display: flex; }

.ds-panel-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--ds-text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ds-panel-border);
}
.ds-section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ds-text-muted);
  margin-top: 4px;
}

/* ============================================================
   FORM CONTROLS
============================================================ */
.ds-control {
  width: auto;
  padding: 7px 10px;
  border: 1px solid var(--ds-panel-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
  color: var(--ds-text);
  background: #fff;
}
.ds-control:focus { border-color: var(--ds-primary); }
.ds-full { width: 100%; }

.ds-color-input {
  height: 36px;
  padding: 2px 4px;
  cursor: pointer;
}
.ds-color-input.ds-full { width: 100%; }

.ds-slider {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--ds-panel-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.ds-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ds-primary);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.ds-slider-val {
  font-size: .75rem;
  color: var(--ds-text-muted);
  display: block;
  text-align: right;
  margin-top: -6px;
}

.ds-search {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--ds-panel-border);
  border-radius: var(--radius);
  outline: none;
  font-size: .85rem;
}
.ds-search:focus { border-color: var(--ds-primary); }

.ds-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ds-col { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ds-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ds-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ds-divider-h {
  height: 1px;
  background: var(--ds-panel-border);
  margin: 4px 0;
}

/* ============================================================
   UPLOAD PANEL
============================================================ */
.ds-drop-zone {
  border: 2px dashed var(--ds-panel-border);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  cursor: pointer;
}
.ds-drop-zone.drag-over {
  border-color: var(--ds-primary);
  background: rgba(232,39,30,.04);
}
.ds-drop-icon { color: var(--ds-text-muted); opacity: .5; }
.ds-drop-title { font-size: .9rem; font-weight: 600; color: var(--ds-text); }
.ds-drop-sub   { font-size: .78rem; color: var(--ds-text-muted); }

.btn-upload-file {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  background: var(--ds-primary);
  color: #fff;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  margin-top: 4px;
}
.btn-upload-file:hover { background: var(--ds-primary-dark); }

.ds-upload-tips {
  background: #fff8f0;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  padding: 12px;
  font-size: .78rem;
}
.ds-tip-title { font-weight: 700; color: #92400e; margin-bottom: 6px; }
.ds-upload-tips ul { padding-left: 14px; list-style: disc; color: #78350f; line-height: 1.7; }

.ds-uploaded-list { display: flex; flex-direction: column; gap: 8px; }
.ds-uploaded-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--ds-panel-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.ds-uploaded-item:hover { background: #dbeafe; }
.ds-uploaded-thumb { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; }
.ds-uploaded-name  { font-size: .8rem; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   TEMPLATES
============================================================ */
.ds-template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ds-template-item {
  aspect-ratio: 2/1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
  transition: all var(--transition);
}
.ds-template-item:hover { border-color: var(--ds-primary); transform: scale(1.02); }
.ds-template-item .ds-tpl-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: .68rem;
  font-weight: 600;
  text-align: center;
  padding: 4px;
}

/* ============================================================
   TEXT PRESETS
============================================================ */
.ds-text-presets { display: flex; flex-direction: column; gap: 8px; }
.ds-text-preset {
  padding: 12px 14px;
  border: 1.5px solid var(--ds-panel-border);
  border-radius: var(--radius);
  text-align: left;
  color: var(--ds-text);
  transition: all var(--transition);
  line-height: 1.2;
}
.ds-text-preset:hover { border-color: var(--ds-primary); background: rgba(232,39,30,.04); color: var(--ds-primary); }

.ds-fmt-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--ds-panel-border);
  border-radius: 6px;
  font-size: .92rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.ds-fmt-btn:hover  { border-color: var(--ds-primary); color: var(--ds-primary); }
.ds-fmt-btn.active { background: var(--ds-primary); color: #fff; border-color: var(--ds-primary); }

/* ============================================================
   SHAPES
============================================================ */
.ds-shapes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ds-shape-btn {
  aspect-ratio: 1;
  border: 1.5px solid var(--ds-panel-border);
  border-radius: var(--radius);
  font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  color: var(--ds-text);
}
.ds-shape-btn:hover { border-color: var(--ds-primary); color: var(--ds-primary); background: rgba(232,39,30,.05); }

/* ============================================================
   BACKGROUND
============================================================ */
.ds-color-swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.ds-swatch {
  width: 100%; aspect-ratio: 1;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
  cursor: pointer;
}
.ds-swatch:hover { transform: scale(1.12); border-color: #fff; }

.ds-gradient-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ds-gradient-btn {
  padding: 14px 8px;
  border-radius: var(--radius);
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
  border: 2px solid transparent;
  transition: transform var(--transition), border-color var(--transition);
}
.ds-gradient-btn:hover { transform: scale(1.03); border-color: rgba(255,255,255,.6); }

/* ============================================================
   CANVAS AREA
============================================================ */
.ds-canvas-area {
  flex: 1;
  background: var(--ds-canvas-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  position: relative;
  padding: 40px;
}

.ds-canvas-wrap {
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  border-radius: 3px;
}

.ds-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity .2s;
}
.ds-guides.visible { opacity: 1; }

.ds-canvas-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.5);
  color: rgba(255,255,255,.7);
  padding: 8px 18px;
  border-radius: 100px;
  font-size: .78rem;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(4px);
  transition: opacity .5s;
}

/* ============================================================
   RIGHT PANEL — PROPERTIES
============================================================ */
.ds-panel-right { padding: 14px 14px 24px; }

.ds-props-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--ds-text-muted);
  text-align: center;
  font-size: .88rem;
  line-height: 1.5;
}

.ds-props-content { display: flex; flex-direction: column; gap: 10px; }
.ds-props-content[hidden] { display: none; }

.ds-layer-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ds-layer-btn {
  padding: 7px 10px;
  border: 1px solid var(--ds-panel-border);
  border-radius: var(--radius);
  font-size: .78rem;
  font-weight: 600;
  color: var(--ds-text);
  text-align: center;
  transition: all var(--transition);
  white-space: nowrap;
}
.ds-layer-btn:hover { border-color: var(--ds-primary); color: var(--ds-primary); background: rgba(232,39,30,.04); }
.ds-layer-btn.accent { border-color: #3b82f6; color: #1d4ed8; }
.ds-layer-btn.accent:hover { background: #eff6ff; }
.ds-layer-btn.danger { border-color: #fca5a5; color: #dc2626; }
.ds-layer-btn.danger:hover { background: #fef2f2; }

.ds-align-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.ds-align-btn {
  aspect-ratio: 1;
  border: 1px solid var(--ds-panel-border);
  border-radius: 6px;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.ds-align-btn:hover { border-color: var(--ds-primary); color: var(--ds-primary); }

/* ============================================================
   TOAST
============================================================ */
.ds-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ds-topbar-bg);
  color: #fff;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  z-index: 9999;
  transition: transform .3s ease;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.ds-toast.show { transform: translateX(-50%) translateY(0); }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 900px) {
  :root { --ds-panel-w: 220px; }
  .ds-topbar-center { display: none; }
}
@media (max-width: 680px) {
  .ds-panel-right { display: none; }
  :root { --ds-panel-w: 200px; }
}
