/* =====================================================================
   Placeholder Image Generator Pro — app.css
   Extends the shared design system (base.css). Colors derive ONLY from
   base.css CSS variables, except for user-controlled swatch colors
   (background / text / pattern), which are inherently hardcoded hex by
   nature of the feature — they ARE the content being edited.
   ===================================================================== */

/* ---- Theme toggle icon swap (sun in dark, moon in light) ---- */
[data-theme="light"] .icon-sun { display: none; }
.icon-moon { display: none; }

/* ===================== Header dims badge ===================== */
#dimsBadge { flex: none; }

/* ===================== Preview panel ===================== */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.preview-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  min-height: 220px;
  max-height: 60vh;
  overflow: auto;
}
#previewCanvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: block;
}
.preview-meta { gap: var(--space-3); }

/* ===================== Controls layout ===================== */
.controls-grid {
  margin-top: var(--space-5);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  align-items: start;
}
.controls-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.panel-title {
  margin: 0 0 var(--space-1);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.control-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---- Dimensions ---- */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.preset-btn.is-active {
  background: var(--gradient-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.dim-row { flex-wrap: nowrap; }
.dim-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.dim-input-group label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.dim-x { padding-top: 20px; flex: none; font-weight: 700; }

/* ---- Color inputs ---- */
input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 6px; }

/* ---- Angle control ---- */
.angle-number {
  width: 76px;
  flex: none;
  text-align: center;
  padding: 9px 10px;
}

/* ---- Text overlay ---- */
.auto-text-check { gap: var(--space-2); font-size: 12.5px; }
.font-size-field { width: 96px; flex: none; }
.font-size-input:disabled { opacity: .55; cursor: not-allowed; }
.text-color-field { width: 76px; flex: none; }

/* ===================== Snippets ===================== */
.snippets-panel {
  margin-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.snippet-block { display: flex; flex-direction: column; gap: var(--space-2); }
.snippet-code {
  margin: 0;
  padding: var(--space-4) var(--space-5);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 140px;
  overflow: auto;
  color: var(--text-secondary);
}

/* ===================== Shortcuts modal table ===================== */
.shortcut-table { width: 100%; border-collapse: collapse; }
.shortcut-table td {
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.shortcut-table tr:last-child td { border-bottom: none; }
.shortcut-table td:last-child { text-align: right; white-space: nowrap; }
.shortcut-table kbd + kbd { margin-left: 4px; }

/* ===================== Responsive ===================== */
@media (max-width: 860px) {
  .controls-grid { grid-template-columns: 1fr; }
  .preview-canvas-wrap { min-height: 180px; }
}

@media (max-width: 720px) {
  #dimsBadge { display: none; }
  .preview-meta { flex-direction: column; align-items: stretch; }
  .preview-meta > div { justify-content: stretch; }
  .preview-meta .btn { flex: 1; }
}

@media (max-width: 460px) {
  .dim-row { flex-wrap: wrap; }
  .dim-x { display: none; }
}
