/*
 * base.css - layout shell, typography and element-level styling.
 * Built to sit on top of Bootstrap 5 (linked in _base.html) and the tokens in
 * tokens.css. Bootstrap supplies layout primitives (grid, navbar, forms,
 * buttons); this file makes them look like part of one deliberate product
 * instead of default Bootstrap, and covers the handful of things Bootstrap
 * doesn't style (tag chips, status pills, the review page's live-status card).
 */

html, body {
  min-height: 100%;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

code, pre, kbd {
  font-family: var(--font-mono);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}
a:hover {
  color: var(--accent-primary-hover);
  text-decoration: underline;
}

.text-muted, .muted {
  color: var(--text-muted) !important;
}

::selection {
  background: color-mix(in srgb, var(--accent-primary) 30%, transparent);
}

/* ---------- App shell ---------- */

.app-navbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  min-height: var(--navbar-height);
  box-shadow: var(--shadow-soft);
}

.app-navbar .navbar-brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-navbar .navbar-brand .brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.app-navbar .nav-link {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
}
.app-navbar .nav-link:hover {
  color: var(--text-primary);
  background-color: var(--surface-muted);
}
.app-navbar .nav-link.active {
  color: var(--accent-primary);
  background-color: color-mix(in srgb, var(--accent-primary) 12%, transparent);
}

.theme-toggle {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}
.theme-toggle .bi-sun-fill { display: none; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-stars-fill { display: none; }
[data-bs-theme="dark"] .theme-toggle .bi-sun-fill { display: inline-block; }

.app-shell-main {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 1.75rem 1rem 4rem;
}

.app-footer {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
}

/* ---------- Typography ---------- */

h1, .h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}
h2, .h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

/* ---------- Cards / surfaces ---------- */

.surface-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.auth-shell {
  min-height: calc(100vh - var(--navbar-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.auth-brand img {
  max-height: 64px;
  width: auto;
}

/* ---------- Forms & buttons ---------- */

.form-control, .form-select {
  background-color: var(--bg-secondary);
  border-color: var(--border-color-strong);
  color: var(--text-primary);
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--accent-primary) 20%, transparent);
}
.form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.btn-primary {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  color: var(--text-on-accent);
}
.btn-outline-secondary {
  border-color: var(--border-color-strong);
  color: var(--text-secondary);
}
.btn-outline-secondary:hover {
  background-color: var(--surface-muted);
  color: var(--text-primary);
  border-color: var(--border-color-strong);
}
.btn-sm {
  font-size: 0.82rem;
}

/* ---------- Tables ---------- */

.table {
  --bs-table-bg: transparent;
  color: var(--text-primary);
  vertical-align: middle;
}
.table > thead {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom-width: 1px;
}
.table > :not(caption) > * > * {
  border-bottom-color: var(--border-color);
}

/* ---------- Alerts / banners ---------- */

.alert-app {
  border-radius: var(--radius-md);
  border: 1px solid;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.alert-app-info {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}
.alert-app-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: var(--success-border);
}
.alert-app-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: var(--warning-border);
}
.alert-app-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

/* ---------- Misc ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.back-link:hover {
  color: var(--accent-primary);
}

pre.code-block {
  background: var(--surface-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  overflow-x: auto;
  color: var(--text-primary);
}
