/* =============================================================
   LPXPRESS — visual do CONSTRUTOR (não afeta a LP gerada)

   Paleta derivada da logo: esmeralda #019471 -> #00E4A5.
   O tema segue escuro; os cinzas levam um viés verde discreto
   para o conjunto não parecer o verde colado num tema azulado.
   ============================================================= */

:root {
  --bg: #0a0f0e;
  --bg-2: #111817;
  --bg-3: #18211f;
  --line: #24312d;
  --line-soft: #1c2523;
  --text: #e6f0ec;
  --muted: #8a9a95;

  /* esmeralda da marca */
  --accent: #00c98f;          /* meio do degradê — usos sólidos */
  --accent-2: #00e4a5;        /* ponta clara */
  --accent-deep: #019471;     /* ponta escura */
  --accent-grad: linear-gradient(135deg, #019471, #00e4a5);
  --on-accent: #002018;       /* texto sobre o verde */
  --accent-glow: 0 4px 16px rgba(0, 201, 143, .28);

  --ok: #00e4a5;
  --danger: #f85149;
  --warn: #ffb86b;

  --radius: 10px;
  --radius-sm: 7px;
  --font: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
}

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

/* O atributo hidden tem que vencer QUALQUER display vindo de classe.
   A folha do navegador traz apenas [hidden] { display: none }, que perde por
   especificidade para regras como .export { display: flex } — e aí o elemento
   segue na tela mesmo com el.hidden = true. Era esse o bug do painel de código:
   o estado vazio ficava empilhado por cima do resultado já gerado. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--on-accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2b3a35; border: 2px solid var(--bg); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3a4d46; }

/* ---------------- estrutura ---------------- */
.app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
/* fio esmeralda no topo — detalhe da marca */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--accent-grad);
}

.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__logo { display: block; height: 30px; width: auto; }
.topbar__tagline {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
  max-width: 116px;
}

