/* ICore Verifier — Constitutional Design System v1.0.0
   Mobile-first, Dark theme, Sovereign
   Derived from Studyo design system. Zero external fonts. */

:root {
  /* Constitutional Color Palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a25;
  --bg-input: #0f0f18;
  --border: #2a2a3a;
  --border-active: #00e676;
  
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  
  --accent: #00e676;
  --accent-dim: #00cc6a;
  --accent-glow: rgba(0, 230, 118, 0.15);
  
  --warning: #ffab00;
  --error: #ff5252;
  --info: #448aff;
  
  /* Trust levels */
  --trust-verified: #00e676;
  --trust-partial: #ffab00;
  --trust-unverified: #ff5252;
  --trust-unknown: #555570;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Typography */
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                 'Helvetica Neue', Arial, 'Noto Sans', sans-serif,
                 'Apple Color Emoji', 'Segoe UI Emoji';
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono',
               'Courier New', monospace;
  
  /* Touch targets (minimum 48px) */
  --touch-min: 48px;
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-system);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Shell */
#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-logo {
  font-size: 1.5rem;
  line-height: 1;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.header-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Main Content */
.main {
  flex: 1;
  padding: var(--space-md);
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 80px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: var(--space-sm) 0;
  padding-bottom: max(var(--space-sm), env(safe-area-inset-bottom));
  z-index: 100;
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  max-width: 600px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-system);
  font-size: 0.65rem;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item-icon {
  font-size: 1.4rem;
  line-height: 1;
}

/* ═══ Cards ═══ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--touch-min);
  padding: var(--space-md) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-system);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-primary:active:not(:disabled) {
  background: var(--accent-dim);
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:active:not(:disabled) {
  background: var(--border);
  transform: scale(0.98);
}

.btn-sm {
  min-height: 36px;
  padding: var(--space-sm) var(--space-md);
  font-size: 0.85rem;
}

/* ═══ Input Group ═══ */
.input-group {
  margin-bottom: var(--space-md);
}

.input-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-field {
  width: 100%;
  min-height: var(--touch-min);
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-system);
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-field::placeholder {
  color: var(--text-muted);
}

textarea.input-field {
  min-height: 120px;
}

/* ═══ Badges ═══ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pass {
  background: rgba(0, 230, 118, 0.15);
  color: var(--trust-verified);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.badge-fail {
  background: rgba(255, 82, 82, 0.15);
  color: var(--trust-unverified);
  border: 1px solid rgba(255, 82, 82, 0.3);
}

.badge-partial {
  background: rgba(255, 171, 0, 0.15);
  color: var(--trust-partial);
  border: 1px solid rgba(255, 171, 0, 0.3);
}

.badge-info {
  background: rgba(68, 138, 255, 0.15);
  color: var(--info);
  border: 1px solid rgba(68, 138, 255, 0.3);
}

.badge-muted {
  background: rgba(85, 85, 112, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(85, 85, 112, 0.3);
}

/* ═══ Result Card ═══ */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: border-color 0.3s;
}

.result-card.pass {
  border-color: rgba(0, 230, 118, 0.4);
}

.result-card.fail {
  border-color: rgba(255, 82, 82, 0.4);
}

.result-card.partial {
  border-color: rgba(255, 171, 0, 0.4);
}

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.result-card-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 600;
  font-size: 0.95rem;
}

.result-card-icon {
  font-size: 1.3rem;
}

.result-card-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══ Trust Score Display ═══ */
.trust-score {
  text-align: center;
  padding: var(--space-xl) 0;
}

.trust-level {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-xs);
}

.trust-level.verified { color: var(--trust-verified); }
.trust-level.partial { color: var(--trust-partial); }
.trust-level.unverified { color: var(--trust-unverified); }
.trust-level.unknown { color: var(--trust-unknown); }

.trust-label {
  font-size: 1.1rem;
  font-weight: 600;
}

.trust-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: var(--space-md) 0;
}

.trust-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s ease-out;
}

/* ═══ Primitive Cards Grid ═══ */
.primitive-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

@media (min-width: 480px) {
  .primitive-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.primitive-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.primitive-card.primitive-pass {
  border-color: rgba(0, 230, 118, 0.3);
}

.primitive-card.primitive-fail {
  border-color: rgba(255, 82, 82, 0.3);
}

.primitive-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.primitive-info {
  flex: 1;
  min-width: 0;
}

.primitive-name {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.primitive-question {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ═══ Test List ═══ */
.test-list {
  list-style: none;
}

.test-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}

.test-item:last-child {
  border-bottom: none;
}

.test-icon {
  font-size: 0.9rem;
  line-height: 1.5;
  flex-shrink: 0;
}

.test-pass { color: var(--trust-verified); }
.test-fail { color: var(--trust-unverified); }
.test-warn { color: var(--trust-partial); }

/* ═══ Quick-load Buttons ═══ */
.quick-load-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

@media (min-width: 480px) {
  .quick-load-group {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.quick-load-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.2s;
  min-height: var(--touch-min);
  text-align: left;
  color: var(--text-primary);
  font-family: var(--font-system);
}

.quick-load-btn:active {
  border-color: var(--accent);
}

.quick-load-btn-label {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.quick-load-btn-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* ═══ History ═══ */
.history-item {
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  min-height: var(--touch-min);
}

.history-item:active {
  border-color: var(--accent);
}

.history-claim {
  font-size: 0.875rem;
  margin-bottom: var(--space-xs);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ═══ Stats Grid ═══ */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm);
  text-align: center;
}

.stats-grid-item {
  padding: var(--space-sm);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
}

.stats-grid-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-grid-value {
  font-size: 1.1rem;
  font-weight: 700;
}

.stats-grid-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ═══ ICS Tier Summary ═══ */
.tier-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  text-align: center;
}

/* ═══ Empty State ═══ */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.empty-state-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ═══ Offline Banner ═══ */
.offline-banner {
  background: var(--warning);
  color: var(--bg-primary);
  text-align: center;
  padding: var(--space-xs) var(--space-md);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ═══ Utility ═══ */
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

/* ═══ Animations ═══ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeIn 0.25s ease-out;
}

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
