/* ============================================================
   wyniki-dashboard / main.css
   Styl wzorowany na egzaminy.operon.pl – panel wyników
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700;900&family=Merriweather:wght@300;700&display=swap');

/* ── ZMIENNE ─────────────────────────────────────────────── */
:root {
  --green-dark:    #00746a;
  --green-mid:     #1f625f;
  --green-light:   #89b8b8;
  --green-pale:    #e8f4f3;
  --green-hover:   #005a52;
  --gray-dark:     #333333;
  --gray-mid:      #666666;
  --gray-light:    #f5f5f5;
  --border:        #d0e8e6;
  --border-gray:   #cccccc;
  --red:           #c0392b;
  --orange:        #e67e22;
  --white:         #ffffff;
  --font-main:     'Lato', sans-serif;
  --font-serif:    'Merriweather', serif;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:     0 2px 8px rgba(0,0,0,0.12);
  --radius:        2px;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--gray-dark);
  background: var(--gray-light);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── HEADER ──────────────────────────────────────────────── */
.page-header {
  background: var(--green-dark);
  color: var(--white);
  padding: 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo-box {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
  color: var(--white);
  text-decoration: none;
  white-space: nowrap;
}
.logo-box:hover { text-decoration: none; }
.logo-box span { color: var(--green-light); }
.header-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  border-left: 2px solid rgba(255,255,255,0.25);
  padding-left: 16px;
  line-height: 1.3;
}

/* ── NAV ─────────────────────────────────────────────────── */
.page-nav {
  background: var(--green-mid);
  border-bottom: 2px solid var(--green-hover);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }
.nav-inner a {
  display: block;
  padding: 10px 18px;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}
.nav-inner a:hover { background: var(--green-dark); color: var(--white); text-decoration: none; }
.nav-inner a.active { background: var(--green-hover); color: var(--white); }

