/* ============================================================
   SVG → PNG Converter — style.css
   Standalone, no external dependencies.
   ============================================================ */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

#s2p-app {
  --bg0: #070b14;
  --bg1: #0b101d;
  --panel: #101829;
  --panel2: #16223a;
  --border: rgba(148, 163, 184, 0.14);
  --border2: rgba(148, 163, 184, 0.26);
  --text: #e9eef7;
  --muted: #8c99b0;
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --accent3: #d946ef;
  --cyan: #22d3ee;
  --green: #34d399;
  --danger: #fb7185;
  --radius: 14px;
  --radius-sm: 9px;

  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(900px 600px at -10% 115%, rgba(34, 211, 238, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================ Topbar ============================ */
.s2p-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 29, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 5;
}

.s2p-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.s2p-logo {
  display: inline-flex;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 16px rgba(99, 102, 241, 0.45));
}
.s2p-brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.s2p-brand-badge {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.10);
  border: 1px solid rgba(34, 211, 238, 0.28);
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: 2px;
}
.s2p-brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.s2p-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================ Buttons ============================ */
.s2p-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 10px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease;
}
.s2p-btn:active { transform: translateY(1px); }
.s2p-btn:disabled { opacity: .55; cursor: wait; }

.s2p-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #d946ef);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.s2p-btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.45);
  transform: translateY(-1px);
}

.s2p-btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border2);
}
.s2p-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(148, 163, 184, 0.4);
}

.s2p-btn-sm { padding: 8px 11px; font-size: 12px; border-radius: 8px; }

.s2p-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 8px;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.s2p-chip:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }

/* ============================ Workspace ============================ */
.s2p-workspace {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

/* ============================ Sidebar ============================ */
.s2p-sidebar {
  flex: 0 0 380px;
  width: 380px;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid var(--border);
  background: rgba(11, 16, 29, 0.5);
}

.s2p-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.s2p-panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.s2p-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* ============================ Dropzone ============================ */
.s2p-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  padding: 24px 16px;
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.s2p-dropzone:hover, .s2p-dropzone.drag {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  color: var(--text);
}
.s2p-dropzone.drag { transform: scale(1.01); }
.s2p-dropzone svg { opacity: .8; }
.s2p-dz-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.s2p-dz-sub { margin: 0; font-size: 12px; }
.s2p-link { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }

/* ============================ Paste ============================ */
.s2p-paste { display: flex; flex-direction: column; gap: 7px; }
.s2p-paste-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.s2p-paste textarea {
  width: 100%;
  height: 118px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #cfe3ff;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.s2p-paste textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.s2p-paste textarea::placeholder { color: #4a5a76; }

.s2p-source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
}
.s2p-fileinfo {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.s2p-fileinfo b { color: var(--text); font-weight: 600; }

/* ============================ Fields ============================ */
.s2p-field-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.s2p-hint { text-transform: none; font-weight: 500; opacity: .7; }

.s2p-size-grid {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  align-items: end;
  gap: 10px;
}
.s2p-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.s2p-field-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: -1px;
}
.s2p-field input {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.s2p-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.s2p-field input::placeholder { color: #4a5a76; }
.s2p-field-block { gap: 7px; }

/* lock toggle */
.s2p-lock {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.s2p-lock .lock-open { display: block; }
.s2p-lock .lock-closed { display: none; }
.s2p-lock.locked { color: var(--cyan); border-color: rgba(34, 211, 238, 0.4); background: rgba(34, 211, 238, 0.08); }
.s2p-lock.locked .lock-open { display: none; }
.s2p-lock.locked .lock-closed { display: block; }

/* ============================ Scale ============================ */
.s2p-scale {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}
.s2p-scale button {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 0;
  cursor: pointer;
  transition: all .15s ease;
}
.s2p-scale button:hover { color: var(--text); border-color: var(--border2); }
.s2p-scale button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* ============================ Background ============================ */
.s2p-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}
.s2p-switch input { display: none; }
.s2p-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background .18s ease;
  flex: 0 0 auto;
}
.s2p-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
}
.s2p-switch input:checked + .s2p-track { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.s2p-switch input:checked + .s2p-track .s2p-thumb { transform: translateX(18px); }
.s2p-switch-label { font-size: 13px; }

.s2p-bg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.s2p-bg-row.hidden { display: none; }

.s2p-color-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.s2p-color-picker input[type="color"] {
  position: absolute;
  opacity: 0;
  width: 26px;
  height: 26px;
  cursor: pointer;
}
.s2p-color-well {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  background: conic-gradient(#666 0 25%, #aaa 0 50%, #666 0 75%, #aaa 0) 0 0 / 12px 12px;
}
.s2p-color-check { display: none; color: #fff; font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.s2p-swatches { display: flex; gap: 7px; }
.s2p-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  cursor: pointer;
  padding: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
.s2p-swatch:hover { transform: scale(1.15); box-shadow: 0 0 0 2px rgba(255,255,255,0.18); }

/* ============================ Preview ============================ */
.s2p-preview {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.s2p-preview-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 16, 29, 0.55);
}
.s2p-zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.s2p-zoom-group button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.s2p-zoom-group button:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--border2); }
.s2p-zoom-group .s2p-zoom-text { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.s2p-zoom-group .s2p-zoom-text:hover { color: var(--text); }
.s2p-zoom-pct {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.s2p-preview-actions { display: flex; align-items: center; gap: 9px; }

/* Stage (checkerboard) */
.s2p-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  position: relative;
  padding: 44px;
  background-color: #0c1220;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.035) 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.s2p-stage canvas {
  flex: 0 0 auto;
  margin: auto;
  image-rendering: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  border-radius: 2px;
}

/* Empty state */
.s2p-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  pointer-events: none;
  padding: 24px;
}
.s2p-empty.hidden { display: none; }
.s2p-empty-icon { opacity: .9; }
.s2p-empty h3 { margin: 0; font-size: 18px; font-weight: 700; }
.s2p-empty p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.s2p-empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  padding: 1px 6px;
  border-radius: 5px;
}
.s2p-empty .s2p-btn { pointer-events: auto; margin-top: 6px; }

