/*
 * OPTION 1A: "Snemovňa" (Parliament House)
 * ─────────────────────────────────────────────────────────────────────────────
 * AESTHETIC: Official Slovak Parliament — Institutional Dignity
 *
 * Inspired by European parliamentary architecture and official documents.
 * Formal serif typography, Slovak national colors subtly integrated,
 * structured layouts echoing the order of democratic institutions.
 *
 * Typography: Crimson Pro (dignified serif) + Public Sans (government clarity)
 * Colors: Parliamentary blue (#1e3a5f), document cream (#fdfbf7), Slovak red accent
 * ─────────────────────────────────────────────────────────────────────────────
 */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;500;600;700;800&family=Public+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #fdfbf7;
  --bg-alt: #f6f3ed;
  --bg-dark: #1e3a5f;
  --text: #1a2634;
  --text-secondary: #3d4f63;
  --muted: #6b7d8f;
  --border: #d1c9bc;
  --border-strong: #1e3a5f;
  --panel: #ffffff;
  --accent: #b71c1c;
  --accent-light: rgba(183, 28, 28, 0.08);
  --accent-gold: #c9a227;
  --success: #2e7d32;

  --font-display: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --shadow-subtle: 0 1px 3px rgba(30, 58, 95, 0.08);
  --shadow-medium: 0 4px 16px rgba(30, 58, 95, 0.1);
  --shadow-strong: 0 8px 32px rgba(30, 58, 95, 0.15);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Slovak tricolor top border */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(to bottom,
    #ffffff 0%, #ffffff 33.33%,
    #0b4ea2 33.33%, #0b4ea2 66.66%,
    #ee1c25 66.66%, #ee1c25 100%
  );
  z-index: 1000;
}

a {
  color: var(--bg-dark);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

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

button {
  font: inherit;
  color: inherit;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOPBAR & BRANDING
   ═══════════════════════════════════════════════════════════════════════════ */

.topbar {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: flex-start;
  margin-bottom: 24px;
  padding-top: 12px;
}

.brand {
  display: grid;
  gap: 6px;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--bg-dark);
}

.tagline {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HERO SECTION
   ═══════════════════════════════════════════════════════════════════════════ */

.hero {
  border: 1px solid var(--border);
  border-top: 4px solid var(--bg-dark);
  background: var(--panel);
  border-radius: 0 0 4px 4px;
  padding: 0;
  box-shadow: var(--shadow-medium);
}

.hero.hero-home {
  padding: 0;
}

.hero-block {
  display: grid;
  gap: 12px;
  padding: 20px 24px;
}

.hero-block + .hero-block {
  padding-top: 20px;
  margin-top: 0;
  border-top: 1px solid var(--border);
}

.hero-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM CONTROLS
   ═══════════════════════════════════════════════════════════════════════════ */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 0;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  align-items: end;
}

.control {
  display: grid;
  gap: 6px;
}

.controls label,
label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  font-size: 9px;
  font-weight: 700;
  font-style: italic;
  text-transform: none;
  color: var(--muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: help;
  position: relative;
  vertical-align: middle;
}

.info-icon:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

.info-icon:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  padding: 8px 12px;
  background: var(--bg-dark);
  color: white;
  font-size: 12px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  border-radius: 6px;
  box-shadow: var(--shadow-medium);
  z-index: 100;
  white-space: normal;
}

.info-icon:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--bg-dark);
  z-index: 100;
}

select,
input[type="search"],
input[type="number"] {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus,
input[type="search"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--bg-dark);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.hero-home input[type="search"] {
  width: 100%;
  max-width: 100%;
  font-size: 16px;
  padding: 14px 18px;
  border-width: 1px;
  border-color: var(--border-strong);
}

.hero-home input[type="search"]::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-top: 0;
}

.kpi {
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg-alt);
  padding: 16px 18px;
  text-align: center;
  box-shadow: none;
}

.kpi:last-child {
  border-right: none;
}

