/* ── CGCloud REX module — CSS variable overrides + component styles ── */

:root {
  --accent:   #00a1e0;
  --accent2:  #7dd3fc;
  --border:   #1e3a5f;
  --bg:       #0a0f1e;
  --surface:  #0d1424;
  --surface2: #111827;
  --text:     #f1f5f9;
  --muted:    #94a3b8;
  --green:    #86efac;
  --red:      #fca5a5;
  --amber:    #fcd34d;
  --code-bg:  #0a1628;
  --h1-grad:  linear-gradient(90deg, #00a1e0, #7dd3fc, #00a1e0);
}

[data-theme="light"] {
  --accent:   #0369a1;
  --accent2:  #0284c7;
  --border:   #bfdbfe;
  --bg:       #f0f4f8;
  --surface:  #ffffff;
  --surface2: #eff6ff;
  --text:     #0f172a;
  --muted:    #475569;
  --green:    #16a34a;
  --red:      #dc2626;
  --amber:    #d97706;
  --code-bg:  #f1f5f9;
  --h1-grad:  linear-gradient(90deg, #0369a1, #0284c7, #0369a1);
}

/* ── Tab bar ── */
.tab-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 40px;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
  transition: background 0.3s, border-color 0.3s;
}

.tab-btn {
  padding: 14px 22px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Content wrap ── */
.content-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 48px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 32px;
  transition: background 0.3s, border-color 0.3s;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

/* ── Section heading ── */
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 8px;
}

/* ── Key-value list ── */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kv-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.88rem;
  line-height: 1.6;
}

.kv-key {
  font-weight: 700;
  color: var(--text);
  min-width: 160px;
  flex-shrink: 0;
}

.kv-val { color: var(--muted); }

/* ── Flow diagram ── */
.flow-row {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  margin: 20px 0;
}

.flow-step {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  min-width: 110px;
  transition: background 0.3s, border-color 0.3s;
}

.flow-step.accent {
  background: rgba(0, 161, 224, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.flow-arrow {
  font-size: 1.1rem;
  color: var(--muted);
  padding: 0 6px;
  flex-shrink: 0;
}

/* ── Feature list ── */
.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-list li {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  padding-left: 20px;
  position: relative;
}

.feature-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.75rem;
  top: 3px;
}

/* ── Limitation list ── */
.limit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.limit-list li {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  padding-left: 20px;
  position: relative;
}

.limit-list li::before {
  content: '✗';
  position: absolute;
  left: 0;
  color: var(--red);
  font-size: 0.78rem;
  top: 3px;
}

/* ── Add-on list ── */
.addon-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.addon-list li {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  padding-left: 20px;
  position: relative;
}

.addon-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-size: 0.78rem;
  top: 3px;
}

/* ── Object pill list ── */
.pill-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(0, 161, 224, 0.1);
  color: var(--accent2);
  border: 1px solid rgba(0, 161, 224, 0.25);
  font-family: monospace;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.pill.new {
  background: rgba(134, 239, 172, 0.1);
  color: var(--green);
  border-color: rgba(134, 239, 172, 0.3);
}

/* ── Comparison table ── */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.compare-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}

.compare-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
  line-height: 1.5;
  transition: color 0.3s, border-color 0.3s;
}

.compare-table tr:last-child td { border-bottom: none; }

.compare-table td:first-child {
  font-weight: 600;
  color: var(--text);
}

.check { color: var(--green); font-weight: 700; }
.cross  { color: var(--red);   font-weight: 700; }
.partial { color: var(--amber); font-weight: 700; }

.compare-table tr:hover td {
  background: var(--surface2);
}

/* ── Callout boxes ── */
.callout {
  border-radius: 10px;
  padding: 16px 20px;
  font-size: 0.85rem;
  line-height: 1.7;
  margin-top: 16px;
}

.callout.info {
  background: rgba(0, 161, 224, 0.08);
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.callout.warn {
  background: rgba(252, 211, 77, 0.08);
  border-left: 3px solid var(--amber);
  color: var(--muted);
}

/* ── Actor badges ── */
.actor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.actor-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  transition: background 0.3s, border-color 0.3s;
}

.actor-card .actor-icon { font-size: 1.6rem; margin-bottom: 8px; }
.actor-card .actor-name { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.actor-card .actor-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.5; }

/* ── Sub-section heading ── */
.sub-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Two-column layout ── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  .content-wrap { padding: 24px 20px 60px; }
  .tab-btn { padding: 12px 14px; font-size: 0.82rem; }
  .kv-key { min-width: 120px; }
  .flow-step { min-width: 90px; padding: 10px 12px; }
  .arch-diagram { grid-template-columns: 1fr; }
}

/* ── Architecture overview diagram ── */
.arch-diagram {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.arch-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arch-col-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 2px;
}

.arch-col-base     { background: rgba(0,161,224,0.15);   color: var(--accent); border: 1px solid rgba(0,161,224,0.4); }
.arch-col-enhanced { background: rgba(134,239,172,0.15); color: var(--green);  border: 1px solid rgba(134,239,172,0.4); }

.arch-domain {
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid;
}

.domain-stores    { background: rgba(0,161,224,0.07);   border-color: rgba(0,161,224,0.3);   }
.domain-visits    { background: rgba(251,191,36,0.06);  border-color: rgba(251,191,36,0.3);  }
.domain-orders    { background: rgba(248,113,113,0.06); border-color: rgba(248,113,113,0.3); }
.domain-territory { background: rgba(167,139,250,0.06); border-color: rgba(167,139,250,0.3); }
.domain-assets    { background: rgba(134,239,172,0.06); border-color: rgba(134,239,172,0.3); }

.arch-domain-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.domain-stores    .arch-domain-title { color: var(--accent); }
.domain-visits    .arch-domain-title { color: var(--amber);  }
.domain-orders    .arch-domain-title { color: var(--red);    }
.domain-territory .arch-domain-title { color: #a78bfa;       }
.domain-assets    .arch-domain-title { color: var(--green);  }

.arch-obj {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.78rem;
  line-height: 1.75;
  color: var(--text);
}

.arch-obj.child  { padding-left: 14px; }
.arch-obj.child2 { padding-left: 26px; }

.arch-obj-api  { font-family: monospace; font-size: 0.76rem; }
.arch-obj-new  { color: var(--green); font-weight: 700; }
.arch-obj-muted { color: var(--muted); font-size: 0.73rem; }

.arch-rel {
  font-size: 0.68rem;
  color: var(--muted);
  margin: 0 2px;
}

.arch-card {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  font-family: monospace;
  white-space: nowrap;
}

.arch-card-sf   { background: rgba(148,163,184,0.12); color: var(--muted);  border: 1px solid rgba(148,163,184,0.25); }
.arch-card-base { background: rgba(0,161,224,0.10);   color: var(--accent); border: 1px solid rgba(0,161,224,0.25);  }
.arch-card-new  { background: rgba(134,239,172,0.10); color: var(--green);  border: 1px solid rgba(134,239,172,0.3); }

.arch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.arch-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--muted);
}

.arch-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
