/* Platform chrome: the navbar and footer shared by the portal and every tool page.
 *
 * These rules used to be copied into portal.css and into each tool's stylesheet. The
 * copies drifted: the portal rendered "AI TOOLS" at 0.9rem/700 with no shadow while the
 * tool pages rendered it at 1.25rem/900 with one, so moving between the two pages looked
 * like moving between two products. This file is the single source of truth - the page
 * stylesheets must not redefine any selector below. tests/test_platform_chrome.py checks
 * that, and checks that every page links this file.
 *
 * Self-contained on purpose: portal.css and style.css declare different palette
 * variables (--border vs --slate-200, --primary vs --slc-orange-primary), so the chrome
 * carries its own --chrome-* set and renders identically whichever stylesheet follows it.
 */

:root {
  --chrome-orange: #e05d26;
  --chrome-ink: #0f172a;
  --chrome-ink-soft: #334155;
  --chrome-muted: #64748b;
  --chrome-divider: #cbd5e1;
  --chrome-border: #e2e8f0;
  --chrome-surface: #ffffff;
  --chrome-surface-alt: #f1f5f9;
  --chrome-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --chrome-radius-full: 9999px;
  --chrome-max-width: 1080px;
  --chrome-font: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
}

/* --- Navbar --------------------------------------------------------------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--chrome-surface);
  border-bottom: 1px solid var(--chrome-border);
  box-shadow: var(--chrome-shadow);
  font-family: var(--chrome-font);
  line-height: 1.6;
}

.nav-container {
  max-width: var(--chrome-max-width);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.brand-mark {
  /* Sized to stay inside the 32px line box of .brand-logo so adding the mark does
     not change the navbar height. width/height are also on the tag, so the row does
     not reflow while the image loads. */
  width: 28px;
  height: 28px;
  flex: none;
  display: block;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: inherit;
  white-space: nowrap;
}

.logo-slc {
  color: var(--chrome-orange);
}

.logo-ai {
  color: var(--chrome-ink);
}

.nav-divider {
  color: var(--chrome-divider);
  font-weight: 300;
}

.tool-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--chrome-ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Also used for the row controls in the generation history, not just the navbar. */
.nav-link {
  display: inline-block;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--chrome-ink-soft);
  background: var(--chrome-surface);
  border: 1px solid var(--chrome-border);
  border-radius: var(--chrome-radius-full);
  padding: 5px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
  color: var(--chrome-orange);
  border-color: var(--chrome-orange);
}

.user-chip {
  font-size: 0.8rem;
  color: var(--chrome-muted);
  background: var(--chrome-surface-alt);
  border: 1px solid var(--chrome-border);
  border-radius: var(--chrome-radius-full);
  padding: 0.3rem 0.75rem;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Footer --------------------------------------------------------------- */

.app-footer {
  margin-top: auto;
  background: var(--chrome-surface);
  border-top: 1px solid var(--chrome-border);
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--chrome-muted);
  font-family: var(--chrome-font);
  line-height: 1.6;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .nav-container {
    flex-wrap: wrap;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

/* --- Cost strip ------------------------------------------------------------
 *
 * The price of one run, shown in every tool's header band. The markup is generated by
 * `app/core/costs.py::cost_estimate_strip_html` from one declaration, so the styling
 * belongs here with the rest of the shared chrome rather than in each tool's
 * stylesheet - the same reason the navbar lives here. A tool stylesheet must not
 * redefine these selectors; the two static-UI tests check that.
 */

.cost-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin-top: 1.15rem;
  padding: 0.85rem 1rem;
  /* Opaque, and it sets its own text colour, because a shared component must not
     depend on what it is dropped into. This is not hypothetical: the vulnerability
     tool's band used to be a dark navy one that set `color: #fff` on the card, a
     translucent strip inherited it, and the basis line came out grey-on-navy. Both
     bands are light now, and this stays so the next one need not be. */
  background: #fff7f2;
  color: var(--chrome-ink);
  border: 1px solid rgba(224, 93, 38, 0.35);
  border-radius: 10px;
  font-family: var(--chrome-font);
  line-height: 1.55;
}

.cost-strip-lead {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--chrome-orange);
  white-space: nowrap;
}

.cost-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1 1 auto;
}

.cost-chip {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.1rem 0.45rem;
  background: var(--chrome-surface);
  border: 1px solid var(--chrome-border);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
}

.cost-chip-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--chrome-ink-soft);
}

.cost-chip-amount {
  font-size: 1rem;
  font-weight: 800;
  color: var(--chrome-ink);
  font-variant-numeric: tabular-nums;
}

.cost-chip-note {
  flex-basis: 100%;
  font-size: 0.68rem;
  color: var(--chrome-muted);
}

.cost-strip-basis {
  flex-basis: 100%;
  font-size: 0.7rem;
  color: var(--chrome-muted);
}

@media (max-width: 640px) {
  .cost-strip-lead {
    flex-basis: 100%;
  }
}