.kpi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.kpi-value {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--bg-dark);
  letter-spacing: -0.02em;
}

.hero-home .kpis {
  border-top: 1px solid var(--border);
  gap: 0;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PANELS & SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 28px;
}

.panel-a {
  border-radius: 0 0 4px 4px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--bg-dark);
  background: var(--panel);
  overflow: hidden;
  box-shadow: var(--shadow-medium);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--bg-dark);
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RANK LISTS
   ═══════════════════════════════════════════════════════════════════════════ */

.rank-list {
  padding: 0;
  display: grid;
  gap: 0;
}

.rank-row {
  width: 100%;
  text-align: left;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  padding: 14px 18px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  grid-template-columns: 36px 1fr 130px;
  gap: 14px;
  align-items: center;
  text-decoration: none;
  transition: background 0.15s;
  box-shadow: none;
}

.rank-row:last-child {
  border-bottom: none;
}

.rank-row:hover {
  background: var(--accent-light);
}

.rank {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.who .name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.who .sub {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.badge {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  border-radius: 3px;
  padding: 3px 10px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
}

.badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--club-color, hsl(var(--h) 50% 45%));
}

/* Selected club banner */
.selected-club-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 14px;
}

.selected-club-banner .banner-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.selected-club-banner .badge {
  background: var(--panel);
  border-color: var(--accent);
}

.selected-club-banner .banner-clear {
  margin-left: auto;
  padding: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.selected-club-banner .banner-clear:hover {
  background: var(--accent);
  color: white;
}

.score {
  text-align: right;
}

.score .pct {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--bg-dark);
}

.score .mini {
  margin-top: 8px;
  height: 6px;
  border-radius: 3px;
  border: none;
  overflow: hidden;
  background: var(--border);
}

.score .mini span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--club-color, var(--bg-dark));
  border-radius: 3px;
  transition: width 0.6s ease-out;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CLUB BARS
   ═══════════════════════════════════════════════════════════════════════════ */

.club-bars {
  padding: 0;
  display: grid;
  gap: 0;
}

.club-bar-row {
  width: 100%;
  text-align: left;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  padding: 14px 18px;
  cursor: pointer;
  color: var(--text);
  display: grid;
  grid-template-columns: 260px 1fr 80px;
  gap: 16px;
  align-items: center;
  transition: background 0.15s;
  box-shadow: none;
}

.club-bar-row:last-child {
  border-bottom: none;
}

.club-bar-row:hover {
  background: var(--accent-light);
}

.club-bar-row.active {
  background: var(--accent-light);
  box-shadow: inset 4px 0 0 var(--accent);
}

.club-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--club-color, hsl(var(--h) 50% 45%));
  flex-shrink: 0;
}

.club-mid .bar {
  height: 8px;
  border-radius: 4px;
  border: none;
  overflow: hidden;
  background: var(--border);
}

.club-mid .bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--club-color, var(--bg-dark));
  border-radius: 4px;
  transition: width 0.6s ease-out;
}

.club-right {
  text-align: right;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--bg-dark);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.mp-dialog::backdrop {
  background: rgba(30, 58, 95, 0.7);
  backdrop-filter: blur(4px);
}

.mp-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 980px;
  width: calc(100% - 40px);
}

.mp-modal {
  border-radius: 0 0 4px 4px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--bg-dark);
  background: var(--panel);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
}

.mp-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.mp-modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--bg-dark);
}

.mp-modal-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.mp-close {
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  transition: all 0.15s;
}

.mp-close:hover {
  background: var(--bg-dark);
  color: #fff;
  border-color: var(--bg-dark);
}

.mp-modal-body {
  padding: 22px;
}

.modal-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.mcard {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 14px 16px;
  text-align: center;
  box-shadow: none;
}

.mcard:last-child {
  border-right: none;
}

.mcard .k {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mcard .v {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--bg-dark);
}

.modal-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 22px;
}

.modal-split h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--bg-dark);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bg-dark);
}

