:root {
  --primary: #2563eb;
  --secondary: #1e40af;
  --accent: #fbbf24;
  --background: #f3f4f6;
  --background-soft: #e5e7eb;
  --text: #0f172a;
  --muted-text: #6b7280;
  --card-bg: #ffffff;
  --sidebar-width: 280px;
  --success: #dcfce7;
  --success-text: #166534;
  --info: #dbeafe;
  --info-text: #1e40af;
  --warning: #fef9c3;
  --warning-text: #854d0e;
}

:root[data-theme="dark"] {
  --background: #020617;
  --background-soft: #020617;
  --text: #e5e7eb;
  --muted-text: #9ca3af;
  --card-bg: #020617;
  --primary: #60a5fa;
  --secondary: #1d4ed8;
  --accent: #facc15;
  --info: #1e293b;
  --info-text: #bfdbfe;
  --success: #064e3b;
  --success-text: #bbf7d0;
  --warning: #422006;
  --warning-text: #facc15;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, SF Pro Text, Segoe UI, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--background);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--card-bg);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  box-shadow: 4px 0 24px rgba(0,0,0,0.05);
  padding: 2rem 2rem 3rem;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.45);
}

.logo-compass {
  font-size: 1.3rem;
}

.logo-text h2 {
  color: var(--primary);
  font-size: 1.6rem;
  margin: 0 0 0.1rem;
  letter-spacing: -0.03em;
}

.logo-text p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted-text);
}

.logo-contact a {
  color: var(--primary);
  font-size: 0.8rem;
  text-decoration: none;
}

.logo-contact a:hover {
  text-decoration: underline;
}

.sidebar-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-text);
  margin: 1.5rem 0 0.5rem;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.6rem 0.9rem;
  color: #4b5563;
  text-decoration: none;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}

.sidebar-nav a:hover {
  background: var(--info);
  color: var(--primary);
}