/* Status bar */
.s2p-preview-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  border-top: 1px solid var(--border);
  background: rgba(11, 16, 29, 0.6);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.s2p-preview-status .s2p-spacer { flex: 1 1 auto; }
#s2p-output-info { color: var(--text); font-weight: 600; }
#s2p-output-info .val { color: var(--cyan); }

/* ============================ Toast ============================ */
.s2p-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  background: #1a2438;
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 100;
  max-width: min(90vw, 460px);
}
.s2p-toast.show { opacity: 1; transform: translate(-50%, 0); }
.s2p-toast.success { border-color: rgba(52, 211, 153, 0.5); }
.s2p-toast.success::before { content: "✓ "; color: var(--green); }
.s2p-toast.error { border-color: rgba(251, 113, 133, 0.5); }
.s2p-toast.error::before { content: "✕ "; color: var(--danger); }

/* ============================ Scrollbars ============================ */
.s2p-sidebar::-webkit-scrollbar,
.s2p-stage::-webkit-scrollbar { width: 11px; height: 11px; }
.s2p-sidebar::-webkit-scrollbar-thumb,
.s2p-stage::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
.s2p-sidebar::-webkit-scrollbar-thumb:hover,
.s2p-stage::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.4); background-clip: padding-box; }
.s2p-sidebar::-webkit-scrollbar-corner { background: transparent; }

/* ============================ Responsive ============================ */
@media (max-width: 900px) {
  .s2p-workspace { flex-direction: column; }
  .s2p-sidebar {
    flex: 0 0 auto;
    width: 100%;
    max-height: 46vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .s2p-preview { min-height: 54vh; }
  .s2p-stage { padding: 24px; }
}

@media (max-width: 620px) {
  .s2p-brand-text p { display: none; }
  .s2p-topbar { padding: 10px 14px; }
  .s2p-topbar-actions .s2p-btn-ghost { display: none; }
  .s2p-preview-actions .s2p-btn-ghost { display: none; }
  .s2p-sidebar { padding: 12px; }
  .s2p-stage { padding: 16px; }
}
