@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

:root {
  --green: #18543c;
  --green-dark: #0f3828;
  --green-mid: #1e6b4a;
  --green-soft: #e3f2ea;
  --gold: #f5b942;
  --gold-dark: #e0a030;
  --red: #b83a35;
  --red-dark: #9b2e2a;
  --ink: #0f1a14;
  --muted: #546860;
  --paper: #f7f9f5;
  --white: #ffffff;
  --line: #d3e4d9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

a {
  color: var(--green);
  font-weight: 700;
}

/* ── Topbar (site preview) ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(247, 249, 245, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  color: var(--white);
  font-size: 1.2rem;
  font-weight: 800;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.pathfinder-symbol {
  width: 62px;
  height: 62px;
  display: block;
  object-fit: contain;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

nav a {
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.92rem;
  transition: background 180ms ease, color 180ms ease;
}

nav a:hover {
  background: var(--green-soft);
  color: var(--green-dark);
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

/* ── Hero ── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  align-items: center;
  gap: 40px;
  min-height: calc(100vh - 80px);
  padding: 48px 0 32px;
}

.hero h1 {
  margin: 16px 0 18px;
  font-size: clamp(2.2rem, 6vw, 4.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero p {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero img {
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(24, 84, 60, 0.20), 0 8px 24px rgba(0,0,0,0.10);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* ── Buttons ── */
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  font-size: 0.94rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: var(--shadow-md);
}

.button:active,
button:active {
  transform: translateY(0);
  filter: brightness(0.97);
}

.primary,
button {
  color: var(--white);
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  box-shadow: 0 2px 6px rgba(24, 84, 60, 0.30);
}

.secondary {
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid rgba(24, 84, 60, 0.18);
}

/* ── Banners ── */
.banner {
  margin: 0;
  padding: 12px 16px;
  color: var(--white);
  font-weight: 700;
  border-radius: 8px;
  font-size: 0.95rem;
}

.banner-slide {
  width: fit-content;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  box-shadow: 0 4px 14px rgba(184,58,53,0.30);
  animation: slideIn 2.4s ease-in-out infinite alternate;
}

.ticker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}

.banner-pulse {
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  box-shadow: 0 4px 14px rgba(24, 84, 60, 0.25);
  animation: pulse 1.9s ease-in-out infinite;
}

.banner-marquee {
  overflow: hidden;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  white-space: nowrap;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(245,185,66,0.30);
}

.banner-marquee span {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 12s linear infinite;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0 36px;
}

.content-grid,
.forms-grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr;
  gap: 24px;
  margin: 36px 0;
}

article,
.info-panel,
.form-card,
.tags-section {
  padding: 26px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

h2 {
  margin-top: 0;
  color: var(--green);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--white);
  background: linear-gradient(90deg, var(--green-mid), var(--green-dark));
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: var(--green-soft);
}

label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}

input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fafef8;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 84, 60, 0.12);
}

.form-card button {
  width: 100%;
  margin-top: 18px;
}

