/* ============================================================
   bezrobocie-mapa.css v2.1 — profitownia.pl
   Interactive voivodeships unemployment map
   ============================================================ */

/* Light-mode CSS custom properties (fallback baseline) */
:root {
    --card-bg:        #fff;
    --border-color:   #e5e7eb;
    --text-color:     #374151;
    --muted-color:    #6b7280;
    --heading-color:  #111827;
    --row-hover:      #f8faff;
    --tooltip-bg:     rgba(17,24,39,0.93);
}

/* ------------------------------------------------------------------
   Intro block
   ------------------------------------------------------------------ */
.unemp-intro {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-left: 4px solid #4a90d9;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    font-size: .97rem;
    line-height: 1.7;
    color: var(--text-color, #374151);
}
.unemp-intro p { margin: 0; }

/* ------------------------------------------------------------------
   Hero stat cards
   ------------------------------------------------------------------ */
.unemp-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.unemp-hero-stat {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 1rem 1.1rem .9rem;
    text-align: center;
    transition: transform .18s, box-shadow .18s;
}
.unemp-hero-stat:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.unemp-hero-pl   { border-top: 3px solid #4a90d9; }
.unemp-hero-low  { border-top: 3px solid #16a34a; }
.unemp-hero-high { border-top: 3px solid #dc2626; }
.unemp-hero-spread { border-top: 3px solid #f59e0b; }

.unemp-hero-label {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted-color, #6b7280);
    margin-bottom: .35rem;
}
.unemp-hero-value {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1;
    color: var(--heading-color, #111827);
}
.unemp-hero-sub {
    font-size: .75rem;
    color: var(--muted-color, #6b7280);
    margin-top: .3rem;
    line-height: 1.3;
}
.unemp-hero-region {
    font-size: .78rem;
    font-weight: 500;
    margin-top: .25rem;
    color: var(--text-color, #374151);
}

/* ------------------------------------------------------------------
   Year selector buttons
   ------------------------------------------------------------------ */
.unemp-year-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.unemp-year-label-txt {
    font-size: .8rem;
    font-weight: 600;
    color: var(--muted-color, #6b7280);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-right: .25rem;
}
.unemp-year-btns {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}
.unemp-year-btn {
    padding: .28rem .75rem;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 20px;
    background: var(--card-bg, #fff);
    color: var(--text-color, #374151);
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1.5;
}
.unemp-year-btn:hover { background: #eff6ff; border-color: #93c5fd; }
.unemp-year-btn.active {
    background: #4a90d9;
    border-color: #4a90d9;
    color: #fff;
    font-weight: 600;
}

/* ------------------------------------------------------------------
   Map container
   ------------------------------------------------------------------ */
.unemp-map-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}
.unemp-map-side {
    flex: 0 0 50%;
    width: 50%;
    max-width: 560px;
    position: relative;
}
.unemp-chart-side {
    flex: 1 1 0;
    min-width: 0;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}
#unemp-map-wrap {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
}
.unemp-svg-map {
    width: 100%;
    height: auto;
    display: block;
}
.unemp-svg-map path {
    transition: filter .15s;
    cursor: pointer;
}

/* SVG text labels */
.unemp-map-label-name {
    font-family: inherit;
    font-size: 7px;
    font-weight: 700;
    fill: #fff;
    paint-order: stroke fill;
    stroke: rgba(0,0,0,0.55);
    stroke-width: 2px;
}
.unemp-map-label-val {
    font-family: inherit;
    font-size: 8px;
    font-weight: 600;
    fill: #fff;
    paint-order: stroke fill;
    stroke: rgba(0,0,0,0.45);
    stroke-width: 2px;
}

/* Tooltip */
#unemp-tooltip {
    position: absolute;
    display: none;
    background: var(--tooltip-bg, rgba(17,24,39,0.93));
    color: #f9fafb;
    border-radius: 8px;
    padding: .55rem .8rem;
    font-size: .82rem;
    pointer-events: none;
    z-index: 100;
    min-width: 170px;
    box-shadow: 0 4px 16px rgba(0,0,0,.22);
    line-height: 1.5;
}
#unemp-tt-name { font-weight: 700; margin-bottom: .15rem; }
#unemp-tt-value { font-size: 1rem; font-weight: 700; }
.unemp-tooltip-diff { font-size: .78rem; opacity: .85; }
.unemp-above { color: #f87171; }
.unemp-below { color: #4ade80; }
.unemp-neutral { color: #94a3b8; }

/* ------------------------------------------------------------------
   Colour legend
   ------------------------------------------------------------------ */
.unemp-legend {
    margin-top: .75rem;
}
.unemp-legend-scale {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    font-weight: 600;
}
.unemp-legend-bar {
    flex: 1;
    height: 10px;
    border-radius: 5px;
    background: linear-gradient(90deg,
        rgba(80,185,80,.75)   0%,
        rgba(240,190,30,.75) 50%,
        rgba(205,50,50,.75) 100%
    );
    border: 1px solid rgba(128,128,128,0.15);
}
.unemp-legend-min {
    color: #16a34a;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    order: 1;
}
.unemp-legend-bar {
    order: 2;
}
.unemp-legend-max {
    color: #dc2626;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    order: 3;
}
.unemp-legend-pl-wrap {
    font-size: .78rem;
    color: var(--muted-color, #6b7280);
    margin-top: .4rem;
    text-align: center;
}

/* Chart default hint */
.unemp-chart-hint {
    font-size: .76rem;
    color: var(--muted-color, #6b7280);
    font-weight: 400;
    margin-left: .5rem;
    opacity: .85;
}

/* ------------------------------------------------------------------
   Leaders / Laggards block
   ------------------------------------------------------------------ */
.unemp-leaders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.unemp-leader-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    position: relative;
    overflow: hidden;
}
.unemp-leader-card.best  { border-left: 4px solid #16a34a; }
.unemp-leader-card.worst { border-left: 4px solid #dc2626; }
.unemp-leader-badge {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: .18rem .6rem;
    border-radius: 20px;
    margin-bottom: .5rem;
}
.unemp-leader-card.best  .unemp-leader-badge { background: #dcfce7; color: #15803d; }
.unemp-leader-card.worst .unemp-leader-badge { background: #fee2e2; color: #b91c1c; }
.unemp-leader-name  { font-size: 1rem; font-weight: 700; color: var(--heading-color, #111827); }
.unemp-leader-value { font-size: 1.45rem; font-weight: 700; margin: .2rem 0 .15rem; }
.unemp-leader-card.best  .unemp-leader-value { color: #16a34a; }
.unemp-leader-card.worst .unemp-leader-value { color: #dc2626; }
.unemp-leader-diff  { font-size: .8rem; color: var(--muted-color, #6b7280); }

/* ------------------------------------------------------------------
   Ranking table (full-width, below map+chart)
   ------------------------------------------------------------------ */
.unemp-ranking-wrap {
    margin-bottom: 2rem;
}
.unemp-ranking-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.unemp-ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.unemp-ranking-table thead th {
    padding: .45rem .6rem;
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted-color, #6b7280);
    border-bottom: 2px solid var(--border-color, #e5e7eb);
    white-space: nowrap;
}
.unemp-rank-row {
    border-bottom: 1px solid var(--border-color, #f3f4f6);
    transition: background .12s;
}
.unemp-rank-row:hover { background: var(--row-hover, #f8faff); }
.unemp-rank-row.unemp-rank-active { background: #eff6ff; }
.unemp-rank-best td { background: rgba(22,163,74,.06); }
.unemp-rank-worst td { background: rgba(220,38,38,.06); }
.unemp-rank-best .unemp-rank-val { color: #16a34a; font-weight: 700; }
.unemp-rank-worst .unemp-rank-val { color: #dc2626; font-weight: 700; }
.unemp-rank-row td { padding: .38rem .6rem; vertical-align: middle; }
.unemp-rank-num  { color: var(--muted-color, #9ca3af); font-size: .78rem; width: 2rem; }
.unemp-rank-name { font-weight: 500; }
.unemp-rank-code {
    display: inline-block;
    background: var(--border-color, #e5e7eb);
    color: var(--muted-color, #6b7280);
    font-size: .68rem;
    font-weight: 700;
    padding: .1rem .35rem;
    border-radius: 3px;
    margin-right: .4rem;
    font-family: monospace;
    vertical-align: middle;
}
.unemp-rank-val-cell { min-width: 110px; }
.unemp-rank-bar-wrap {
    height: 5px;
    background: var(--border-color, #e5e7eb);
    border-radius: 3px;
    margin-bottom: 3px;
    overflow: hidden;
}
.unemp-rank-bar {
    height: 100%;
    background: linear-gradient(90deg, #80ca79, #e05c2a);
    border-radius: 3px;
    transition: width .4s ease;
}
.unemp-rank-val { font-size: .88rem; font-weight: 600; }
.unemp-rank-diff { font-size: .8rem; white-space: nowrap; }
.unemp-rank-sparkline { width: 75px; padding: 0 .25rem; }
.unemp-rank-sparkline canvas { display: block; }

/* Region chart box — inside .unemp-chart-side */
#unemp-region-chart-box {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.unemp-section-title {
    font-size: .88rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted-color, #6b7280);
    margin-bottom: .75rem;
}
.unemp-chart-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}
.unemp-chart-card canvas { max-height: 260px; }

#unemp-region-placeholder {
    background: var(--card-bg, #fff);
    border: 1px dashed var(--border-color, #d1d5db);
    border-radius: 10px;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted-color, #9ca3af);
    font-size: .9rem;
}
#unemp-region-placeholder svg { margin-bottom: .75rem; opacity: .4; }

#unemp-chart-heading {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: .4rem;
    color: var(--heading-color, #111827);
}
#unemp-region-header {
    font-size: .85rem;
    color: var(--muted-color, #6b7280);
    margin-bottom: .75rem;
}
.unemp-region-val  { font-size: 1.15rem; font-weight: 700; color: #e05c2a; }
.unemp-region-year { font-size: .88rem; }

/* ------------------------------------------------------------------
   EU comparison section
   ------------------------------------------------------------------ */
.unemp-eu-section {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 1.4rem 1.5rem;
    margin-bottom: 2rem;
}
.unemp-eu-section h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: .35rem;
    color: var(--heading-color, #111827);
}
.unemp-eu-note {
    font-size: .82rem;
    color: var(--muted-color, #6b7280);
    margin-bottom: 1rem;
    line-height: 1.55;
}
.unemp-eu-chart-wrap {
    position: relative;
    height: 540px;   /* tall for ~27 bars */
    max-height: 600px;
}

/* Inline SVG icons */
.unemp-icon {
    display: inline-block;
    vertical-align: -1px;
    flex-shrink: 0;
}

/* Methodology callout */
.unemp-eu-methodology-callout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.unemp-eu-mc-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1.4;
}
.unemp-eu-mc-body {
    flex: 1 1 260px;
    font-size: .85rem;
    line-height: 1.65;
    color: #78350f;
}
.unemp-eu-mc-body strong { color: #92400e; }
.unemp-eu-mc-body p { margin: .35rem 0 0; }
.unemp-eu-mc-compare {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.unemp-eu-mc-item {
    text-align: center;
    background: var(--card-bg, #fff);
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: .55rem .9rem;
    min-width: 100px;
}
.unemp-eu-mc-gus  { border-top: 3px solid #4a90d9; }
.unemp-eu-mc-bael { border-top: 3px solid #16a34a; }
.unemp-eu-mc-label {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
    margin-bottom: .25rem;
}
.unemp-eu-mc-val {
    display: block;
    font-size: 1.45rem;
    font-weight: 800;
    color: #111827;
    line-height: 1;
}
.unemp-eu-mc-gus  .unemp-eu-mc-val { color: #2563eb; }
.unemp-eu-mc-bael .unemp-eu-mc-val { color: #16a34a; }
.unemp-eu-mc-src {
    display: block;
    font-size: .7rem;
    color: #9ca3af;
    margin-top: .2rem;
}
.unemp-eu-mc-vs {
    font-size: .82rem;
    font-weight: 700;
    color: #9ca3af;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .08em;
}


/* ------------------------------------------------------------------
   FAQ accordion
   ------------------------------------------------------------------ */
.unemp-faq {
    margin-bottom: 2rem;
}
.unemp-faq h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--heading-color, #111827);
}
.unemp-faq-item {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    margin-bottom: .5rem;
    overflow: hidden;
}
.unemp-faq-q {
    width: 100%;
    text-align: left;
    background: var(--card-bg, #fff);
    border: none;
    padding: .9rem 1.1rem;
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color, #111827);
    gap: .75rem;
    transition: background .14s;
    line-height: 1.4;
}
.unemp-faq-q:hover { background: var(--row-hover, #f9fafb); }
.unemp-faq-item.is-open > .unemp-faq-q { border-bottom: 1px solid var(--border-color, #e5e7eb); }
.unemp-faq-q-text { flex: 1; }
.unemp-faq-icon {
    flex-shrink: 0;
    width: 1.6rem;
    height: 1.6rem;
    display: grid;
    place-items: center;
    color: #4a90d9;
    background: #eff6ff;
    border-radius: 50%;
    transition: background .15s;
}
.unemp-faq-q:hover .unemp-faq-icon { background: #dbeafe; }
.unemp-faq-icon-plus  { display: block; }
.unemp-faq-icon-minus { display: none; }
.unemp-faq-item.is-open .unemp-faq-icon-plus  { display: none; }
.unemp-faq-item.is-open .unemp-faq-icon-minus { display: block; }
/* Smooth slide panel */
.unemp-faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height .32s ease;
    background: var(--card-bg, #fff);
}
.unemp-faq-a-inner {
    padding: .9rem 1.1rem;
    font-size: .88rem;
    line-height: 1.7;
    color: var(--text-color, #374151);
}

/* ------------------------------------------------------------------
   Source / disclaimer
   ------------------------------------------------------------------ */
.unemp-source {
    font-size: .78rem;
    color: var(--muted-color, #9ca3af);
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    line-height: 1.6;
}
.unemp-source a {
    color: #4a90d9;
    text-decoration: none;
}
.unemp-source a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------
   Mobile — 960px
   ------------------------------------------------------------------ */
@media (max-width: 960px) {
    .unemp-hero { grid-template-columns: repeat(2, 1fr); }
    .unemp-map-container { flex-direction: column; }
    .unemp-map-side { flex: none; width: 100%; max-width: 100%; }
    .unemp-chart-side { flex: none; width: 100%; min-height: 260px; }
}

/* ------------------------------------------------------------------
   Mobile — 720px
   ------------------------------------------------------------------ */
@media (max-width: 720px) {
    .unemp-leaders { grid-template-columns: 1fr; }
    .unemp-col-diff { display: none; }
    .unemp-rank-sparkline { display: none; }
    .unemp-eu-chart-wrap { height: 480px; }
    .unemp-eu-methodology-callout { flex-direction: column; }
    .unemp-eu-mc-compare { justify-content: center; width: 100%; }
}

/* ------------------------------------------------------------------
   Mobile — 480px
   ------------------------------------------------------------------ */
@media (max-width: 480px) {
    .unemp-hero { grid-template-columns: 1fr 1fr; }
    .unemp-hero-value { font-size: 1.35rem; }
    .unemp-hero-sub { display: none; }
    .unemp-year-row { gap: .35rem; }
    .unemp-year-btn { font-size: .76rem; padding: .22rem .6rem; }
    .unemp-leader-card { padding: .75rem 1rem; }
    .unemp-ranking-table { font-size: .8rem; }
    .unemp-rank-diff { display: none; }
    .unemp-eu-chart-wrap { height: 400px; }
    .unemp-faq-q { font-size: .84rem; }
}

/* ==============================================================
   Dark mode — html.dark-mode / body.dark-mode (theme selector)
   ============================================================== */

/* 1. Override CSS variables */
html.dark-mode,
body.dark-mode {
    --card-bg:       #2d2d2d;
    --border-color:  #404040;
    --text-color:    #e0e0e0;
    --muted-color:   #9ca3af;
    --heading-color: #f1f5f9;
    --row-hover:     rgba(255,255,255,0.05);
    --tooltip-bg:    rgba(0,0,0,0.92);
}

/* 2. Year buttons hover / active */
html.dark-mode .unemp-year-btn:hover,
body.dark-mode  .unemp-year-btn:hover {
    background: rgba(74,144,217,0.12);
    border-color: rgba(74,144,217,0.5);
    color: #93c5fd;
}

/* 3. Active ranking row */
html.dark-mode .unemp-rank-row.unemp-rank-active,
body.dark-mode  .unemp-rank-row.unemp-rank-active {
    background: rgba(74,144,217,0.14);
}

/* 4. Leader badges */
html.dark-mode .unemp-leader-card.best  .unemp-leader-badge,
body.dark-mode  .unemp-leader-card.best  .unemp-leader-badge {
    background: rgba(22,163,74,0.18);
    color: #4ade80;
}
html.dark-mode .unemp-leader-card.worst .unemp-leader-badge,
body.dark-mode  .unemp-leader-card.worst .unemp-leader-badge {
    background: rgba(220,38,38,0.18);
    color: #f87171;
}

/* 5. EU methodology callout (amber → dark amber) */
html.dark-mode .unemp-eu-methodology-callout,
body.dark-mode  .unemp-eu-methodology-callout {
    background: rgba(245,158,11,0.07);
    border-color: rgba(245,158,11,0.3);
    border-left-color: #d97706;
}
html.dark-mode .unemp-eu-mc-body,
body.dark-mode  .unemp-eu-mc-body {
    color: #fcd34d;
}
html.dark-mode .unemp-eu-mc-body strong,
body.dark-mode  .unemp-eu-mc-body strong {
    color: #fde68a;
}

/* 6. EU metric compare items */
html.dark-mode .unemp-eu-mc-item,
body.dark-mode  .unemp-eu-mc-item {
    border-color: rgba(245,158,11,0.3);
}
html.dark-mode .unemp-eu-mc-val,
body.dark-mode  .unemp-eu-mc-val {
    color: #e0e0e0;
}
html.dark-mode .unemp-eu-mc-gus  .unemp-eu-mc-val,
body.dark-mode  .unemp-eu-mc-gus  .unemp-eu-mc-val { color: #60a5fa; }
html.dark-mode .unemp-eu-mc-bael .unemp-eu-mc-val,
body.dark-mode  .unemp-eu-mc-bael .unemp-eu-mc-val { color: #4ade80; }

/* 7. FAQ accordion icon button */
html.dark-mode .unemp-faq-icon,
body.dark-mode  .unemp-faq-icon {
    background: rgba(74,144,217,0.15);
    color: #60a5fa;
}
html.dark-mode .unemp-faq-q:hover .unemp-faq-icon,
body.dark-mode  .unemp-faq-q:hover .unemp-faq-icon {
    background: rgba(74,144,217,0.25);
}

/* 8. SVG path labels — keep white stroke, already fine */
/* 9. Legend: min/max colours are semantic (green/red) — stay the same */
/* 10. Hero stat card highlight number */
html.dark-mode .unemp-hero-value,
body.dark-mode  .unemp-hero-value {
    color: #f1f5f9;
}

/* 11. Region value (orange) — fine as-is, keep accent */
/* 12. Source link */
html.dark-mode .unemp-source a,
body.dark-mode  .unemp-source a {
    color: #60a5fa;
}