.clubs-mini {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.club-mini {
  display: grid;
  gap: 8px;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  padding: 12px 14px;
  box-shadow: none;
}

.club-mini:last-child {
  border-bottom: none;
}

.club-mini-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.club-mini-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.club-mini-count {
  font-size: 12px;
  color: var(--muted);
}

.club-mini-bar {
  height: 5px;
  border-radius: 3px;
  border: none;
  overflow: hidden;
  background: var(--border);
}

.club-mini-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--bg-dark);
  border-radius: 3px;
}

.club-mini-rate {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--bg-dark);
}

.recent-mini {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.recent-mini-row {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 130px 1fr 46px;
  gap: 12px;
  align-items: center;
  box-shadow: none;
}

.recent-mini-row:last-child {
  border-bottom: none;
}

.recent-mini-row .d {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: none;
  padding: 0;
}

.recent-mini-row .t {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.recent-mini-row .c {
  text-align: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--bg-dark);
  padding: 4px 10px;
  border-radius: 3px;
  border: none;
}

.empty {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

.profile-link-row {
  margin-bottom: 14px;
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border: 1px solid var(--bg-dark);
  background: var(--panel);
  border-radius: 4px;
  padding: 10px 16px;
  color: var(--bg-dark);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
  box-shadow: none;
}

.profile-link:hover {
  background: var(--bg-dark);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ABOUT SECTION
   ═══════════════════════════════════════════════════════════════════════════ */

.about { padding-top: 0; }

.about-content {
  padding: 20px 24px 24px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}

.about-content p { margin: 0 0 14px; }

.about-content h3 {
  font-family: 'Crimson Pro', serif;
  font-size: 20px;
  font-weight: 700;
  margin: 24px 0 8px;
  color: var(--bg-dark);
}

.about-content ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.about-content li { margin-bottom: 6px; }

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */

.footer {
  color: var(--muted);
  font-size: 13px;
  padding-top: 24px;
  padding-bottom: 32px;
  border-top: 1px solid var(--border);
  margin-top: 28px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MP DETAIL PAGE HERO
   ═══════════════════════════════════════════════════════════════════════════ */

.hero-mp {
  padding: 24px;
}

.mp-hero {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 22px;
  align-items: start;
}

.mp-photo {
  width: 130px;
  height: 162px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-alt);
  display: grid;
  place-items: center;
}

.mp-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mp-hero-body {
  min-width: 0;
}

.hero-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--bg-dark);
}

.hero-sub {
  margin-top: 6px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.hero-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.hero-actions .control {
  display: grid;
  gap: 6px;
}

.hero-actions label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-mp .kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.hero-mp .meta {
  margin-top: 14px;
  padding: 0;
  background: transparent;
  border: none;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 980px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

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

  .kpis,
  .hero-home .kpis,
  .hero-mp .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi {
    border-bottom: 1px solid var(--border);
  }

  .mp-hero {
    grid-template-columns: 1fr;
  }

  .mp-photo {
    width: 100px;
    height: 125px;
  }

  .hero-top {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 26px;
  }

  .hero-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rank-row {
    grid-template-columns: 36px 1fr;
  }

  .score {
    grid-column: 1 / -1;
    margin-top: 8px;
    text-align: left;
  }

  .club-bar-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .club-right {
    text-align: left;
  }

  .modal-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mcard {
    border-bottom: 1px solid var(--border);
  }

  .modal-split {
    grid-template-columns: 1fr;
  }

  .recent-mini-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .recent-mini-row .c {
    justify-self: start;
  }

  .brand h1 {
    font-size: 30px;
  }

  .tagline {
    font-size: 15px;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 20px 16px;
  }

  .brand h1 {
    font-size: 26px;
  }

  .hero-block {
    padding: 16px;
  }

  .kpis,
  .hero-home .kpis,
  .hero-mp .kpis {
    grid-template-columns: 1fr;
  }

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

  .hero-actions {
    grid-template-columns: 1fr;
  }

  .modal-cards {
    grid-template-columns: 1fr;
  }
}
