/* ── isms_advisor_guide.css ──────────────────────────────────────────
   ISMSAdvisor Guide - aligned with postgresql_guide / knowledge_graph
   design language. Uses green accent (#16A34A / #4ADE80).
   ──────────────────────────────────────────────────────────────────── */

/* ── CSS Custom Properties - declared first so all rules can use them ── */

/* Green solid uses the global --green token (style.css);
   only the alpha bg/border tints are page-local. */
:root {
  --ia-green-bg:     rgba(22, 163, 74, 0.06);
  --ia-green-border: rgba(22, 163, 74, 0.2);
}

.dark {
  --ia-green-bg:     rgba(74, 222, 128, 0.07);
  --ia-green-border: rgba(74, 222, 128, 0.2);
}

/*
    Override base content width */
.ia-content {
  max-width: 960px !important;
}

/* ── Icon helper ─────────────────────────────────────────────────── */

.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 0;
  stroke: currentColor;
  fill: currentColor;
}
.icon-lucide {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Header Actions ─────────────────────────────────────────────── */

.header-actions {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-accent);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.back-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.back-btn .icon { width: 0.8rem; height: 0.8rem; flex-shrink: 0; }

/* ── Page Header ─────────────────────────────────────────────────── */

.ia-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-top: 4rem;
}

.ia-header__title {
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.ia-header__title span { color: var(--green); }

.ia-header__sub {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.65;
  font-weight: 300;
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

/* ── Stats bar ───────────────────────────────────────────────────── */

.ia-stats {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.625rem 0;
  box-shadow: var(--shadow-card);
}

.ia-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.5rem;
  gap: 0.1rem;
}

.ia-stat__val {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.ia-stat__lbl {
  font-size: 0.68rem;
  color: var(--text-3);
  font-weight: 400;
  white-space: nowrap;
}

.ia-stat__sep {
  width: 1px;
  height: 2rem;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Section wrapper ─────────────────────────────────────────────── */

.ia-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  margin-bottom: 1rem;
  transition: box-shadow 0.3s;
}

.ia-section:hover {
  box-shadow: var(--shadow-hover);
}

/* Section header bar */
.ia-section__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.ia-section__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  flex-shrink: 0;
}

.ia-section__icon .icon { width: 1rem; height: 1rem; }

.ia-section__num {
  font-family: var(--font-mono);
  font-size: 0.635rem;
  font-weight: 600;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green);
  opacity: 0.85;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ia-section__title {
  font-family: var(--font-accent);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
}

/* Section body */
.ia-section__body {
  padding: 1.125rem 1.25rem;
}

.ia-section__lead {
  font-size: 0.795rem;
  color: var(--text-2);
  line-height: 1.65;
  font-weight: 300;
  margin-bottom: 1rem;
}

/* ── Chapter heading inside section ─────────────────────────────── */

.ia-chapter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-accent);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 1.25rem 0 0.625rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.ia-chapter:first-of-type { margin-top: 0; }

.ia-chapter .icon { width: 0.9rem; height: 0.9rem; color: var(--green); }

/* ── Callout boxes ───────────────────────────────────────────────── */

.ia-callout {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.875rem 1rem;
  margin: 0.875rem 0;
}

.ia-callout__head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.ia-callout__head .icon { width: 0.85rem; height: 0.85rem; }

.ia-callout ul {
  font-size: 0.775rem;
  color: var(--text-2);
  line-height: 1.6;
  font-weight: 300;
  padding-left: 1.25rem;
  margin: 0;
}

.ia-callout li { margin-bottom: 0.2rem; }
.ia-callout li::marker { color: var(--text-3); }
.ia-callout li:last-child { margin-bottom: 0; }

.ia-callout p {
  font-size: 0.775rem;
  color: var(--text-2);
  line-height: 1.6;
  font-weight: 300;
  margin-bottom: 0.35rem;
}
.ia-callout p:last-child { margin-bottom: 0; }

/* Variants */
.ia-callout--info {
  background: var(--ia-green-bg);
  border-color: var(--ia-green-border);
}
.ia-callout--info .ia-callout__head { color: var(--green); }

