/* =============================================
   TEMPLATE STYLES — Jackson Maia
   ============================================= */

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

:root {
  --accent:   #4f46e5;
  --accent-lt:#6366f1;
  --green:    #059669;
  --yellow:   #d97706;
  --red:      #dc2626;
  --text:     #111827;
  --text-md:  #374151;
  --text-sm:  #6b7280;
  --border:   #e5e7eb;
  --bg-alt:   #f9fafb;
  --bg-head:  #eef2ff;
}

body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background: #f3f4f6;
  padding: 32px 16px 64px;
}

/* ── Top bar ─────────────────────────────── */
.top-bar {
  max-width: 900px; margin: 0 auto 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.top-bar-logo {
  font-size: .85rem; font-weight: 700; color: var(--accent);
  text-decoration: none;
  display: flex; align-items: center; gap: 6px;
}
.top-bar-logo span { color: var(--text-sm); font-weight: 400; }
.top-bar-back {
  font-size: .8rem; color: var(--text-sm);
  text-decoration: none; border: 1px solid var(--border);
  background: #fff; padding: 5px 14px; border-radius: 6px;
  transition: color .15s, border-color .15s;
}
.top-bar-back:hover { color: var(--accent); border-color: var(--accent-lt); }

/* ── Document container ──────────────────── */
.doc {
  max-width: 900px; margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  overflow: hidden;
}

/* ── Document header ─────────────────────── */
.doc-header {
  padding: 36px 48px 28px;
  border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: 1fr auto;
  gap: 24px; align-items: start;
}
.doc-type {
  font-size: .7rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 8px;
}
.doc-title {
  font-size: 1.5rem; font-weight: 800;
  color: var(--text); line-height: 1.2;
  margin-bottom: 6px;
}
.doc-subtitle { font-size: .875rem; color: var(--text-sm); }

.doc-meta {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  min-width: 220px;
  display: flex; flex-direction: column; gap: 8px;
}
.doc-meta-row {
  display: grid; grid-template-columns: 90px 1fr;
  font-size: .78rem; gap: 6px;
}
.doc-meta-label { color: var(--text-sm); font-weight: 600; }
.doc-meta-value { color: var(--text-md); }
.doc-meta-value.placeholder { color: #9ca3af; font-style: italic; }

/* ── Body ────────────────────────────────── */
.doc-body { padding: 40px 48px; }

/* ── Sections ────────────────────────────── */
.section { margin-bottom: 40px; }
.section:last-child { margin-bottom: 0; }

.section-title {
  font-size: .7rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px; margin-bottom: 18px;
}

.subsection { margin-bottom: 24px; }
.subsection-title {
  font-size: .875rem; font-weight: 700;
  color: var(--text); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.subsection-title::before {
  content: ''; display: inline-block;
  width: 3px; height: 14px;
  background: var(--accent-lt);
  border-radius: 2px; flex-shrink: 0;
}

/* ── Tables ──────────────────────────────── */
table {
  width: 100%; border-collapse: collapse;
  font-size: .825rem; margin-top: 4px;
}
thead th {
  background: var(--bg-head);
  color: var(--accent); font-size: .7rem;
  font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: 10px 14px;
  text-align: left; border: 1px solid var(--border);
}
tbody td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: var(--text-md); vertical-align: top;
  line-height: 1.55;
}
tbody tr:nth-child(even) td { background: var(--bg-alt); }
td.placeholder { color: #9ca3af; font-style: italic; }
td code {
  font-family: 'Fira Code', monospace;
  font-size: .78rem; background: var(--bg-alt);
  padding: 1px 6px; border-radius: 4px;
  color: var(--accent);
}

/* ── Badges / pills ──────────────────────── */
.badge {
  display: inline-block;
  font-size: .68rem; font-weight: 700; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 4px;
  vertical-align: middle;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f3f4f6; color: #374151; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ── Info box ─────────────────────────────── */
.info-box {
  background: #eef2ff; border: 1px solid #c7d2fe;
  border-left: 4px solid var(--accent);
  border-radius: 6px; padding: 14px 16px;
  font-size: .825rem; color: #3730a3;
  margin-bottom: 20px; line-height: 1.6;
}
.tip-box {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-left: 4px solid var(--green);
  border-radius: 6px; padding: 14px 16px;
  font-size: .825rem; color: #14532d;
  margin-bottom: 20px; line-height: 1.6;
}
.warn-box {
  background: #fffbeb; border: 1px solid #fde68a;
  border-left: 4px solid var(--yellow);
  border-radius: 6px; padding: 14px 16px;
  font-size: .825rem; color: #78350f;
  margin-bottom: 20px; line-height: 1.6;
}
.info-box strong, .tip-box strong, .warn-box strong { font-weight: 700; }

/* ── BDD blocks ──────────────────────────── */
.bdd-block {
  background: var(--bg-alt); border: 1px solid var(--border);
  border-left: 4px solid var(--accent-lt);
  border-radius: 6px; padding: 16px 20px;
  font-family: 'Fira Code', monospace;
  font-size: .8rem; line-height: 1.9;
  margin-bottom: 12px;
}
.bdd-keyword { color: var(--accent); font-weight: 700; }
.bdd-scenario { font-weight: 700; font-size: .85rem; margin-bottom: 8px; font-family: 'Inter', sans-serif; }

/* ── Story map grid ──────────────────────── */
.sm-table { table-layout: fixed; }
.sm-table thead th { text-align: center; }
.sm-table .activity-cell {
  background: var(--accent) !important; color: #fff !important;
  font-weight: 700; text-align: center; font-size: .75rem;
  letter-spacing: .06em; text-transform: uppercase;
}
.sm-table .task-cell {
  background: var(--bg-head) !important;
  color: var(--accent) !important;
  font-weight: 600; font-size: .78rem; text-align: center;
}
.sm-story {
  background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px;
  font-size: .78rem; margin: 3px 0; line-height: 1.4;
}
.sm-story.mvp { border-color: var(--green); border-left: 3px solid var(--green); }
.sm-story.v2  { border-color: var(--yellow); border-left: 3px solid var(--yellow); }
.sm-story.v3  { border-color: #9ca3af; border-left: 3px solid #9ca3af; }
.release-row td { background: #f9fafb !important; }
.release-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-sm);
  text-align: center; padding: 6px !important;
}

/* ── Roadmap timeline ────────────────────── */
.roadmap-table { table-layout: fixed; }
.roadmap-table thead th { text-align: center; border: 1px solid var(--border); }
.quarter-header {
  background: var(--accent) !important;
  color: #fff !important; text-align: center;
}
.epic-row td:first-child { font-weight: 600; color: var(--text); }
.roadmap-bar {
  background: var(--accent-lt); color: #fff;
  border-radius: 4px; padding: 4px 8px;
  font-size: .75rem; font-weight: 600;
  text-align: center; display: block;
  line-height: 1.3;
}
.roadmap-bar.done  { background: var(--green); }
.roadmap-bar.prog  { background: var(--yellow); color: #111; }
.roadmap-bar.plan  { background: #c7d2fe; color: var(--accent); }
.roadmap-bar.tbd   { background: #f3f4f6; color: var(--text-sm); }

/* ── Flow steps ──────────────────────────── */
.flow-list {
  list-style: none;
  counter-reset: flow;
  display: flex; flex-direction: column; gap: 6px;
}
.flow-list li {
  counter-increment: flow;
  display: grid; grid-template-columns: 28px 1fr;
  gap: 10px; align-items: flex-start;
  padding: 10px 14px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 6px; font-size: .825rem; color: var(--text-md);
}
.flow-list li::before {
  content: counter(flow);
  width: 24px; height: 24px;
  background: var(--accent); color: #fff;
  border-radius: 50%; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.flow-list li.alt::before { background: var(--yellow); }
.flow-list li.exc::before { background: var(--red); }
.flow-list li strong { color: var(--text); }

/* ── Checklist ────────────────────────────── */
.checklist { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.checklist li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: .825rem; color: var(--text-md);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.checklist li:last-child { border-bottom: none; }
.check { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px;
  border: 1.5px solid #9ca3af; border-radius: 3px; background: #fff; }

/* ── Signature block ─────────────────────── */
.signatures {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px; margin-top: 32px;
}
.sig-block {
  border-top: 1.5px solid var(--text-sm);
  padding-top: 10px; font-size: .78rem; color: var(--text-sm);
}
.sig-block strong { display: block; color: var(--text); font-size: .825rem; }

/* ── Footer ──────────────────────────────── */
.doc-footer {
  border-top: 1px solid var(--border);
  padding: 16px 48px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: .72rem; color: var(--text-sm);
  background: var(--bg-alt);
}
.doc-footer a { color: var(--accent); text-decoration: none; }
.doc-footer a:hover { text-decoration: underline; }

/* ── Print ────────────────────────────────── */
@media print {
  body { background: #fff; padding: 0; }
  .top-bar { display: none; }
  .doc { box-shadow: none; border: none; max-width: 100%; }
  .doc-header { padding: 20px 32px 16px; }
  .doc-body { padding: 24px 32px; }
  .doc-footer { padding: 12px 32px; }
  .section { break-inside: avoid; }
}

@media (max-width: 640px) {
  .doc-header { grid-template-columns: 1fr; padding: 24px; }
  .doc-body { padding: 24px; }
  .doc-footer { padding: 14px 24px; flex-direction: column; gap: 4px; text-align: center; }
  .signatures { grid-template-columns: 1fr; }
}
