/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --flame-dark:   #cc2b0b;
  --flame-mid:    #ff5a1f;
  --flame-light:  #ff8c00;
  --bg:           #020617;
  --bg-panel:     #0f172a;
  --bg-card:      #1e293b;
  --bg-input:     #334155;
  --border:       #334155;
  --border-dim:   #1e293b;
  --text:         #f1f5f9;
  --text-dim:     #94a3b8;
  --text-muted:   #475569;
  --accent:       #6366f1;
  --accent-hover: #4f46e5;
  --radius:       12px;
  --radius-sm:    8px;
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Electrolize', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────── */
#app-header {
  background: linear-gradient(135deg, var(--flame-dark) 0%, var(--flame-mid) 50%, var(--flame-light) 100%);
  border-bottom: 1px solid rgba(0,0,0,0.3);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.brand img {
  height: 2.5rem;
  width: 2.5rem;
  object-fit: contain;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  line-height: 1.2;
}

.brand-tagline {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.03em;
}

.header-ad {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

@media (max-width: 900px) { .header-ad { display: none; } }

/* ── Main ───────────────────────────────────────────────────────── */
main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ── Upload screen ──────────────────────────────────────────────── */
#upload-screen {
  max-width: 640px;
  margin: 3rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

#drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(30,41,59,0.6);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
  text-align: center;
}

#drop-zone:hover,
#drop-zone.dragging {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
}

#drop-zone svg {
  width: 3.5rem;
  height: 3.5rem;
  color: var(--text-muted);
  stroke: currentColor;
}

#drop-zone .drop-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

#drop-zone .drop-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── SEO content block ──────────────────────────────────────────── */
.seo-block { text-align: center; }

.seo-block h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.seo-block p {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto 1rem;
}

.network-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.network-chips span {
  font-size: 0.7rem;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
}

/* ── Editor layout ──────────────────────────────────────────────── */
#editor-screen {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  #editor-screen { grid-template-columns: 1fr; }
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.editor-header span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.editor-header a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
}

.editor-header a:hover { color: var(--text); }

/* ── Image preview area ─────────────────────────────────────────── */
#preview-area {
  background: var(--bg-panel);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 16rem;
}

#preview-area img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  display: block;
}

/* cropperjs container sizing */
#preview-area .cropper-container { max-height: 60vh; }

/* ── Controls panel ─────────────────────────────────────────────── */
#controls-panel {
  background: rgba(30,41,59,0.6);
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.orig-dims {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

.ctrl-section { display: flex; flex-direction: column; gap: 0.6rem; }

.ctrl-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

hr.ctrl-divider { border: none; border-top: 1px solid var(--border-dim); }

/* ── Form elements ──────────────────────────────────────────────── */
select, input[type="number"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  font-family: 'Electrolize', sans-serif;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.15s;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}

select:focus, input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.25);
}

input[type="number"]:read-only {
  opacity: 0.55;
  cursor: not-allowed;
}

.dim-row {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
}

.dim-field { flex: 1; }
.dim-field label { display: block; font-size: 0.65rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.dim-sep { color: var(--text-muted); padding-bottom: 0.5rem; font-size: 0.9rem; }

/* ── Radio / checkbox ───────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 0.5rem; }

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

.radio-option input[type="radio"],
.check-option input[type="checkbox"] {
  width: auto;
  margin-top: 0.15rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.radio-option-body .radio-title {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 500;
}

.radio-option-body .radio-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.check-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Range slider ───────────────────────────────────────────────── */
.range-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.range-header .range-val { color: var(--accent); font-family: monospace; }

input[type="range"] {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 999px;
  border: none;
  accent-color: var(--accent);
  padding: 0;
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.8rem;
  font-family: 'Electrolize', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-dim);
}

.btn-secondary:hover { background: #475569; }
.btn-secondary.active { background: var(--accent); color: #fff; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  box-shadow: 0 4px 20px rgba(99,102,241,0.35);
  margin-top: 0.5rem;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Format radios (inline) ─────────────────────────────────────── */
.format-row {
  display: flex;
  gap: 1.5rem;
}

/* ── Ad slot placeholder ─────────────────────────────────────────── */
.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
}

.ad-placeholder span {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.2);
}

/* ── Footer ─────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border-dim);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Utility ─────────────────────────────────────────────────────── */
[hidden] { display: none !important; }

.crop-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.25rem;
}