.status {
  min-height: 28px;
  margin-bottom: 0;
  color: var(--green);
  font-weight: 700;
  font-size: 0.92rem;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-item {
  padding: 14px;
  border-left: 4px solid var(--gold);
  background: linear-gradient(90deg, var(--green-soft), #f7faf8);
  border-radius: 0 8px 8px 0;
  font-size: 0.94rem;
}

.contact-section,
.tags-section {
  margin: 36px 0;
}

footer {
  padding: 32px 26px;
  color: rgba(255,255,255,0.9);
  text-align: center;
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  font-size: 0.95rem;
}

/* ── Editor layout ── */
.editor-page {
  min-height: 100vh;
  overflow: hidden;
  background: #eaeff0;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 68px;
  padding: 0 20px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.editor-header .brand-mark {
  width: 58px;
  height: 58px;
  font-size: 1rem;
}

.editor-header .brand strong {
  font-size: 0.95rem;
  color: var(--ink);
}

.editor-header .brand small {
  font-size: 0.78rem;
  color: var(--muted);
}

.editor-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.editor-actions .button,
.editor-actions button {
  width: auto;
  min-height: 36px;
  padding: 7px 14px;
  font-size: 0.86rem;
}

/* Grupo de links externos separado visualmente */
.editor-links {
  display: flex;
  gap: 6px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--line);
}

.link-btn {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
  border-radius: 6px;
}

.link-btn:hover {
  color: var(--ink);
  background: var(--paper);
  border-color: #b0c4ba;
  transform: none;
  filter: none;
  box-shadow: none;
}

.link-btn-primary {
  color: var(--white);
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(24, 84, 60, 0.25);
}

.link-btn-primary:hover {
  color: var(--white);
  background: linear-gradient(135deg, var(--green-mid), var(--green-dark));
  filter: brightness(1.08);
  border-color: transparent;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 0;
  width: 100%;
  height: calc(100vh - 68px);
  margin: 0;
}

.preview-pane,
.code-pane {
  min-width: 0;
  min-height: 0;
  padding: 14px;
}

.preview-pane {
  border-right: 1px solid var(--line);
  background: #f0f4f1;
}

.code-pane {
  background: #1a2520;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pane-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.pane-title h1,
.pane-title h2,
.pane-title p {
  margin: 0;
}

.pane-title h1,
.pane-title h2 {
  color: var(--green);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.pane-title p {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
  line-height: 1.4;
}

/* Painel de código — fundo escuro, cores invertidas */
.code-pane .pane-title {
  border-bottom-color: rgba(255,255,255,0.08);
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: auto;
  padding-bottom: 8px;
}

.code-pane .pane-title h2 {
  color: #7ecf9e;
}

.code-pane .pane-title p {
  color: #8aaa99;
  font-size: 0.78rem;
  text-align: left;
}

#sitePreview {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  box-shadow: var(--shadow-md);
}

/* ── Tag legend ── */
.tag-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 28px;
  margin: 0 0 8px;
}

.tag-legend span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1.5px solid currentColor;
}

.legend-h1      { color: #d94f6a; background: rgba(217, 79, 106, 0.10); }
.legend-heading { color: #3d80d8; background: rgba(61, 128, 216, 0.10); }
.legend-p       { color: #28b065; background: rgba(40, 176, 101, 0.10); }
.legend-a       { color: #e09000; background: rgba(224, 144, 0, 0.12); }
.legend-list    { color: #7c59c4; background: rgba(124, 89, 196, 0.10); }
.legend-table   { color: #00929e; background: rgba(0, 146, 158, 0.10); }
.legend-img     { color: #c45e00; background: rgba(196, 94, 0, 0.10); }
.legend-form    { color: #5d6b65; background: rgba(93, 107, 101, 0.10); }
.legend-input   { color: #b83a35; background: rgba(184, 58, 53, 0.10); }

/* ── Block editor ── */
.block-editor {
  min-height: 160px;
  margin-bottom: 8px;
  padding: 14px;
  color: #c8e0d4;
  background: #111d18;
  border: 1px solid #253228;
  border-radius: 10px;
}

.block-editor-empty {
  display: grid;
  min-height: 130px;
  place-items: center;
  color: #5a7868;
  text-align: center;
  font-size: 0.88rem;
}

.block-editor h3 {
  margin: 0 0 10px;
  color: #8dd5ad;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.safe-code-line {
  overflow-x: auto;
  padding: 10px 12px;
  margin: 0 0 10px;
  color: #dff2e8;
  background: #0e1813;
  border: 1px solid #1e2e26;
  border-radius: 8px;
  font: 0.82rem/1.5 'Consolas', 'Courier New', monospace;
  white-space: nowrap;
}

.locked-part {
  color: #f08080;
  font-weight: 700;
}

.editable-part {
  color: #5ddb8d;
  font-weight: 700;
  background: rgba(93, 219, 141, 0.14);
  border-radius: 2px;
  padding: 0 2px;
}

.safe-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.safe-controls label {
  margin: 0;
  color: #a8c4b4;
  font-size: 0.76rem;
  font-weight: 600;
}

.safe-controls select,
.safe-controls input {
  min-height: 34px;
  margin-top: 5px;
  color: #0f1e18;
  background: #eef5f0;
  border-radius: 6px;
  border: 1.5px solid #b8d4c4;
}

.safe-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.safe-buttons button {
  width: auto;
  min-height: 34px;
  padding: 7px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
}

.safe-buttons button.needs-preview {
  animation: previewPulse 0.85s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(232, 93, 117, 0.55);
}

.safe-buttons .undo-button {
  color: #1a2a22;
  background: var(--gold);
}

.safe-buttons .undo-button:hover {
  filter: brightness(1.08);
}

.control-disabled {
  opacity: 0.40;
}

#htmlEditor {
  width: 100%;
  flex: 1;
  resize: none;
  padding: 14px;
  color: #c8e0d4;
  background: #111d18;
  border: 1px solid #253228;
  border-radius: 10px;
  font: 0.82rem/1.55 'Consolas', 'Courier New', monospace;
  margin-top: 8px;
}

#editorStatus {
  margin: 8px 0 0;
  min-height: 26px;
  font-size: 0.82rem;
  color: #7ecf9e;
  font-weight: 600;
}

/* ── Animations ── */
@keyframes slideIn {
  from { transform: translateX(0); }
  to   { transform: translateX(18px); }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 14px rgba(24, 84, 60, 0.20);
  }
  50% {
    transform: scale(1.025);
    box-shadow: 0 14px 34px rgba(24, 84, 60, 0.32);
  }
}

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ── Responsive ── */
@media (max-width: 780px) {
  .topbar,
  .hero,
  .ticker,
  .content-grid,
  .forms-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .hero {
    min-height: auto;
    padding-top: 28px;
  }

  .editor-page {
    overflow: auto;
  }

  .editor-header,
  .editor-layout,
  .pane-title {
    display: grid;
  }

  .editor-header {
    height: auto;
    padding: 14px;
  }

  .editor-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .code-pane {
    min-height: auto;
  }

  .preview-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #sitePreview {
    height: 68vh;
  }

  #htmlEditor {
    height: 62vh;
  }

  .safe-controls {
    grid-template-columns: 1fr;
  }
}

@keyframes previewPulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1);
    box-shadow: 0 0 0 0 rgba(232, 93, 117, 0.55);
  }
  50% {
    transform: scale(1.04);
    filter: brightness(1.18);
    box-shadow: 0 0 0 8px rgba(232, 93, 117, 0);
  }
}
