:root {
  --c-red: #e2001a;
  --c-red-dark: #b50015;
  --c-dark: #1c1c1c;
  --c-gray: #6b6b6b;
  --c-light: #f0f0f2;
  --c-border: #e0e0e4;
  --c-white: #fff;
  --toolbar-w: 220px;
  --props-w: 280px;
  --header-h: 60px;
  --font: 'Poppins', Arial, sans-serif;
}

* { box-sizing: border-box; }

.designer-body {
  margin: 0;
  font-family: var(--font);
  background: #2a2a2e;
  color: var(--c-dark);
  overflow: hidden;
  height: 100vh;
}

.designer-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.designer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 20px;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  gap: 16px;
}

.designer-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 200px;
}

.designer-back {
  font-size: 13px;
  color: var(--c-gray);
  white-space: nowrap;
}

.designer-back:hover { color: var(--c-red); }

.designer-header-left strong {
  display: block;
  font-size: 14px;
  line-height: 1.3;
}

.designer-header-left span {
  font-size: 11px;
  color: var(--c-gray);
}

.designer-header-center {
  display: flex;
  gap: 4px;
  background: var(--c-light);
  border-radius: 8px;
  padding: 4px;
}

.side-tab {
  border: none;
  background: transparent;
  padding: 8px 24px;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--c-gray);
  transition: 0.15s;
}

.side-tab.active {
  background: var(--c-white);
  color: var(--c-dark);
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.designer-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  justify-content: flex-end;
}

#zoomLabel {
  font-size: 12px;
  color: var(--c-gray);
  min-width: 40px;
  text-align: center;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--c-border);
  background: var(--c-white);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { border-color: var(--c-red); color: var(--c-red); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-red);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 22px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
  white-space: nowrap;
}

.btn:hover { background: var(--c-red-dark); }

.btn-outline {
  background: transparent;
  color: var(--c-dark);
  border: 1px solid var(--c-border);
}

.btn-outline:hover {
  border-color: var(--c-red);
  color: var(--c-red);
  background: transparent;
}

.designer-alert {
  background: #fff3cd;
  color: #856404;
  padding: 10px 20px;
  font-size: 13px;
  border-bottom: 1px solid #ffc107;
}

/* Main layout */
.designer-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.designer-toolbar,
.designer-props {
  background: var(--c-white);
  overflow-y: auto;
  flex-shrink: 0;
}

.designer-toolbar {
  width: var(--toolbar-w);
  border-right: 1px solid var(--c-border);
  padding: 16px 14px;
}

.designer-props {
  width: var(--props-w);
  border-left: 1px solid var(--c-border);
  padding: 16px 14px;
}

.designer-toolbar h4,
.designer-props h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--c-gray);
  margin: 0 0 10px;
  font-weight: 600;
}

.designer-toolbar hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 12px 0;
}

.designer-toolbar .toolbar-sub {
  margin-top: 4px;
}

.tool-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  background: var(--c-white);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: 0.15s;
}

.tool-btn:hover,
.tool-btn.active {
  border-color: var(--c-red);
  color: var(--c-red);
  background: #fff5f6;
}

.tool-btn.danger:hover {
  border-color: #c0392b;
  color: #c0392b;
  background: #fdf0ef;
}

.admin-template-hint {
  background: #fff8e6;
  border: 1px solid #ffe08a;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #6b5a2a;
}

.admin-template-hint h4 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.admin-template-hint ol {
  margin: 0 0 8px;
  padding-left: 16px;
}

.admin-template-hint p {
  margin: 0;
  font-size: 11px;
  opacity: 0.85;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-item {
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.15s;
}

.template-item:hover,
.template-item.active {
  border-color: var(--c-red);
  background: #fff5f6;
}

/* Color option swatches (MOO-style) */
.designer-color-options {
  margin-bottom: 4px;
}

.designer-props-divider {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 0 0 16px;
}

.designer-color-group {
  margin-bottom: 18px;
}

.designer-color-group h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-dark);
}

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

.designer-swatch-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px;
  border: 2px solid var(--c-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
  min-height: 72px;
}

.designer-swatch-btn:hover {
  border-color: #ccc;
}

.designer-swatch-btn.active {
  border-color: var(--c-red);
  box-shadow: 0 0 0 2px rgba(226, 0, 26, 0.12);
}

.designer-swatch-chip {
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 999px;
}

.designer-swatch-label {
  font-size: 11px;
  line-height: 1.3;
  color: var(--c-gray);
  font-weight: 500;
}

.props-hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--c-gray);
  line-height: 1.4;
}

/* Canvas area */
.designer-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 24px;
  background: #2a2a2e;
  background-image:
    linear-gradient(45deg, #333 25%, transparent 25%),
    linear-gradient(-45deg, #333 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #333 75%),
    linear-gradient(-45deg, transparent 75%, #333 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.canvas-stage {
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,.45);
  transform-origin: center center;
  transition: transform 0.15s ease;
}

.canvas-stage .canvas-container {
  border-radius: 2px;
  position: relative;
  z-index: 1;
}

.guide-label {
  position: absolute;
  font-size: 9px;
  color: rgba(255,255,255,.85);
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 20;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

.guide-bleed { top: 4px; left: 6px; }
.guide-trim { top: calc(var(--bleed, 12px) + 4px); left: calc(var(--bleed, 12px) + 6px); }
.guide-safe { bottom: calc(var(--bleed, 12px) + 4px); right: calc(var(--bleed, 12px) + 6px); }

.canvas-hint {
  margin-top: 16px;
  font-size: 12px;
  color: #aaa;
  text-align: center;
  max-width: 480px;
}

/* Properties panel */
.props-empty {
  font-size: 13px;
  color: var(--c-gray);
  padding: 12px 0;
}

.props-panel .form-group {
  margin-bottom: 12px;
}

.props-panel label {
  display: block;
  font-size: 12px;
  color: var(--c-gray);
  margin-bottom: 4px;
}

.props-panel input[type="text"],
.props-panel input[type="number"],
.props-panel select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 13px;
}

.props-panel input[type="color"] {
  width: 100%;
  height: 36px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row .form-group { flex: 1; }

.align-btns {
  display: flex;
  gap: 4px;
}

.align-btns button {
  flex: 1;
  padding: 6px;
  border: 1px solid var(--c-border);
  background: var(--c-white);
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font);
}

.align-btns button:hover,
.align-btns button.active {
  border-color: var(--c-red);
  color: var(--c-red);
}

.props-help {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--c-border);
}

.props-help ul {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--c-gray);
  line-height: 1.8;
}

/* Saving state */
.designer-saving .btn { opacity: 0.7; pointer-events: none; }

@media (max-width: 900px) {
  .designer-toolbar,
  .designer-props { display: none; }
  .designer-header-left span { display: none; }
}
