/* Styling for the builder interface only.
   The newsletter's own styles live inline in app.js, because email
   clients strip external stylesheets. */

:root {
  --bleu: #006eb6;
  --bleu-fonce: #00446f;
  --jaune: #f3e300;
  --encre: #14181d;
  --encre-douce: #5a6470;
  --ligne: #dde3e9;
  --fond: #f4f6f8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--encre);
  background: var(--fond);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .85rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--ligne);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -.01em;
}

.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

button {
  font: inherit;
  font-weight: 600;
  font-size: .85rem;
  padding: .5rem .9rem;
  border: 0;
  border-radius: 7px;
  background: var(--bleu);
  color: #fff;
  cursor: pointer;
}

button:hover { background: var(--bleu-fonce); }

button.ghost {
  background: #fff;
  color: var(--bleu-fonce);
  border: 1px solid var(--ligne);
}

button.ghost:hover { background: #eef3f8; }

button:focus-visible {
  outline: 3px solid var(--jaune);
  outline-offset: 2px;
}

/* ---------- layout ---------- */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: start;
}

@media (max-width: 950px) {
  main { grid-template-columns: 1fr; }
}

.panel {
  background: #fff;
  border: 1px solid var(--ligne);
  border-radius: 10px;
  padding: 1.1rem;
}

/* ---------- form ---------- */
fieldset {
  border: 0;
  border-top: 1px solid var(--ligne);
  padding: 1rem 0 .35rem;
  margin: 0;
}

fieldset:first-of-type { border-top: 0; padding-top: 0; }

legend {
  font-weight: 700;
  font-size: .95rem;
  color: var(--bleu-fonce);
  padding: 0;
}

label {
  display: block;
  margin-bottom: .7rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--encre-douce);
}

label.inline {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  font-size: .95rem;
  color: var(--bleu-fonce);
  cursor: pointer;
}

label small {
  display: block;
  font-weight: 400;
  font-size: .75rem;
  color: #8a949f;
  margin-top: .1rem;
}

input[type="text"], input:not([type]), textarea {
  display: block;
  width: 100%;
  margin-top: .3rem;
  padding: .5rem .6rem;
  font: inherit;
  font-size: .9rem;
  color: var(--encre);
  border: 1px solid var(--ligne);
  border-radius: 6px;
  background: #fff;
}

input:focus, textarea:focus {
  outline: 2px solid var(--bleu);
  outline-offset: 0;
  border-color: var(--bleu);
}

textarea { resize: vertical; line-height: 1.5; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

[data-depends] { padding-top: .85rem; }
[data-depends][hidden] { display: none; }

/* ---------- repeatable lists ---------- */
.item {
  position: relative;
  border: 1px solid var(--ligne);
  border-radius: 8px;
  padding: .75rem .75rem .1rem;
  margin-bottom: .6rem;
  background: #fbfcfd;
}

.item .supprimer {
  position: absolute;
  top: .5rem;
  right: .5rem;
  padding: .2rem .5rem;
  font-size: .75rem;
  background: transparent;
  color: #b03030;
  border: 1px solid transparent;
}

.item .supprimer:hover { background: #fdeaea; }

.add { width: 100%; margin-bottom: .6rem; }

/* ---------- preview ---------- */
.preview { position: sticky; top: 4.5rem; padding: .75rem; }

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .6rem;
  flex-wrap: wrap;
}

.tabs { display: flex; gap: .25rem; }

.tab {
  background: transparent;
  color: var(--encre-douce);
  border: 1px solid transparent;
  font-size: .8rem;
}

.tab.actif { background: #eef3f8; color: var(--bleu-fonce); }

.controle { font-size: .78rem; color: var(--encre-douce); text-align: right; }
.controle .alerte { color: #b03030; display: block; }
.controle .ok { color: #1a7f4b; }

#apercu {
  display: block;
  width: 100%;
  height: 78vh;
  border: 1px solid var(--ligne);
  border-radius: 6px;
  background: #eceff2;
  transition: width .15s ease;
}

#apercu.mobile { width: 380px; max-width: 100%; margin: 0 auto; }
