/* ============================================================
   Social Ad Builder — app chrome styles
   ============================================================ */

:root {
  --red: #eb0a1e;
  --ink: #16181d;
  --panel: #ffffff;
  --bg: #f2f3f5;
  --line: #e2e4e8;
  --muted: #6b7280;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

/* ---------- login ---------- */
#login-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 700px at 30% 20%, #2a2e35, #101216);
}
#login-overlay[hidden] { display: none; }

.login-card {
  width: min(400px, 92vw);
  background: var(--panel);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
}
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand h1 { margin: 10px 0 2px; font-size: 22px; }
.login-brand p { margin: 0; color: var(--muted); }
.login-card h2 { font-size: 15px; margin: 14px 0 10px; }

.brand-dot {
  display: inline-block; width: 14px; height: 14px;
  border-radius: 50%; background: var(--red);
}

.error { color: var(--red); min-height: 18px; margin: 6px 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: #111318; color: #fff;
}
.topbar-brand { font-weight: 800; letter-spacing: .3px; display: flex; gap: 8px; align-items: center; }
.topbar-user { display: flex; gap: 10px; align-items: center; color: #c8cbd2; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px;
  align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.sidebar { display: flex; flex-direction: column; gap: 14px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.panel h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
}

/* ---------- fields ---------- */
.field { display: block; margin-bottom: 10px; }
.field > span {
  display: block; font-weight: 600; font-size: 12px;
  margin-bottom: 4px; color: #3a3f47;
}
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.field input[type="color"] { width: 56px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; }
.accent-row { display: flex; align-items: center; gap: 10px; }
.swatches { display: flex; gap: 6px; }
.swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; outline: 1px solid var(--line);
  cursor: pointer; padding: 0;
}
.swatch:hover { outline-color: #9aa0a8; }
.field input[type="file"] { font-size: 12px; }
.field :is(input,select,textarea):focus { outline: 2px solid #1113; border-color: #9aa0a8; }

.other-row { display: flex; gap: 6px; margin: -4px 0 10px; }
.other-row input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

.note { color: var(--muted); font-size: 11.5px; margin: 8px 0 0; }

/* ---------- template picker ---------- */
.tpl-grid { display: flex; flex-direction: column; gap: 8px; }
.tpl-card {
  display: block; position: relative;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px 10px 34px; cursor: pointer;
}
.tpl-card input { position: absolute; left: 10px; top: 13px; accent-color: var(--red); }
.tpl-card:has(input:checked) { border-color: var(--red); background: #fff5f5; }
.tpl-name { display: block; font-weight: 700; }
.tpl-hint { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- sizes ---------- */
.size-check { display: flex; gap: 8px; align-items: center; padding: 5px 0; cursor: pointer; }
.size-check input { accent-color: var(--red); }
.size-check small { color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 600;
  border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
}
.btn:hover { background: #f6f7f8; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: #c90818; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.link { border: none; background: none; color: var(--muted); text-decoration: underline; }

/* ---------- previews ---------- */
.stage { min-width: 0; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.preview-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}
.preview-head {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 12.5px; color: #3a3f47;
  margin-bottom: 8px;
}
.preview-actions { display: flex; gap: 6px; }
.preview-card canvas {
  width: 100%; height: auto; display: block;
  border-radius: 6px;
  background: #eee;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