/* ── LEVEL SELECTOR ──────────────────────────────────────── */
.level-selector {
  background: linear-gradient(135deg, var(--green-mid) 0%, var(--green-dark) 100%);
  border-bottom: 3px solid var(--green-hover);
  padding: 16px 0;
}
.level-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.level-label {
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.level-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.level-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  color: rgba(255,255,255,0.9);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.level-btn:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.4);
  transform: translateY(-1px);
}
.level-btn.active {
  background: var(--white);
  border-color: var(--white);
  color: var(--green-dark);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.level-btn.active:hover {
  transform: none;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 56px;
  flex: 1;
  width: 100%;
}

/* ── INTRO / ALERT BOX ───────────────────────────────────── */
.intro-text {
  background: var(--white);
  border-left: 4px solid var(--green-dark);
  padding: 13px 18px;
  margin-bottom: 20px;
  font-size: 13.5px;
  color: var(--gray-mid);
  line-height: 1.75;
  box-shadow: var(--shadow-sm);
}
.intro-text a { color: var(--green-dark); font-weight: 700; }

/* ── SELECT / CONTROL BAR ────────────────────────────────── */
.control-bar {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 11px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
}
.control-bar label {
  font-weight: 700;
  font-size: 13px;
  color: var(--gray-dark);
  white-space: nowrap;
}
.control-bar select { margin-right: 4px; }

select {
  border: 1px solid var(--border-gray);
  padding: 5px 10px;
  font-size: 13px;
  font-family: var(--font-main);
  background: var(--white);
  cursor: pointer;
  outline: none;
  border-radius: var(--radius);
  color: var(--gray-dark);
  transition: border-color 0.15s;
}
select:focus { border-color: var(--green-dark); box-shadow: 0 0 0 2px rgba(0,116,106,0.12); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 6px 16px;
  background: var(--green-dark);
  color: var(--white);
  border: 1px solid var(--green-dark);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  border-radius: var(--radius);
  white-space: nowrap;
  line-height: 1.5;
}
.btn:hover { background: var(--green-hover); border-color: var(--green-hover); color: var(--white); text-decoration: none; }

.btn-outline {
  background: var(--white);
  color: var(--green-dark);
}
.btn-outline:hover { background: var(--green-pale); color: var(--green-dark); }

/* ── SECTION CARD ────────────────────────────────────────── */
.section {
  background: var(--white);
  border: 1px solid var(--border);
  margin-bottom: 28px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.hidden {
  display: none!important;
}

.section-header {
  border-bottom: 2px solid var(--green-dark);
  padding: 13px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--white);
}
.section-header h2 {
  font-size: 15px;
  font-weight: 900;
  color: var(--green-dark);
  font-family: var(--font-main);
  line-height: 1.3;
}
.section-header h2 .subtitle {
  color: var(--gray-dark);
  font-weight: 400;
}
.section-body { padding: 20px; }

hr.section-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* ── KOMENTARZ (interpretacja) ───────────────────────────── */
.komentarz {
  font-size: 12.5px;
  color: var(--gray-mid);
  background: var(--green-pale);
  border-left: 3px solid var(--green-light);
  padding: 9px 14px;
  margin-top: 16px;
  line-height: 1.65;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.komentarz strong { color: var(--green-dark); }

/* ── CHART CONTAINERS ────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
}
.chart-wrap.h-xl  { height: 400px; }
.chart-wrap.h-lg  { height: 360px; }
.chart-wrap.h-md  { height: 300px; }
.chart-wrap.h-sm  { height: 240px; }
.chart-wrap.h-xs  { height: 180px; }

/* ── PRZEDMIOT SELECT AREA ───────────────────────────────── */
.przedmiot-bar {
  background: var(--green-pale);
  border: 1px solid var(--border);
  padding: 13px 18px;
  margin-bottom: 24px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.przedmiot-bar label {
  font-weight: 700;
  font-size: 13px;
  color: var(--green-dark);
  white-space: nowrap;
}
.przedmiot-bar select { min-width: 260px; }

/* ── MAP + LEGEND ────────────────────────────────────────── */
.map-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.map-col { flex: 0 0 400px; }

.polska-svg {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0 auto;
}

/* etykiety województw */
.woj-label {
  font-family: var(--font-main);
  font-size: 9.5px;
  fill: white;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: middle;
  font-weight: 700;
}

/* województwa – stany kolorów */
.woj-path {
  fill: var(--green-light);
  stroke: var(--white);
  stroke-width: 1px;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 0.18s, stroke-width 0.1s;
}
.woj-path:hover    { stroke-width: 2px; filter: brightness(0.88); }
.woj-path.selected { fill: var(--green-dark); }
.woj-path.heat-0   { fill: #e2f0ef; }
.woj-path.heat-1   { fill: #b8d9d7; }
.woj-path.heat-2   { fill: #7dbfbb; }
.woj-path.heat-3   { fill: #3da49f; }
.woj-path.heat-4   { fill: #1f8c85; }
.woj-path.heat-5   { fill: #00746a; }

.map-legend-col { flex: 1; min-width: 220px; }
.legend-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--green-dark);
}

/* ── TABLES ──────────────────────────────────────────────── */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.data-table th {
  background: var(--green-dark);
  color: var(--white);
  padding: 7px 11px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
}
table.data-table td {
  padding: 6px 11px;
  border-bottom: 1px solid var(--border);
}
table.data-table tbody tr:hover td { background: var(--green-pale); }
table.data-table td.num {
  font-weight: 700;
  color: var(--green-dark);
  text-align: right;
  white-space: nowrap;
}

/* mini-bar w tabeli */
.bar-cell { width: 90px; }
.mini-bar {
  height: 8px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.mini-bar-fill {
  height: 100%;
  background: var(--green-dark);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.mini-bar-fill.low  { background: #e67e22; }
.mini-bar-fill.high { background: var(--green-dark); }

/* staniny table */
table.stanina-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 16px;
}
table.stanina-table th {
  background: var(--green-dark);
  color: var(--white);
  padding: 7px 11px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
}
table.stanina-table td {
  padding: 6px 11px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
table.stanina-table tbody tr:nth-child(5) { background: #fffde7; font-weight: 700; }

/* mała tabelka interpretacji */
table.legend-table {
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 260px;
}
table.legend-table th {
  background: var(--green-mid);
  color: var(--white);
  padding: 6px 14px;
  font-size: 12px;
  text-align: left;
}
table.legend-table td {
  padding: 5px 14px;
  border: 1px solid var(--border);
}
table.legend-table tr:nth-child(even) td { background: var(--green-pale); }

/* ── NO DATA STATE ───────────────────────────────────────── */
.no-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 20px;
  color: var(--gray-mid);
  font-size: 13px;
  gap: 8px;
  text-align: center;
}
.no-data .no-data-icon {
  font-size: 32px;
  opacity: 0.3;
}

/* ── NO DATA BANNER ──────────────────────────────────────── */
.no-data-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 14px 20px;
  margin: 0 auto 20px;
  max-width: 900px;
  font-size: 14px;
  color: #664d03;
  line-height: 1.6;
  display: flex;
  align-items: center;
  gap: 10px;
}
.no-data-banner-icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* ── UTILITY CLASSES ─────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── LOADING SPINNER ─────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  color: var(--gray-mid);
  font-size: 13px;
  gap: 10px;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--green-dark);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── BADGE ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  line-height: 1.4;
}
.badge-green  { background: var(--green-dark);  color: var(--white); }
.badge-orange { background: var(--orange);       color: var(--white); }
.badge-gray   { background: #999;               color: var(--white); }
/* ── ERROR TOAST ─────────────────────────────────────────── */
#errorToast {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #c0392b;
  color: white;
  padding: 14px 28px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  z-index: 9999;
  max-width: 90%;
  text-align: center;
}
/* ── DWIE KOLUMNY (dla tabelek) ──────────────────────────── */
.two-col {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.two-col > * { flex: 1; min-width: 240px; }

/* ── FOOTER ──────────────────────────────────────────────── */
.page-footer {
  background: var(--green-dark);
  color: rgba(255,255,255,0.55);
  text-align: center;
  padding: 15px 20px;
  font-size: 12px;
  margin-top: auto;
}
.page-footer a { color: rgba(255,255,255,0.7); }

/* ── ERROR TOAST ─────────────────────────────────────────── */
#errorToast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--red);
  color: var(--white);
  padding: 12px 18px;
  font-size: 13px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 9999;
  display: none;
  max-width: 340px;
  line-height: 1.5;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .main { padding: 16px 12px 40px; }
  .map-col { flex: 0 0 100%; }
  .polska-svg { max-width: 100%; }
  .chart-wrap.h-lg { height: 280px; }
  .chart-wrap.h-xl { height: 320px; }
  .two-col { flex-direction: column; }
  .section-header { padding: 11px 14px; }
  .section-body { padding: 14px; }
  .section-header h2 { font-size: 14px; }
}
@media (max-width: 480px) {
  .logo-box { font-size: 16px; }
  .header-subtitle { display: none; }
  .control-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .przedmiot-bar select { min-width: 100%; }
}
