/* Sammenlign kommuner — VS / MULTI / RANKING.
   Portet fra originalens (avdekk.no/sammenlign.html) stilblokk, men scopet under
   `.saml-app` så ingenting lekker ut i den delte shell-en (nav/footer/andre sider).
   Variabler defineres på containeren; hero/body/footer fra originalen er droppet
   (Rust-siden har egen hero/footer). */
.saml-app {
  --midnight: #0a0f1e; --slate: #141b2d; --deep-blue: #1a2340; --arctic-blue: #2a3a5c;
  --frost: #8ba4c4; --ice: #c8d8e8; --snow: #edf2f7; --white: #f8fafc; --pure-white: #ffffff;
  --sami-red: #c73e3a; --sami-red-light: #e65550; --sami-blue: #2c5aa0;
  --sami-yellow: #d4a843; --sami-green: #3a7d5c;
  --color-a: #818cf8; --color-b: #f59e0b;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  display: block;
}

/* Mode tabs */
.saml-app .mode-tabs { max-width: 1280px; margin: 0 auto; padding: 1rem 0 0; display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }
.saml-app .mode-tab { padding: 0.6rem 1.4rem; border-radius: 8px; font-size: 0.82rem; font-weight: 500; color: var(--frost); background: rgba(139,164,196,0.06); border: 1px solid rgba(139,164,196,0.1); cursor: pointer; transition: all 0.2s; font-family: var(--font-body); }
.saml-app .mode-tab:hover { background: rgba(139,164,196,0.1); color: var(--ice); }
.saml-app .mode-tab.active { background: rgba(129,140,248,0.15); border-color: rgba(129,140,248,0.3); color: var(--color-a); }

/* Mode sections */
.saml-app .mode-section { display: none; }
.saml-app .mode-section.active { display: block; }

/* Picker (mode: vs) */
.saml-app .picker-section { max-width: 1280px; margin: 0 auto; padding: 2rem 0 3rem; }
.saml-app .picker-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.5rem; align-items: end; }
.saml-app .picker-box { position: relative; }
.saml-app .picker-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 0.5rem; }
.saml-app .picker-label.a { color: var(--color-a); }
.saml-app .picker-label.b { color: var(--color-b); }
.saml-app .picker-input { width: 100%; padding: 0.75rem 1rem; background: rgba(139,164,196,0.06); border: 1px solid rgba(139,164,196,0.12); border-radius: 10px; color: var(--pure-white); font-size: 0.95rem; font-family: var(--font-body); outline: none; transition: all 0.3s; }
.saml-app .picker-input:focus { border-color: rgba(129,140,248,0.4); background: rgba(139,164,196,0.1); }
.saml-app .picker-input::placeholder { color: var(--frost); opacity: 0.5; }
.saml-app .picker-dropdown { position: absolute; top: 100%; left: 0; right: 0; max-height: 260px; overflow-y: auto; background: var(--slate); border: 1px solid rgba(139,164,196,0.15); border-radius: 10px; margin-top: 4px; display: none; z-index: 50; }
.saml-app .picker-dropdown.open { display: block; }
.saml-app .picker-option { padding: 0.6rem 1rem; cursor: pointer; font-size: 0.88rem; color: var(--ice); transition: background 0.15s; display: flex; justify-content: space-between; }
.saml-app .picker-option:hover { background: rgba(129,140,248,0.1); }
.saml-app .picker-option .pop { font-size: 0.75rem; color: var(--frost); }
.saml-app .picker-vs { font-family: var(--font-display); font-size: 1.5rem; color: var(--frost); align-self: center; padding-bottom: 0.5rem; }

