/* ==========================================================================
   Design System & Theme Tokens - Trestní Dilemata ČR
   ========================================================================== */

:root,
[data-theme="dark"] {
  /* Color Palette - Dark */
  --bg-main: #0c1017;
  --bg-surface: #141b26;
  --bg-surface-raised: #1c2636;
  --bg-surface-hover: #233044;
  --bg-glass: rgba(20, 27, 38, 0.85);

  --border-subtle: #233043;
  --border-medium: #33435c;
  --border-focus: #4b6a96;

  --text-primary: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0c1017;

  /* Accent & Severity colors */
  --accent-primary: #38bdf8;
  --accent-primary-hover: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.15);

  --sev-extreme: #f43f5e;
  --sev-high: #fb923c;
  --sev-medium: #facc15;
  --sev-low: #34d399;

  --badge-bg: #1e293b;
  --badge-border: #334155;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Layout & Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, 0.5);

  --bg-box-subtle: rgba(12, 16, 23, 0.6);
  --bg-box-raised: rgba(28, 38, 54, 0.6);
  --stat-bar-bg: #0f172a;
  --brand-icon-bg: linear-gradient(135deg, #1e293b, #0f172a);
  --bg-gradient: 
    radial-gradient(ellipse at 50% 0%, rgba(30, 48, 77, 0.35) 0%, transparent 65%),
    radial-gradient(ellipse at 80% 80%, rgba(18, 30, 49, 0.25) 0%, transparent 60%);
  --modal-backdrop-bg: rgba(10, 15, 29, 0.75);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  /* Color Palette - Light */
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-raised: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.88);

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #0284c7;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Accent & Severity colors */
  --accent-primary: #0284c7;
  --accent-primary-hover: #0369a1;
  --accent-glow: rgba(2, 132, 199, 0.12);

  --sev-extreme: #e11d48;
  --sev-high: #ea580c;
  --sev-medium: #d97706;
  --sev-low: #059669;

  --badge-bg: #f1f5f9;
  --badge-border: #cbd5e1;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.12);

  --bg-box-subtle: #f1f5f9;
  --bg-box-raised: #f8fafc;
  --stat-bar-bg: #e2e8f0;
  --brand-icon-bg: linear-gradient(135deg, #e0f2fe, #bae6fd);
  --bg-gradient: 
    radial-gradient(ellipse at 50% 0%, rgba(224, 242, 254, 0.7) 0%, transparent 65%),
    radial-gradient(ellipse at 80% 80%, rgba(241, 245, 249, 0.6) 0%, transparent 60%);
  --modal-backdrop-bg: rgba(15, 23, 42, 0.5);
}

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

html {
  font-size: 16px;
  color-scheme: dark;
  scroll-behavior: smooth;
}

html[data-theme="light"] {
  color-scheme: light;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1.5rem;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--brand-icon-bg);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface-raised);
  color: var(--accent-primary);
  border: 1px solid var(--border-medium);
}

.nav-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--bg-surface);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: inherit;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-raised);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-surface-raised);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-medium);
}

.nav-tab .tab-icon {
  font-size: 1rem;
  opacity: 0.85;
}

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

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.48rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface-raised);
  border-color: var(--border-medium);
  transform: translateY(-1px);
}

.theme-toggle-btn:active {
  transform: translateY(0);
}

.theme-toggle-icon {
  font-size: 1rem;
  line-height: 1;
  display: inline-block;
  transition: transform var(--transition-normal);
}

.theme-toggle-btn:hover .theme-toggle-icon {
  transform: rotate(15deg) scale(1.1);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

.app-main {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Duel / Comparison Arena
   ========================================================================== */

.arena-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.arena-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.arena-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 680px;
  margin: 0 auto;
}

.duel-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.progress-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-pill .count {
  font-weight: 700;
  color: var(--accent-primary);
}

.keyboard-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kbd {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.matchup-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: stretch;
  position: relative;
}

.versus-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.vs-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface-raised);
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  letter-spacing: 0.05em;
}

.vs-line {
  flex: 1;
  width: 2px;
  background: var(--border-subtle);
}

/* ==========================================================================
   Crime Cards
   ========================================================================== */

.crime-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all var(--transition-normal);
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.crime-card:hover:not(.revealed) {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-glow);
  background: var(--bg-surface-hover);
}

.crime-card:hover:not(.revealed) .card-cta-btn {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
}

.card-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.card-category-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.card-option-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-medium);
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.card-paragraph {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-primary);
  font-family: var(--font-mono);
  margin-bottom: 1.25rem;
}

.card-scenario-box {
  background: var(--bg-box-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  flex: 1;
}

.scenario-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.scenario-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.55;
}

.card-cta-btn {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
}

/* Card Selection & Reveal States */
.crime-card.selected-user {
  border-color: var(--accent-primary);
  background: var(--bg-surface-raised);
  box-shadow: 0 0 0 2px var(--accent-primary), var(--shadow-lg);
}