.ia-callout--warn {
  background: rgba(245,158,11,0.04);
  border-color: rgba(245,158,11,0.18);
}
.ia-callout--warn .ia-callout__head { color: #d97706; }
.dark .ia-callout--warn .ia-callout__head { color: #fbbf24; }

.ia-callout--danger {
  background: rgba(239,68,68,0.04);
  border-color: rgba(239,68,68,0.18);
}
.ia-callout--danger .ia-callout__head { color: #dc2626; }
.dark .ia-callout--danger .ia-callout__head { color: #f87171; }

/* ── Process grid ────────────────────────────────────────────────── */

.ia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.ia-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.75rem 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ia-item:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--ia-green-bg);
}

.ia-item__code {
  font-family: var(--font-mono);
  font-size: 0.635rem;
  font-weight: 600;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green);
  opacity: 0.85;
  padding: 0.06rem 0.3rem;
  border-radius: 3px;
  display: inline-block;
  margin-bottom: 0.35rem;
}

.ia-item__name {
  font-size: 0.775rem;
  color: var(--text-2);
  line-height: 1.5;
  font-weight: 300;
}

/* ── Command / slash box ─────────────────────────────────────────── */

.ia-cmd {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-left: 2.5px solid var(--green);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  margin: 0.875rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ia-cmd .icon { width: 0.85rem; height: 0.85rem; color: var(--green); flex-shrink: 0; }

/* ── Response structure (5-section breakdown) ────────────────────── */

.ia-response {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 0.875rem 0;
}

.ia-response-row {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.ia-response-row:last-child { border-bottom: none; }
.ia-response-row:hover { background: var(--bg-card); }

.ia-response-row__icon {
  width: 1.4rem;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.ia-response-row__icon .icon { width: 0.75rem; height: 0.75rem; }

.ia-response-row__label {
  font-family: var(--font-accent);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.1rem;
}

.ia-response-row__desc {
  font-size: 0.725rem;
  color: var(--text-2);
  line-height: 1.5;
  font-weight: 300;
}

/* Status badges inline */
.ia-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
}

.ia-status--ok    { color: #16a34a; border-color: rgba(22,163,74,0.3);  background: rgba(22,163,74,0.06);  }
.ia-status--cond  { color: #d97706; border-color: rgba(217,119,6,0.3);  background: rgba(217,119,6,0.06);  }
.ia-status--fail  { color: #dc2626; border-color: rgba(220,38,38,0.3);  background: rgba(220,38,38,0.06);  }
.dark .ia-status--ok   { color: #4ade80; border-color: rgba(74,222,128,0.3); background: rgba(74,222,128,0.07); }
.dark .ia-status--cond { color: #fbbf24; border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.07); }
.dark .ia-status--fail { color: #f87171; border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.07); }

/* ── Example query boxes ─────────────────────────────────────────── */

.ia-examples {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin: 0.875rem 0;
}

.ia-example {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.875rem 1rem;
}

.ia-example__label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-accent);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 0.5rem;
}

.ia-example__label .icon { width: 0.8rem; height: 0.8rem; color: var(--green); }

.ia-query {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  font-size: 0.775rem;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 0.35rem;
}

.ia-query:last-child { margin-bottom: 0; }

/* ── Conversation example ────────────────────────────────────────── */

.ia-convo {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.875rem 0;
}

.ia-bubble {
  border-radius: 10px;
  padding: 0.75rem 0.875rem;
  font-size: 0.775rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

.ia-bubble--user {
  background: var(--ia-green-bg);
  border-color: var(--ia-green-border);
  align-self: flex-end;
  max-width: 90%;
}

.ia-bubble--ai {
  background: var(--bg-subtle);
  align-self: flex-start;
  max-width: 100%;
}

.ia-bubble__who {
  font-family: var(--font-accent);
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.3rem;
}

.ia-bubble--user .ia-bubble__who { color: var(--green); }
.ia-bubble--ai  .ia-bubble__who { color: var(--text-3); }

.ia-bubble p { color: var(--text-2); margin-bottom: 0.3rem; }
.ia-bubble p:last-child { margin-bottom: 0; }

.ia-bubble ul {
  color: var(--text-2);
  padding-left: 1.25rem;
  font-weight: 300;
  margin: 0.25rem 0 0;
}

.ia-bubble li { margin-bottom: 0.15rem; }
.ia-bubble li:last-child { margin-bottom: 0; }

/* Source citation strip */
.ia-source {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.725rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  padding-top: 0.625rem;
  margin-top: 0.625rem;
}

.ia-source .icon { width: 0.75rem; height: 0.75rem; flex-shrink: 0; }

.ia-source-tag {
  font-family: var(--font-mono);
  font-size: 0.635rem;
  font-weight: 600;
  color: var(--green);
  border: 1px solid var(--green);
  opacity: 0.8;
  padding: 0.04rem 0.3rem;
  border-radius: 3px;
}

/* ── Video container ─────────────────────────────────────────────── */

.ia-video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin: 0.875rem 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.ia-video iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* ── Feature cards (2-col) ───────────────────────────────────────── */

.ia-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .ia-features { grid-template-columns: 1fr; }
}

.ia-feat {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s, border-color 0.25s;
}

.ia-feat:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-mid);
}

.ia-feat__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ia-feat__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  flex-shrink: 0;
}

.ia-feat__icon .icon { width: 1rem; height: 1rem; }

.ia-feat__title {
  font-family: var(--font-accent);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.ia-feat__text {
  font-size: 0.795rem;
  color: var(--text-2);
  line-height: 1.65;
  font-weight: 300;
}

/* Value list inside feat card */
.ia-value-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ia-value-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.755rem;
  color: var(--text-2);
  font-weight: 300;
  line-height: 1.5;
}

.ia-value-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  margin-top: 0.5em;
  opacity: 0.7;
}

/* Links inside body */
.ia-section__body a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ia-section__body a:hover { opacity: 0.8; }

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 580px) {
  .header-actions {
    top: 1rem;
    left: 1rem;
    right: 1rem;
  }

  .ia-header {
    padding-top: 3.5rem;
  }

  .ia-stats {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

  .ia-stat__sep { display: none; }
  .ia-stat { padding: 0 0.875rem; }

  .ia-section__head { padding: 0.75rem 1rem; }
  .ia-section__body { padding: 0.875rem 1rem; }

  .ia-grid { grid-template-columns: 1fr; }

  .ia-features { grid-template-columns: 1fr; }

  .ia-bubble--user { max-width: 100%; }
}