/* Results (mode: vs) */
.saml-app .results { max-width: 1280px; margin: 0 auto; padding: 0; display: none; }
.saml-app .results.visible { display: block; }
.saml-app .comp-section { margin-bottom: 3rem; }
.saml-app .comp-section-title { font-family: var(--font-display); font-size: 1.4rem; color: var(--pure-white); margin-bottom: 1.5rem; }
.saml-app .comp-section-title em { font-style: italic; color: var(--frost); }
.saml-app .comp-row { display: grid; grid-template-columns: 1fr 200px 1fr; gap: 0; margin-bottom: 2px; min-height: 48px; }
.saml-app .comp-val { display: flex; align-items: center; padding: 0.6rem 1rem; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.saml-app .comp-val.a { justify-content: flex-end; text-align: right; background: rgba(129,140,248,0.04); border-radius: 8px 0 0 8px; }
.saml-app .comp-val.b { justify-content: flex-start; background: rgba(245,158,11,0.04); border-radius: 0 8px 8px 0; }
.saml-app .comp-val.winner { font-weight: 700; color: var(--pure-white); }
.saml-app .comp-val.a.winner { background: rgba(129,140,248,0.12); }
.saml-app .comp-val.b.winner { background: rgba(245,158,11,0.12); }
.saml-app .comp-label { display: flex; align-items: center; justify-content: center; text-align: center; padding: 0.6rem 0.5rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--frost); background: rgba(139,164,196,0.04); }
.saml-app .comp-header { display: grid; grid-template-columns: 1fr 200px 1fr; gap: 0; margin-bottom: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid rgba(139,164,196,0.1); position: sticky; top: 60px; z-index: 20; background: rgba(13,18,36,0.97); backdrop-filter: blur(10px); }
.saml-app .comp-header-name { font-family: var(--font-display); font-size: 1.1rem; padding: 0.4rem 1rem; }
.saml-app .comp-header-name.a { text-align: right; color: var(--color-a); }
.saml-app .comp-header-name.b { color: var(--color-b); }
.saml-app .comp-header-center { display: flex; align-items: center; justify-content: center; font-size: 0.72rem; color: var(--frost); text-transform: uppercase; letter-spacing: 0.1em; }
.saml-app .comp-bar-row { display: grid; grid-template-columns: 1fr 200px 1fr; gap: 0; margin-bottom: 6px; align-items: center; }
.saml-app .comp-bar { height: 24px; border-radius: 4px; display: flex; align-items: center; padding: 0 8px; font-size: 0.72rem; color: rgba(255,255,255,0.9); min-width: 2px; transition: width 0.8s cubic-bezier(0.25,0.46,0.45,0.94); white-space: nowrap; overflow: visible; }
.saml-app .comp-bar.a { justify-content: flex-end; background: linear-gradient(270deg, rgba(129,140,248,0.6), rgba(129,140,248,0.3)); margin-left: auto; border-radius: 4px 0 0 4px; }
.saml-app .comp-bar.b { background: linear-gradient(90deg, rgba(245,158,11,0.6), rgba(245,158,11,0.3)); border-radius: 0 4px 4px 0; }
.saml-app .comp-bar-label { display: flex; align-items: center; justify-content: center; font-size: 0.68rem; color: var(--frost); text-transform: uppercase; letter-spacing: 0.06em; }
.saml-app .score-summary { display: flex; gap: 2rem; justify-content: center; margin: 2rem 0; flex-wrap: wrap; }
.saml-app .score-card { background: rgba(139,164,196,0.04); border: 1px solid rgba(139,164,196,0.08); border-radius: 14px; padding: 1.5rem 2.5rem; text-align: center; min-width: 200px; }
.saml-app .score-card.a { border-color: rgba(129,140,248,0.2); }
.saml-app .score-card.b { border-color: rgba(245,158,11,0.2); }
.saml-app .score-name { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 0.3rem; }
.saml-app .score-name.a { color: var(--color-a); }
.saml-app .score-name.b { color: var(--color-b); }
.saml-app .score-value { font-family: var(--font-display); font-size: 2.2rem; color: var(--pure-white); }
.saml-app .score-label { font-size: 0.72rem; color: var(--frost); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.3rem; }

/* Divider */
.saml-app .divider { max-width: 1280px; margin: 0 auto; }
.saml-app .divider-line { height: 1px; background: linear-gradient(90deg, transparent, rgba(139,164,196,0.15), transparent); }

/* Placeholder */
.saml-app .placeholder { text-align: center; padding: 4rem 2rem; color: var(--frost); max-width: 1280px; margin: 0 auto; }
.saml-app .placeholder-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.saml-app .placeholder-text { font-size: 1rem; }