.sidebar-nav a.active {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

.theme-toggle {
  margin-top: 2rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-toggle:hover {
  border-color: var(--primary);
}

.hamburger {
  display: none;
  background: var(--card-bg);
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  padding: 0.7rem;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 200;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 3rem 4rem;
  flex: 1;
  max-width: 960px;
}

.main-inner {
  max-width: 70ch;
}

h1 {
  font-size: clamp(1.9rem, 2.3vw + 1.5rem, 2.4rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  color: #0b1120;
}

h2 {
  font-size: clamp(1.45rem, 1.2vw + 1.1rem, 1.8rem);
  letter-spacing: -0.01em;
  margin: 2rem 0 0.6rem;
  color: #111827;
}

h3 {
  font-size: 1.2rem;
  margin: 1.4rem 0 0.4rem;
  color: #1f2937;
}

:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3 {
  color: var(--text);
}

p {
  font-size: 1rem;
  margin-bottom: 0.9rem;
  color: var(--text);
}

.lead {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 1.4rem;
}

ul {
  margin: 0 0 1.2rem 1.2rem;
}

ul li {
  margin-bottom: 0.4rem;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.metric-box {
  background: var(--card-bg);
  padding: 1.4rem 1.4rem 1.2rem;
  border-radius: 1rem;
  box-shadow: 0 6px 18px rgba(15,23,42,0.09);
}

.metric-label {
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  color: var(--muted-text);
  margin-bottom: 0.4rem;
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.metric-note {
  font-size: 0.9rem;
  color: var(--muted-text);
  margin-top: 0.3rem;
}

.info-box {
  padding: 1.3rem 1.4rem;
  border-radius: 0.9rem;
  margin: 1.4rem 0;
  border-left: 4px solid #e5e7eb;
  background: var(--card-bg);
}

.info-box-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.info-box-success {
  background: var(--success);
  border-color: var(--success-text);
  color: var(--success-text);
}

.info-box-info {
  background: var(--info);
  border-color: var(--info-text);
  color: var(--info-text);
}

.info-box-warning {
  background: var(--warning);
  border-color: var(--warning-text);
  color: var(--warning-text);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 0.9rem;
  overflow: hidden;
  margin: 1.6rem 0;
  box-shadow: 0 10px 30px rgba(15,23,42,0.08);
}

th, td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(226,232,240,0.9);
  font-size: 0.95rem;
}

th {
  background: #f9fafb;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

/* 🚀 FIX: Expander arrows (perfekt rotation, inga ikoner) */
.expander {
  background: var(--card-bg);
  border-radius: 0.9rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(15,23,42,0.08);
  overflow: hidden;
  border: 1px solid rgba(226,232,240,0.9);
}

.expander-header {
  padding: 1.1rem 1.3rem;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.expander-header:hover {
  background: #f9fafb;
}

.expander-content {
  padding: 0 1.3rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease;
}

.expander.open .expander-content {
  padding: 0 1.3rem 1.1rem;
  max-height: 2000px;
  transition: max-height 0.4s ease-in;
}

.expander-arrow {
  font-size: 1.1rem;
  color: var(--muted-text);
  transition: transform 0.3s ease;
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  text-align: center;
  line-height: 1.2;
}

.expander.open .expander-arrow {
  transform: rotate(180deg);
}

.site-footer {
  margin-top: auto;
  margin-left: var(--sidebar-width);
  background: #0f172a;
  color: #f3f4f6;
  padding: 3rem 2rem 1.8rem;
}

.footer-content {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 2.5rem;
}

.footer-section h3 {
  color: var(--card-bg);
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 0.7rem;
}

.footer-section p {
  font-size: 0.9rem;
  color: #9ca3af;
}

.footer-section a {
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-section a:hover {
  color: var(--card-bg);
}

.disclaimer {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-top: 1rem;
}

.footer-bottom {
  text-align: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #1f2937;
  color: #6b7280;
  font-size: 0.85rem;
}

/* Mobil */
@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 2.5rem 1.3rem 2rem;
  }
  
  .site-footer {
    margin-left: 0;
  }
  
  .hamburger {
    display: block;
  }
  
  .main-inner {
    max-width: 100%;
  }
}



/* ===== METRICS 2.0 – färg, skugga, hover, animation ===== */
.fade-in{opacity:0;animation:fadeIn .6s ease-out forwards;}
@keyframes fadeIn{to{opacity:1;}}
.metric-box{flex:1 1 260px;padding:1.4rem;border-radius:16px;position:relative;background:var(--card-bg);border:1px solid var(--border);transition:transform .25s,box-shadow .25s;}
.hover-up:hover{transform:translateY(-6px);box-shadow:0 12px 22px rgba(0,0,0,.12);}
.metric-icon{font-size:2.2rem;margin-bottom:.6rem;}
.metric-female{background:linear-gradient(135deg,rgba(172,120,255,.20),rgba(172,120,255,.08));border-color:rgba(172,120,255,.35);}
.metric-male{background:linear-gradient(135deg,rgba(60,140,255,.25),rgba(60,140,255,.10));border-color:rgba(60,140,255,.35);}
.metric-both{background:linear-gradient(135deg,rgba(80,200,180,.28),rgba(80,200,180,.10));border-color:rgba(80,200,180,.35);}
.metric-desc{margin-top:6px;color:var(--text-secondary);line-height:1.45;}

/* Mobile improvements */
.hamburger { top: 1.2rem; right: 1.2rem; z-index:2000; }
table { table-layout: fixed; width:100%; }
table td, table th { word-break: break-word; vertical-align: top; }
.table-wrapper { overflow-x:auto; }
[data-theme="dark"] a { color:#4EA8FF; }
[data-theme="dark"] a:hover { color:#82C8FF; }
.main-inner { padding:1.5rem; padding-bottom:4rem; }

/* --- Dark Mode Full Redesign --- */
[data-theme="dark"] {
    --background: #0f172a;
    --card-bg: #1e293b;
    --text: #f1f5f9;
    --border: rgba(255,255,255,0.08);
}

/* Apply variables globally */
body[data-theme="dark"] {
    background: var(--background);
    color: var(--text);
}

/* Cards and containers */
[data-theme="dark"] .info-box,
[data-theme="dark"] .expander,
[data-theme="dark"] .metric-box,
[data-theme="dark"] .card,
[data-theme="dark"] .main-inner {
    background: var(--card-bg);
    color: var(--text);
    border-color: var(--border);
}

/* Tables */
[data-theme="dark"] table {
    background: #0f172a;
    color: #e2e8f0;
}
[data-theme="dark"] th {
    background: #1e293b;
    color: #f1f5f9;
}
[data-theme="dark"] td {
    color: #e2e8f0;
}

/* Links */
[data-theme="dark"] a {
    color:#4EA8FF;
}
[data-theme="dark"] a:hover {
    color:#82C8FF;
}

/* Hero / section backgrounds */
[data-theme="dark"] .hero,
[data-theme="dark"] .section-bg {
    background: #0f172a !important;
    box-shadow: none !important;
}

/* Sidebar */
[data-theme="dark"] .sidebar {
    background:#0b1525;
    color:var(--text);
}