.crime-card.revealed {
  cursor: default;
}

/* ==========================================================================
   Reveal Details (Law, Court Stats, Harm Analysis)
   ========================================================================== */

.reveal-container {
  display: none;
  animation: fadeIn 0.4s ease-out;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}

.crime-card.revealed .reveal-container {
  display: block;
}

.verdict-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.verdict-tag.stricter {
  background: rgba(244, 63, 94, 0.15);
  color: var(--sev-extreme);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.verdict-tag.milder {
  background: rgba(52, 211, 153, 0.15);
  color: var(--sev-low);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.verdict-tag.equal {
  background: rgba(250, 204, 21, 0.15);
  color: var(--sev-medium);
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.detail-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.statutory-box {
  background: var(--bg-box-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.statutory-sentence {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.statutory-legal-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
}

/* Court Statistics Section */
.court-stats-box {
  background: var(--bg-box-raised);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.court-stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.court-stats-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.stats-breakdown-bars {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  background: var(--stat-bar-bg);
}

.stat-bar-segment {
  height: 100%;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-bar-unconditional { background: #f43f5e; }
.stat-bar-probation { background: #38bdf8; }
.stat-bar-fine { background: #facc15; }
.stat-bar-other { background: #94a3b8; }

.stats-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem 0.75rem;
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-val {
  font-weight: 700;
  color: var(--text-primary);
  margin-left: auto;
}

.court-summary-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.5rem;
}

/* Harm Analysis */
.harm-analysis-box {
  background: var(--bg-box-subtle);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.75rem 0.9rem;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.harm-row {
  margin-bottom: 0.4rem;
}

.harm-row:last-child {
  margin-bottom: 0;
}

.harm-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.75rem;
}

.harm-desc {
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==========================================================================
   Post-Matchup Action Bar
   ========================================================================== */

.matchup-result-panel {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-top: 2rem;
  animation: fadeIn 0.4s ease-out;
  box-shadow: var(--shadow-lg);
}

.matchup-result-panel.visible {
  display: block;
}

.result-panel-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.result-verdict-summary {
  flex: 1;
  min-width: 280px;
}

.verdict-heading {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.verdict-explanation {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

/* ==========================================================================
   Ranking / Tier List View
   ========================================================================== */

.ranking-header {
  margin-bottom: 2rem;
}

.ranking-title {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.ranking-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.ranking-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.ranking-toggle-group {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.ranking-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.ranking-toggle-btn.active {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ranking-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  display: grid;
  grid-template-columns: 48px 1fr 180px 140px;
  align-items: center;
  gap: 1.25rem;
  transition: all var(--transition-fast);
}

.ranking-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  transform: translateX(4px);
}

.rank-position {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-mono);
}

.rank-position.top-1 { color: #facc15; }
.rank-position.top-2 { color: #cbd5e1; }
.rank-position.top-3 { color: #d97706; }

.rank-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.rank-crime-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rank-crime-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.rank-statutory {
  text-align: right;
}

.rank-statutory-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rank-statutory-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rank-court-stat {
  text-align: right;
  border-left: 1px solid var(--border-subtle);
  padding-left: 1rem;
}

.rank-court-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.rank-court-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Grafické srovnání 3 variant žebříčku (Comparison Matrix)
   ========================================================================== */

.comparison-view-toggle {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.comp-view-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.comp-view-btn.active {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.flow-perspective-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.flow-perspective-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.flow-perspective-btn:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.flow-perspective-btn.active {
  background: var(--bg-surface-raised);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.insights-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.insight-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.insight-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.insight-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.insight-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.comparison-matrix-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.matrix-header-row {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1.3fr 1.3fr 1.1fr;
  padding: 0.6rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.matrix-item-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 2fr 1.3fr 1.3fr 1.3fr 1.1fr;
  align-items: center;
  gap: 1rem;
  transition: all var(--transition-fast);
}

.matrix-item-row:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  transform: translateX(3px);
}

.matrix-crime-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.matrix-crime-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.matrix-crime-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.matrix-col-stat {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.rank-badge-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.rank-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.rank-badge.public { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.rank-badge.law { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.rank-badge.courts { background: rgba(52, 211, 153, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }

.mini-score-val {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.matrix-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.matrix-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

.matrix-bar-fill.public { background: #38bdf8; }
.matrix-bar-fill.law { background: #f59e0b; }
.matrix-bar-fill.courts { background: #34d399; }

.delta-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  width: fit-content;
}

.delta-badge.stricter-public {
  background: rgba(244, 63, 94, 0.15);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.delta-badge.milder-public {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.delta-badge.balanced {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.25);
}

@media (max-width: 950px) {
  .matrix-header-row,
  .matrix-item-row {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }
  .matrix-header-row > div:last-child,
  .matrix-item-row > div:last-child {
    display: none;
  }
}

@media (max-width: 720px) {
  .matrix-header-row {
    display: none;
  }
  .matrix-item-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   SVG Flow Chart (Bump / Parallel Coordinates)
   ========================================================================== */

.flow-interactive-legend {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.7rem 1.25rem;
  margin-bottom: 1.25rem;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  position: sticky;
  top: 72px;
  z-index: 20;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.flow-tooltip-content {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.flow-tooltip-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  flex-wrap: wrap;
}

.flow-tooltip-crime-name {
  font-weight: 700;
  color: var(--text-primary);
}

.flow-tooltip-paragraph {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.flow-tooltip-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  margin-left: auto;
}

.flow-tooltip-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.flow-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.flow-meta-item.public { color: #38bdf8; font-weight: 600; }
.flow-meta-item.user { color: #c084fc; font-weight: 600; }
.flow-meta-item.law { color: #fbbf24; font-weight: 600; }
.flow-meta-item.courts { color: #34d399; font-weight: 600; }
.flow-meta-sep { color: var(--text-muted); font-size: 0.75rem; }

.flow-svg-scroll-container {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
}

.flow-svg-canvas {
  width: 100%;
  min-width: 960px;
  height: auto;
  display: block;
}

.flow-path {
  fill: none;
  stroke-linecap: round;
  transition: stroke-width 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
  cursor: pointer;
}

.flow-node-group {
  cursor: pointer;
}

.flow-node-circle {
  transition: r 0.2s ease, stroke-width 0.2s ease;
}

.flow-node-group:hover text {
  font-weight: 800;
}

.flow-dimmed {
  opacity: 0.1 !important;
}

.flow-highlighted {
  opacity: 1.0 !important;
  stroke-width: 4.5px !important;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.75));
}

/* ==========================================================================
   Catalog & Encyclopedia
   ========================================================================== */

.catalog-header {
  margin-bottom: 2rem;
}

.catalog-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

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

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.category-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.category-select:focus {
  border-color: var(--accent-primary);
}

.catalog-methodology-box {
  background: var(--bg-surface-raised);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.methodology-box-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.catalog-methodology-box p {
  margin: 0 0 0.5rem;
}

.catalog-methodology-box p:last-child {
  margin-bottom: 0;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

.catalog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.catalog-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-medium);
  transform: translateY(-2px);
}

.catalog-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.catalog-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.catalog-card-p {
  font-size: 0.85rem;
  color: var(--accent-primary);
  font-family: var(--font-mono);
  margin-bottom: 0.85rem;
}

.catalog-scenario-brief {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 1rem;
  flex: 1;
}

/* ==========================================================================
   Profile & Statistics View
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.kpi-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.judge-persona-box {
  background: linear-gradient(135deg, var(--bg-surface-raised), var(--bg-surface));
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.judge-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.15);
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  flex-shrink: 0;
}

.judge-info h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.judge-info p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 1.75rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-sources {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--accent-primary);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 900px) {
  .matchup-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .versus-divider {
    flex-direction: row;
    padding: 0.5rem 0;
  }

  .vs-line {
    height: 2px;
    width: 100%;
  }

  .ranking-item {
    grid-template-columns: 36px 1fr 110px;
    gap: 0.75rem;
  }

  .rank-court-stat {
    display: none;
  }

  .judge-persona-box {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .header-container {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.75rem;
    align-items: center;
  }

  .brand {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
  }

  .header-actions {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    justify-self: end;
  }

  .nav-tabs {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    justify-content: space-between;
    width: 100%;
    overflow-x: auto;
  }

  .nav-tab {
    padding: 0.45rem 0.55rem;
    font-size: 0.78rem;
  }

  .theme-toggle-text {
    display: none;
  }

  .theme-toggle-btn {
    padding: 0.45rem 0.6rem;
  }

  .flow-interactive-legend {
    min-height: 84px;
    padding: 0.55rem 0.85rem;
    font-size: 0.82rem;
    top: 96px;
  }

  .flow-tooltip-title {
    font-size: 0.88rem;
  }

  .flow-tooltip-hint {
    display: none;
  }

  .flow-tooltip-meta {
    font-size: 0.76rem;
    gap: 0.35rem;
  }

  .arena-title {
    font-size: 1.5rem;
  }

  .crime-card {
    padding: 1.25rem;
  }

  .ranking-item {
    grid-template-columns: 30px 1fr;
  }

  .rank-statutory {
    display: none;
  }
}

/* ==========================================================================
   GDPR Cookie Banner & Privacy Modal
   ========================================================================== */

.cookie-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 900px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.cookie-banner-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cookie-text {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  flex: 1;
  min-width: 280px;
}

.cookie-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.cookie-text strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  color: var(--text-primary);
}

.cookie-text p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

.cookie-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Privacy Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop-bg);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}