/* ===== MULTI MODE ===== */
.saml-app .multi-section { max-width: 1280px; margin: 0 auto; padding: 1.5rem 0 4rem; }
.saml-app .multi-picker-wrap { position: relative; max-width: 500px; margin: 0 auto 1.5rem; }
.saml-app .multi-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; min-height: 28px; }
.saml-app .chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.7rem; background: rgba(129,140,248,0.12); border: 1px solid rgba(129,140,248,0.25); border-radius: 100px; font-size: 0.78rem; color: var(--color-a); }
.saml-app .chip-x { cursor: pointer; opacity: 0.6; font-size: 0.9rem; line-height: 1; transition: opacity 0.15s; }
.saml-app .chip-x:hover { opacity: 1; }
.saml-app .multi-hint { font-size: 0.75rem; color: var(--frost); opacity: 0.6; text-align: center; margin-bottom: 1rem; }
.saml-app .multi-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(139,164,196,0.08); }
.saml-app .multi-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.saml-app .multi-sticky-hdr { position: fixed; top: 60px; z-index: 20; overflow: hidden; display: none; background: rgba(13,18,36,0.97); backdrop-filter: blur(10px); border-bottom: 2px solid rgba(139,164,196,0.12); border-left: 1px solid rgba(139,164,196,0.08); border-right: 1px solid rgba(139,164,196,0.08); }
.saml-app .multi-sticky-hdr .multi-table { margin: 0; }
.saml-app .multi-table th { padding: 0.7rem 0.8rem; text-align: center; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--frost); background: rgba(13,18,36,0.97); backdrop-filter: blur(10px); white-space: nowrap; border-bottom: 1px solid rgba(139,164,196,0.08); }
.saml-app .multi-table th.ind-col { text-align: left; min-width: 160px; }
.saml-app .multi-table td { padding: 0.55rem 0.8rem; text-align: center; font-variant-numeric: tabular-nums; border-bottom: 1px solid rgba(139,164,196,0.04); }
.saml-app .multi-table td.ind-col { text-align: left; font-size: 0.75rem; font-weight: 500; color: var(--frost); text-transform: uppercase; letter-spacing: 0.04em; }
.saml-app .multi-table td.best { color: #22c55e; font-weight: 700; }
.saml-app .multi-table td.worst { color: var(--sami-red-light); opacity: 0.7; }
.saml-app .multi-table tr.cat-row td { background: rgba(129,140,248,0.06); font-family: var(--font-display); font-size: 0.88rem; color: var(--pure-white); text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid rgba(139,164,196,0.08); }
.saml-app .multi-table tr:hover td:not(.ind-col) { background: rgba(139,164,196,0.04); }
.saml-app .multi-table th a { color: var(--color-a); text-decoration: none; font-size: 0.8rem; font-family: var(--font-display); text-transform: none; letter-spacing: 0; }
.saml-app .multi-table th a:hover { text-decoration: underline; }

/* ===== RANKING MODE ===== */
.saml-app .ranking-section { max-width: 1280px; margin: 0 auto; padding: 1.5rem 0 4rem; }
.saml-app .controls { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.saml-app .search-wrap { position: relative; flex: 1; min-width: 220px; }
.saml-app .search-input { width: 100%; padding: 0.65rem 1rem 0.65rem 2.4rem; background: rgba(139,164,196,0.06); border: 1px solid rgba(139,164,196,0.12); border-radius: 8px; color: var(--pure-white); font-size: 0.88rem; font-family: var(--font-body); outline: none; transition: border-color 0.2s; }
.saml-app .search-input:focus { border-color: rgba(129,140,248,0.4); }
.saml-app .search-input::placeholder { color: var(--frost); opacity: 0.5; }
.saml-app .search-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--frost); opacity: 0.5; font-size: 0.85rem; }
.saml-app .cat-btn { padding: 0.5rem 0.9rem; border-radius: 8px; font-size: 0.78rem; font-weight: 500; color: var(--frost); background: rgba(139,164,196,0.06); border: 1px solid rgba(139,164,196,0.1); cursor: pointer; transition: all 0.2s; font-family: var(--font-body); white-space: nowrap; }
.saml-app .cat-btn:hover { background: rgba(139,164,196,0.1); }
.saml-app .cat-btn.active { background: rgba(129,140,248,0.15); border-color: rgba(129,140,248,0.3); color: var(--color-a); }
.saml-app .results-count { font-size: 0.78rem; color: var(--frost); margin-bottom: 0.5rem; }
.saml-app .rank-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid rgba(139,164,196,0.08); }
.saml-app .rank-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.saml-app .rank-table th { padding: 0.7rem 0.8rem; font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--frost); background: rgba(139,164,196,0.04); cursor: pointer; user-select: none; white-space: nowrap; text-align: right; border-bottom: 1px solid rgba(139,164,196,0.08); transition: color 0.15s; }
.saml-app .rank-table th:hover { color: var(--ice); }
.saml-app .rank-table th.sorted { color: var(--color-a); }
.saml-app .rank-table th .sort-arrow { margin-left: 0.2rem; font-size: 0.6rem; }
.saml-app .rank-table th.t-left { text-align: left; }
.saml-app .rank-table td { padding: 0.55rem 0.8rem; font-variant-numeric: tabular-nums; text-align: right; border-bottom: 1px solid rgba(139,164,196,0.04); }
.saml-app .rank-table tr:hover td { background: rgba(139,164,196,0.04); }
.saml-app .rank { font-weight: 600; color: var(--frost); width: 36px; text-align: center; }
.saml-app .name-cell { text-align: left !important; }
.saml-app .name-cell a { color: var(--ice); text-decoration: none; transition: color 0.15s; }
.saml-app .name-cell a:hover { color: var(--color-a); }
.saml-app .fylke-cell { text-align: left !important; font-size: 0.75rem; color: var(--frost); }
.saml-app .pos { color: #22c55e; }
.saml-app .neg { color: var(--sami-red-light); }

@media (max-width: 768px) {
  .saml-app .picker-grid { grid-template-columns: 1fr; }
  .saml-app .picker-vs { display: none; }
  .saml-app .comp-row, .saml-app .comp-header, .saml-app .comp-bar-row { grid-template-columns: 1fr 120px 1fr; }
  .saml-app .comp-label, .saml-app .comp-bar-label { font-size: 0.6rem; padding: 0.4rem 0.2rem; }
  .saml-app .comp-val { font-size: 0.8rem; padding: 0.5rem 0.6rem; }
  .saml-app .score-summary { gap: 1rem; }
  .saml-app .score-card { padding: 1rem 1.5rem; min-width: 140px; }
  .saml-app .mode-tab { font-size: 0.75rem; padding: 0.5rem 1rem; }
  .saml-app .controls { gap: 0.5rem; }
  .saml-app .cat-btn { font-size: 0.7rem; padding: 0.4rem 0.7rem; }
  .saml-app .fylke-cell { display: none; }
}