.topbar__template { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.topbar__template select {
  padding: 7px 10px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* ---------------- botões ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  white-space: nowrap;
}
.btn:hover { background: #1e2926; border-color: #33443e; }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent-grad);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: var(--accent-glow);
}
.btn--primary:hover {
  background: linear-gradient(135deg, #01a77f, var(--accent-2));
  border-color: transparent;
}
.btn--ghost { background: transparent; }
.btn--danger:hover { border-color: var(--danger); color: #ff8a80; }
.btn--mini { padding: 5px 9px; font-size: 12px; }
.btn:focus-visible, .tab:focus-visible, .vp:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------- painéis ---------------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 420px) 1fr;
  flex: 1;
  min-height: 0;
}

.panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.panel--left { background: var(--bg-2); border-right: 1px solid var(--line); }
.panel--right { background: var(--bg); }

.panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.panel__head--tabs { justify-content: space-between; }

#lpx-search {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
#lpx-search:focus { outline: none; border-color: var(--accent); }

.panel__body { flex: 1; overflow-y: auto; padding: 10px; }

/* ---------------- acordeões ---------------- */
.group {
  margin-bottom: 8px;
  background: var(--bg-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
.group__head { display: flex; align-items: center; }
.group__head:hover { background: #1b2522; }

.group__toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 4px 12px 13px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.group__icon { flex-shrink: 0; font-size: 15px; }
.group__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* olhinho: liga/desliga a seção na landing page gerada */
.group__eye {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}
.group__eye svg {
  width: 17px; height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.group__eye:hover { background: var(--bg-2); border-color: var(--line); color: var(--accent-2); }

.group__arrow {
  flex-shrink: 0;
  padding: 12px 13px 12px 6px;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}
.group__chev { display: block; transition: transform .18s ease; }
.group.is-open .group__chev { transform: rotate(90deg); }

/* seção desligada: continua editável, mas fica claramente "apagada" */
.group.is-off { border-style: dashed; border-color: #1f3a33; }
.group.is-off .group__toggle { opacity: .42; }
.group.is-off .group__eye { color: var(--accent); }

.group__body { display: none; padding: 4px 13px 15px; border-top: 1px solid var(--line-soft); }
.group.is-open .group__body { display: block; }

/* ---------------- campos ---------------- */
.field { margin-top: 13px; }
.field__label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.field__hint { margin-top: 4px; color: #6b7d77; font-size: 11px; line-height: 1.45; }
.field__hint code, .rich-bar code {
  padding: 1px 4px;
  background: #070b0a;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent-2);
}
.field__hint .warn { color: var(--warn); }

.input, textarea.input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.input:focus { outline: none; border-color: var(--accent); background: #0d1413; }
textarea.input { min-height: 68px; resize: vertical; line-height: 1.5; font-family: var(--font); }
.input[readonly] { opacity: .6; cursor: not-allowed; }

.field--rich .input { padding-right: 10px; }
.rich-bar { display: flex; gap: 6px; margin-top: 6px; align-items: center; }
.rich-bar small { color: #6b7d77; font-size: 10.5px; }

/* cor */
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"] {
  width: 42px; height: 34px; padding: 2px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.color-row .input { flex: 1; font-family: var(--mono); font-size: 12px; }

/* listas e repetidores */
.rep { margin-top: 8px; }
.rep__item {
  position: relative;
  margin-bottom: 8px;
  padding: 10px 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.rep__num {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
}
.rep__del {
  position: absolute; top: 7px; right: 7px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.rep__del:hover { border-color: var(--danger); color: #ff8a80; }
.rep__add { width: 100%; justify-content: center; margin-top: 2px; }
.rep__item .field:first-of-type { margin-top: 0; }

/* imagens */
.imgslot {
  padding: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.imgslot__preview {
  width: 100%;
  height: 92px;
  margin-bottom: 9px;
  background: #070b0a center/cover no-repeat;
  border: 1px solid var(--line);
  border-radius: 6px;
}
/* logo costuma ser transparente e de proporção livre: contain, nunca cover */
.imgslot__preview--contain { background-size: contain; background-color: #0d1413; }
.imgslot__empty {
  display: grid;
  place-items: center;
  height: 92px;
  margin-bottom: 9px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: #6b7d77;
  font-size: 11.5px;
}
.imgslot__modes { display: flex; gap: 5px; margin-bottom: 8px; }
.imgslot__modes button {
  flex: 1;
  padding: 5px 8px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}
.imgslot__modes button.is-active {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 700;
}
.imgslot__file { display: flex; align-items: center; gap: 7px; }
.imgslot__file code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.pairgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------------- abas do painel direito ---------------- */
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 16px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent-2); border-bottom-color: var(--accent); font-weight: 600; }

.viewports { display: flex; align-items: center; gap: 5px; }
.vp {
  width: 32px; height: 30px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}
.vp.is-active { background: var(--accent); border-color: transparent; color: var(--on-accent); }

.pane { display: none; flex: 1; min-height: 0; }
.pane.is-active { display: flex; flex-direction: column; }

/* ---------------- preview ---------------- */
.preview-stage {
  flex: 1;
  display: grid;
  place-items: start center;
  padding: 14px;
  overflow: auto;
  background: #050807;
}
.preview-stage iframe {
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: #fff;
  border: 0;
  border-radius: 6px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.preview-stage[data-viewport="tablet"] iframe { width: 820px; max-width: 100%; }
.preview-stage[data-viewport="mobile"] iframe { width: 400px; max-width: 100%; }

/* ---------------- exportação ---------------- */
.export-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
}
.export-empty__icon { width: 76px; height: 76px; margin: 0; opacity: .6; }
.export-empty h2 { margin: 0; color: var(--text); font-size: 17px; }
.export-empty p { max-width: 460px; margin: 0; line-height: 1.6; }
.export-empty .btn { margin-top: 10px; }

.export { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.export__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.export__head h2 { margin: 0 0 3px; font-size: 16px; }
.export__head p { margin: 0; color: var(--muted); font-size: 12px; }
.export__actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.export__instructions {
  padding: 12px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.65;
  max-height: 190px;
  overflow-y: auto;
}
.export__instructions h3 { margin: 0 0 6px; font-size: 12px; color: var(--accent-2); text-transform: uppercase; letter-spacing: .06em; }
.export__instructions ol, .export__instructions ul { margin: 0; padding-left: 20px; }
.export__instructions li { margin-bottom: 4px; }
.export__instructions code {
  padding: 1px 5px;
  background: #070b0a;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-2);
}
.export__instructions .warn { color: var(--warn); }

.code { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.code__tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.code__tabs button {
  padding: 7px 13px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.code__tabs button.is-active { background: var(--bg-3); color: var(--accent-2); border-color: var(--accent); }
.code__body {
  flex: 1;
  margin: 0;
  padding: 16px;
  overflow: auto;
  background: #060a09;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre;
  tab-size: 2;
}
.code__body code { color: #c6d8d1; }

/* ---------------- modais ---------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(2,7,6,.8); backdrop-filter: blur(3px); }
.modal__box {
  position: relative;
  width: min(100%, 700px);
  max-height: 86vh;
  overflow-y: auto;
  padding: 26px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.modal__box--wide { width: min(100%, 960px); }
.modal__box h2 { margin: 0 0 6px; font-size: 18px; }
.modal__sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.modal__close {
  position: absolute; top: 12px; right: 14px;
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.modal__close:hover { border-color: var(--danger); color: #ff8a80; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.choice:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--accent-glow); }
.choice__icon { font-size: 26px; }
.choice strong { font-size: 14.5px; }
.choice__desc { color: var(--muted); font-size: 12px; line-height: 1.55; }
.choice code { font-family: var(--mono); font-size: 11px; color: var(--accent-2); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 11px; }
.gallery__item {
  padding: 0;
  background: var(--bg-3);
  border: 2px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, transform .12s ease;
}
.gallery__item:hover { border-color: var(--accent); transform: translateY(-2px); }
.gallery__item.is-active { border-color: var(--accent-2); box-shadow: var(--accent-glow); }
.gallery__item img { display: block; width: 100%; height: 104px; object-fit: cover; background: #070b0a; }
.gallery__meta { display: block; padding: 7px 9px; }
.gallery__meta strong { display: block; font-size: 12px; }
.gallery__meta small { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  z-index: 90;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  padding: 11px 20px;
  background: var(--bg-3);
  border: 1px solid var(--accent);
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), var(--accent-glow);
  font-size: 13px;
}
.toast[hidden] { display: none; }
.toast.is-error { border-color: var(--danger); box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* ---------------- responsivo do construtor ---------------- */
@media (max-width: 1280px) {
  .topbar__tagline { display: none; }
}

@media (max-width: 1080px) {
  body { overflow: auto; }
  .app { height: auto; }
  .workspace { grid-template-columns: 1fr; }
  .panel--left { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel__body { max-height: 60vh; }
  .pane.is-active { min-height: 70vh; }
  .choices { grid-template-columns: 1fr; }
}
