/* ══════════════════════════════════════════════════════════════
   Style.css — BNS Moldova · Comerț Internațional cu Mărfuri
   Redesign Modern Minimal · v2
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Tokens ── */
:root {
  --blue:        #0077C0;
  --blue-dark:   #025d96;
  --blue-mid:    #005fa3;
  --blue-light:  #55abe0;
  --blue-bg:     #eaf3fb;
  --blue-bg2:    #dceef9;
  --page-bg:     #f0f4f8;
  --card-bg:     #ffffff;
  --text-dark:   #0f2a45;
  --text-main:   #1e293b;
  --text-sub:    #475569;
  --text-muted:  #94a3b8;
  --border:      #e2e8f0;
  --border-mid:  #c8d6e5;
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:   0 2px 12px rgba(0,0,0,0.08);
  --radius:      12px;
  --radius-sm:   10px;
  --mono:        'IBM Plex Mono', monospace;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

* {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

body {
  background: var(--page-bg);
  color: var(--text-main);
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════════════════════ */
#titlu {
  background: var(--blue);
  color: #fff;
  padding: 5px 24px;
  margin: 0;
  border-radius: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,60,120,0.2);
  position: relative;
  overflow: visible; /* permite logo-ului să iasă din header */
}

h1 {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
  flex: 1;
  margin: 0;
}

#logo {
  height: 56px;
  position: absolute;
  left: 7%;
  top: 50%;
  transform: translateY(-50%);
  background-color: #fff;
  padding-left: 40px;
  padding-right: 40px;
  border-radius: 60px 20px;
  z-index: 2;
}

/* ══════════════════════════════════════════════════════════════
   FORM / CONTAINER
   ══════════════════════════════════════════════════════════════ */
.container {
  display: grid;
  grid-template-columns: 33.3% 33.3% 33.3%;
  gap: 0;
  padding: 20px 80px 8px;
  font-size: 13px;
  user-select: none;
}

.coloana {
  margin: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px 16px;
  box-shadow: var(--shadow-sm);
}

/* Section title bar inside column */
.titlu {
  background: var(--blue);
  color: #fff;
  padding: 8px 12px;
  margin: 0 0 12px;
  border-radius: var(--radius-sm);
  height: auto;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-wrap: pretty;
}

.coloana h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-dark);
  text-transform: none;
  letter-spacing: 0.01em;
  padding: 8px 10px;
  margin: 6px 8px 4px;
  background: var(--blue-bg);
  border-radius: var(--radius-sm);
}

/* ── Bifele ascunse peste tot (rămân funcționale în JS, doar vizual eliminate) — */
/* excepție: "Suma cumulativă a perioadei" (.cumulativ) rămâne vizibilă. */
.coloana input.bifa {
  visibility: hidden;
}

/* ── Accordion clasificare mărfurilor (experimental, local) ── */
.clasif-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
.clasif-toggle:hover { background: #dbeafe; }
.clasif-toggle::before {
  content: "\25B6";
  font-size: 9px;
  color: var(--blue-dark);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.clasif-toggle.open::before { transform: rotate(90deg); }
.coloana > .clasif-body {
  display: none !important;
}
.coloana > .clasif-body.open {
  display: block !important;
}

/* Row inside column: label | checkbox | dropdown trigger */
.coloana > div:not(.optiuni):not(.sep) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 0px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 34px;
  height: auto;
  margin: 4px 8px;
  padding: 0;
  transition: border-color 0.15s;
  background: #fff;
}

.coloana > div:not(.optiuni):not(.sep):hover {
  border-color: var(--blue-light);
}

/* Cursor "interzis" pe tot rândul (nu doar pe checkbox) când e dezactivat */
.coloana > div:not(.optiuni):not(.sep):has(> input.bifa:disabled) {
  cursor: not-allowed;
}
.coloana > div:not(.optiuni):not(.sep):has(> input.bifa:disabled) .selectie,
.coloana > div:not(.optiuni):not(.sep):has(> input.bifa:disabled) .denumire {
  cursor: not-allowed;
  pointer-events: none;
}

.legenda-asterisc {
  font-size: 11px;
  color: var(--text-sub);
  padding: 0 10px 8px;
  margin: 0;
}

.legenda-clasif {
  font-size: 11px;
  color: var(--blue-dark);
  background: var(--blue-bg);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin: 0 8px 8px;
}

.denumire {
  padding: 5px 8px 5px 12px;
  font-size: 12.5px;
  color: var(--text-main);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.red {
  color: #c0392b;
  font-size: 14px;
  font-weight: 700;
  display: inline;
}

.sep {
  height: 1px;
  background: var(--border);
  margin: 8px 10px;
}

.coloana img {
  opacity: 0.3;
  display: block;
  margin: 16px auto 0;
  max-width: 92%;
}

/* ── Selectie (dropdown trigger) ── */
.selectie {
  background: transparent;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: 12px;
  width: 100%;
  padding: 0 40px 0 10px;
  height: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  transition: color 0.15s;
}

.selectie::after {
  content: "\25BC";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  color: var(--text-muted);
  pointer-events: none;
}

.selectie .clear-btn {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #aaa;
  cursor: pointer;
  display: none;
  z-index: 2;
  font-weight: bold;
}

.selectie:hover .clear-btn { display: block; }
.selectie .clear-btn:hover { color: var(--text-main); }

/* ── Contrast mai bun pentru triunghi + X pe fundal albastru (selecție activă) ── */
.selectie.is-active::after { color: #fff; opacity: 0.9; }
.selectie.is-active .clear-btn { display: block; color: #fff; opacity: 0.85; }
.selectie.is-active .clear-btn:hover { color: #fff; opacity: 1; }

/* ── Checkboxes ── */
.bifa, .cumulativ, .tari_ncm {
  border-radius: 4px;
  border-color: var(--border-mid);
  transform: scale(1.3);
}

input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-mid);
  border-radius: 4px;
  margin-left: 8px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  background: #fff;
}

input[type="checkbox"]:checked {
  background: var(--blue);
  border-color: var(--blue);
}

input[type="checkbox"]:checked::before {
  content: "\2713";
  display: block;
  text-align: center;
  line-height: 13px;
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}

input[type="checkbox"].bifa,
input[type="checkbox"].cumulativ {
  border-radius: 4px;
  margin-right: 8px;
}

input[type="checkbox"]:disabled {
  background: #f1f5f9;
  border-color: var(--border);
  cursor: not-allowed;
}

/* ── Dropdown panel ── */
.optiuni {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 15%;
  min-width: 200px;
  max-height: 340px;
  overflow-y: auto;
  padding: 6px 0;
  background: #fff;
  z-index: 1000;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.optiuni-ncm {
  width: 420px !important;
  min-width: 320px;
  max-width: none;
  max-height: 480px !important;
}

.optiuni li {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  transition: background 0.1s;
}

.optiuni-ncm li {
  padding: 7px 14px;
}

.optiuni li:hover { background: #f8fafc; }

.optiuni li input[type="checkbox"],
.optiuni li input[type="radio"] {
  position: static;
  flex-shrink: 0;
  margin-left: 4px;
}

.optiuni > input[type="checkbox"],
.optiuni > input[type="radio"] { vertical-align: middle; }

.optiuni > label { vertical-align: middle; font-size: 13px; }

.optiuni li label {
  flex: 1;
  padding-left: 0;
  cursor: pointer;
  line-height: 1.3;
  display: flex;
  align-items: center;
  font-size: 13px;
}

.optiuni ul { padding: 0; margin: 0; }

.optiuni input[type="button"] {
  display: inline-block;
  margin: 6px auto 4px 10%;
  height: 28px;
  width: 108px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.optiuni input[type="button"]:hover { background: var(--blue-dark); }

.optiuni input[type="radio"],
.optiuni input[type="checkbox"] { margin-left: 10px !important; }

.optiuni > hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3px 0;
}

.optiuni:not(.small-font) ul hr { display: none; }

.optiuni.small-font ul hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 12px;
}

.small-font label,
.small-font input[type="checkbox"],
.small-font input[type="radio"] { font-size: 11.5px; }

.select-all-btn {
  display: block !important;
  width: 88% !important;
  margin: 6px auto !important;
  height: 30px !important;
  background: var(--blue) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--radius-sm) !important;
  font-size: 12px !important;
  cursor: pointer;
  transition: background 0.15s;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 -6px 0 0 #fff, 0 6px 0 0 #fff;
}

/* Doar când e precedat de o bară de căutare, coboară sub ea (nu toate dropdown-urile au căutare, ex. Luna) */
[class^="search"] + .select-all-btn { top: 42px; }

.select-all-btn:hover { background: var(--blue-dark) !important; }

.select {
  position: sticky;
  bottom: 0;
  height: 36px !important;
  width: 100% !important;
  background: var(--blue) !important;
  border-radius: 0 0 var(--radius) var(--radius) !important;
  margin: 0 !important;
}

[class^="search"] {
  width: 82%;
  display: block;
  margin: 6px auto;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 8px;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 0 6px 0 0 #fff;
}

[class^="search"]:focus { border-color: var(--blue-light); }

/* ── Buttons ── */
.buton {
  display: block;
  margin: 12px 88px 0 auto;
  background: var(--blue);
  color: #fff;
  height: 36px;
  min-width: 120px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,119,192,0.28);
}

.buton:hover {
  background: var(--blue-dark);
  box-shadow: 0 4px 12px rgba(0,119,192,0.35);
}

#restart {
  width: auto;
  padding: 0 16px;
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--border-mid);
  box-shadow: none;
  margin-bottom: 0;
  margin-top: 68px;
}

#restart:hover {
  background: var(--blue-bg);
  border-color: var(--blue-light);
  box-shadow: none;
}

#access { margin-bottom: 8px; }

/* ── Messages ── */
#msg {
  text-align: center;
  color: #c0392b;
  font-size: 15px;
  font-weight: 500;
  padding: 8px;
  margin: 0;
}

#msg2 {
  text-align: center;
  color: var(--text-sub);
  font-size: 13px;
  padding: 4px;
}

#mesaj {
  padding: 10px 16px;
  display: block;
  width: 40%;
  text-align: center;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #c0392b;
  background: #fff8f8;
}

/* ══════════════════════════════════════════════════════════════
   TABLE SECTION
   ══════════════════════════════════════════════════════════════ */

/* Context bar above table */
#tabel-context {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  width: 92%;
  margin: 20px auto 0;
  background: #fff;
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

#ctx-flux {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

#ctx-an, #ctx-luna {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
}

.ctx-sep::before {
  content: "·";
  color: #ccc;
  font-size: 16px;
}

.ctx-valuta {
  font-size: 12px;
  color: var(--text-sub);
  font-weight: 600;
  font-style: italic;
}

/* Download buttons row */
#butoane {
  display: none;
  gap: 8px;
  justify-content: flex-end;
  margin: 10px 88px 0 auto;
}

.buton-download {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  height: auto;
  width: auto;
  border-radius: var(--radius-sm);
  box-shadow: none;
  cursor: pointer;
  transition: all 0.15s;
}

/* Primul buton (Excel) — solid */
#butoane .buton-download:first-child {
  background: var(--blue);
  border: none;
  color: #fff;
}
#butoane .buton-download:first-child:hover { background: var(--blue-dark); }

/* Al doilea buton (CSV) — outline */
#butoane .buton-download:last-child {
  background: #fff;
  border: 1.5px solid var(--blue);
  color: var(--blue);
}
#butoane .buton-download:last-child:hover { background: var(--blue-bg); }

/* Bară scroll orizontal oglindă — fixată sus la scroll */
#tabel-scroll-mirror {
  width: 92%;
  margin: 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -2px 4px rgba(0,0,0,.06);
}
#tabel-scroll-mirror-inner {
  height: 1px;
}

/* Table container */
#tabel-container {
  width: 92%;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-md);
  position: relative;
}

/* ── Table base ── */
#tabel {
  min-width: 100%;   /* umple containerul când e loc; depășește și face scroll când e nevoie */
  border-collapse: collapse;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
}

/* ── Header rows ── */
#tabel thead tr { background: var(--blue); }

#tabel th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--blue);
  border-bottom: none;
}

/* Sticky entity column */
#tabel th.th-entity {
  min-width: 220px;
  text-align: left;
  background: var(--blue);
  color: #fff;
  position: sticky;
  left: 0;
  z-index: 3;
  border-right: 1px solid rgba(255,255,255,0.18);
}

/* Year group (slightly darker) */
#tabel th.th-year-group {
  text-align: center;
  background: var(--blue-mid);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  border-left: 1px solid rgba(255,255,255,0.18);
}

/* Period sub-header */
#tabel th.th-period {
  text-align: right;
  font-weight: 500;
  font-size: 10.5px;
  color: rgba(255,255,255,0.88);
  width: 95px;               /* lățime fixă — nu se întinde, nu se strânge */
  min-width: 95px;
  padding: 8px 9px;
  border-left: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
}

#tabel th.sortable-col {
  cursor: pointer;
  user-select: none;
}
#tabel th.sortable-col:hover { background: rgba(255,255,255,0.12); }
#tabel th.sortable-col::after {
  content: "\21C5";
  margin-left: 4px;
  opacity: 0.5;
  font-size: 9px;
}
#tabel th.sortable-col.sort-asc::after { content: "\25B2"; opacity: 1; }
#tabel th.sortable-col.sort-desc::after { content: "\25BC"; opacity: 1; }

/* Multi-dim columns */
#tabel th.th-dim {
  text-align: left;
  background: var(--blue);
  color: #fff;
  white-space: normal;          /* permite "UNITATE DE MĂSURĂ" să treacă pe 2 rânduri */
  border-right: 1px solid rgba(255,255,255,0.15);
  vertical-align: middle;
  min-width: 180px;             /* Țară / Transport — compact dar lizibil */
}

/* NCM / CSCI / CMCE header — coloana principală */
#tabel th.th-dim.th-dim-label {
  min-width: 700px;
}

/* KUM / Unitate de măsură — coloană îngustă */
#tabel th.th-dim.th-dim-um {
  width: 72px;
  min-width: 65px;
  text-align: center;
}

#tabel th.th-dim.th-dim-last,
#tabel th.th-dim:last-of-type {
  border-right: 2px solid rgba(255,255,255,0.22);
}

/* ── Body cells ── */
#tabel td {
  padding: 9px 14px;
  border-bottom: 1px solid #eef1f5;
  color: var(--text-main);
  vertical-align: middle;
  font-size: 13px;
}

#tabel tbody tr:last-child td { border-bottom: none; }
#tabel tbody tr:nth-child(even) { background: #f8fafc; }
#tabel tbody tr:hover { background: #edf4fb; transition: background 0.12s; }

/* Sticky entity body cell */
#tabel td.pivot-entity {
  white-space: normal;          /* text trece pe rând nou, nu "..." */
  word-break: break-word;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 5px rgba(0,0,0,0.04);
  vertical-align: top;
}

#tabel tbody tr:nth-child(even) td.pivot-entity { background: #f8fafc; }
#tabel tbody tr:hover td.pivot-entity { background: #edf4fb; }

/* Value cells */
#tabel td.pivot-value {
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 95px;               /* corespunde cu th.th-period */
  min-width: 95px;
  padding: 9px 9px;
  border-left: 1px solid #f0f4f8;
}

/* Quantity sub-line (verde) */
#tabel td.pivot-value span.cell-qty {
  display: block;
  font-size: 0.82em;
  color: #2d6a4f;
  font-weight: 400;
  white-space: normal;
}

/* ── Row: Total ── */
#tabel tr.row-total { background: var(--blue-bg) !important; }

#tabel tr.row-total td {
  font-weight: 700;
  color: #0055a0;
  border-top: 2px solid var(--border-mid);
  border-bottom: 2px solid var(--border-mid);
}

#tabel tr.row-total td.pivot-entity {
  background: var(--blue-bg);
  color: #0055a0;
}

#tabel tr.row-total td.pivot-value { color: #0055a0; font-weight: 700; }

/* ── Row: Group total ── */
#tabel tr.row-group-total { background: var(--blue-bg2) !important; }

#tabel tr.row-group-total td {
  font-weight: 700;
  border-top: 2px solid var(--border-mid);
  border-bottom: 1px solid var(--border-mid);
  color: var(--text-dark);
}

#tabel tr.row-group-total td.pivot-value { color: #0055a0; }
#tabel tr.row-group-total td.dim-cell { background: var(--blue-bg2); }
#tabel td.pivot-group-label { color: var(--text-dark); }

/* ── Row: "Din care:" ── */
#tabel tr.row-of-which td {
  padding-top: 3px;
  padding-bottom: 3px;
  border-bottom: none;
  background: #fff !important;
}

#tabel td.pivot-of-which {
  font-style: italic;
  color: var(--text-muted);
  font-size: 11.5px;
  padding-left: 22px;
}

/* ── Row: detail ── */
#tabel tr.row-detail td.dim-cell { font-size: 12px; }
#tabel tr.row-detail:last-child td { border-bottom: 2px solid var(--border-mid); }

/* ── Dim cells (multi-dim table) ── */
#tabel td.dim-cell {
  white-space: normal;          /* text trece pe rând nou, nu "..." */
  word-break: break-word;
  background: #fff;
  border-right: 1px solid var(--border);
  max-width: 260px;
  vertical-align: top;
}

/* Coloana Țară (prima coloană dim): compact */
#tabel td.dim-cell:first-child {
  min-width: 180px;
}

/* NCM / CSCI / CMCE body cell — coloana principală */
#tabel td.dim-cell.dim-cell-label {
  min-width: 700px;
  max-width: 700px;
  overflow: hidden;
}

/* Coloana KUM / Unitate de măsură (ultima coloană dim): îngustă, centrată */
#tabel td.dim-cell.dim-cell-last {
  border-right: 2px solid var(--border-mid);
  width: 72px;
  max-width: 85px;
  min-width: 60px;
  text-align: center;
  white-space: nowrap;          /* "kg", "buc." nu au nevoie de wrap */
}

/* Când coloana de descriere (NCM/CSCI/CMCE) e și ultima dimensiune,
   păstrează lățimea/wrap-ul de etichetă — nu îngustimea de UM,
   altfel textul lung se suprapune peste coloanele de valori */
#tabel td.dim-cell.dim-cell-label.dim-cell-last {
  width: auto;
  max-width: 700px;
  min-width: 700px;
  text-align: left;
  white-space: normal;
}

/* ── Zero values ── */
#tabel td.zero-val { color: #d1d5db; text-align: left; }

/* ── Loading spinner in cell ── */
#tabel td.loading {
  text-align: center;
  vertical-align: middle;
  padding: 20px;
}

.cell-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: pivot-spin 0.7s linear infinite;
  vertical-align: middle;
}

/* ── Loader overlay ── */
#pivot-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  background: rgba(255,255,255,0.92);
  position: absolute;
  inset: 0;
  z-index: 10;
  border-radius: var(--radius);
}

#pivot-loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: pivot-spin 0.8s linear infinite;
}

@keyframes pivot-spin { to { transform: rotate(360deg); } }

#pivot-loader-text { font-size: 13px; color: var(--text-sub); font-weight: 500; }
#pivot-loader-progress { font-size: 12px; color: var(--text-muted); }

/* ── Legacy group/year header rows ── */
#tabel tr.group-header-row td {
  background: var(--blue-bg);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dark);
  padding: 8px 14px;
  border-top: 2px solid var(--border-mid);
  border-bottom: 1px solid var(--border-mid);
}

#tabel tr.group-year-row td {
  background: var(--blue-bg2);
  font-size: 13px;
  color: var(--text-dark);
  border-top: 2px solid var(--border-mid);
}

/* ── Suma/cant alignment ── */
#tabel td.suma, #tabel td.cant {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
}

#tabel th#suma, #tabel th#cant { text-align: right; }
#tabel td.valuta, #tabel th#valuta { text-align: center; white-space: nowrap; }
#tabel td.tip,    #tabel th#tip    { text-align: center; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════════ */
#tabel-paginare {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 0 6px;
  flex-wrap: wrap;
}

#pag-numere {
  display: flex;
  align-items: center;
  gap: 4px;
}

#pag-prev, #pag-next {
  height: 32px;
  padding: 0 16px;
  background: var(--blue);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s;
}

#pag-prev:hover, #pag-next:hover { background: var(--blue-dark); }
#pag-prev:disabled { background: #bfcfee; border-color: #bfcfee; cursor: default; }
#pag-next:disabled { opacity: 0.45; cursor: default; }

.pag-num {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--blue);
  cursor: pointer;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  line-height: 30px;
  transition: all 0.15s;
}

.pag-num.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  cursor: default;
}

.pag-num:not(.active):hover { background: var(--blue-bg); }

.pag-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 32px;
}

#pag-goto-input {
  width: 48px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  color: var(--text-main);
  padding: 0 4px;
  margin-left: 6px;
  outline: none;
  transition: border-color 0.15s;
}

#pag-goto-input:focus { border-color: var(--blue-light); }

#pag-goto-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--blue);
  border: none;
  color: #fff;
  border-radius: 20px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#pag-goto-btn:hover { background: var(--blue-dark); }

#pag-info {
  display: none;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 0 6px;
}

/* ══════════════════════════════════════════════════════════════
   LEGEND
   ══════════════════════════════════════════════════════════════ */
#tabel-legenda {
  display: none;
  margin-top: 4px;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  line-height: 1.7;
}

#tabel-legenda,
#tabel-legenda p,
#tabel-legenda span,
#tabel-legenda div {
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  color: var(--text-muted);
}

#tabel-legenda p { margin: 0 0 2px; }

#tabel-legenda .legenda-nota  { color: var(--text-muted); margin-bottom: 6px; }

#tabel-legenda .legenda-simboluri {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 4px;
}

#tabel-legenda .legenda-sursa { color: #b0b8c4; margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: rgba(15,42,69,0.55);
  backdrop-filter: blur(3px);
}

.modal-content {
  background: #fff;
  margin: 12% auto;
  padding: 36px 32px 28px;
  border: none;
  width: 90%;
  max-width: 440px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.modal-content h2 {
  margin-top: 0;
  color: var(--text-dark);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.modal-content p {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 28px;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.modal-button {
  padding: 10px 28px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.modal-button:nth-child(1) {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,119,192,0.3);
}

.modal-button:nth-child(1):hover { background: var(--blue-dark); }

.modal-button:nth-child(2) {
  background: #f1f5f9;
  color: var(--text-sub);
}

.modal-button:nth-child(2):hover { background: var(--border); }

/* ══════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════ */
#footer {
  background: #fff;
  color: var(--text-main);
  margin-top: 60px;
  border-top: 1px solid var(--border);
}

#footer-abonare {
  background: var(--blue);
  color: #fff;
}

#footer-abonare p { font-size: 14px; margin: 0; font-weight: 300; }

#footer-abonare-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

#footer-abonare a {
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  gap: 14px;
  white-space: nowrap;
  font-weight: 400;
}

#footer-abonare a img {
  height: 46px;
  filter: brightness(10) opacity(0.85);
}

#footer .footer-content {
  display: flex;
  gap: 60px;
  padding: 40px 20px;
  border-bottom: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
}

#footer .footer-contact {
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#footer .footer-contact p {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

#footer .footer-contact span { display: block; font-size: 13px; }

#footer .footer-contact img {
  height: 36px;
  width: 36px;
  object-fit: contain;
  opacity: 0.55;
  flex-shrink: 0;
  margin-top: 2px;
}

#footer .footer-contact span.footer-phone-badge {
  height: 36px;
  width: 36px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 15px;
}

#footer .footer-contact span.footer-phone-list a {
  display: block;
  margin: 2px 0;
}

#footer .footer-contact a { color: #666; text-decoration: none; }
#footer .footer-contact a:hover { color: var(--blue); }

.footer-linie-verde {
  color: #128100;
  font-size: 24px;
  font-weight: 700;
}

#footer .footer-col h4 {
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  margin-top: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#footer .footer-col ul li a {
  color: var(--text-sub);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}

#footer .footer-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
  flex: 1;
}

#footer .footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#footer .footer-col ul li {
  margin-bottom: 7px;
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

#footer .footer-col ul li a:hover { color: var(--blue); }

#footer .footer-legal {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  text-align: center;
  font-size: 12.5px;
}

#footer .footer-legal a {
  color: var(--text-sub);
  text-decoration: none;
  transition: color 0.15s;
}

#footer .footer-legal a:hover { color: var(--blue); }

#footer .footer-legal-sep {
  color: var(--border-mid);
  margin: 0 10px;
}

/* ── Bară "versiune Beta" (sus, pe toată lățimea) ── */
#beta-banner {
  background: #fbbf24;
  color: #664d03;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
}

/* ── Cutie flotantă sondaj (colț dreapta-sus) ── */
#sondaj-banner {
  position: fixed;
  top: 6px;
  right: 18px;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(234,88,12,0.35);
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

#sondaj-banner.sondaj-banner-show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  animation: sondaj-banner-pulse 2.2s ease-in-out 0.35s 2;
}

@keyframes sondaj-banner-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(234,88,12,0.35); }
  50%      { box-shadow: 0 8px 28px rgba(234,88,12,0.6); }
}

#sondaj-banner-icon { font-size: 18px; }

#sondaj-banner-text {
  font-size: 13px;
  font-weight: 500;
  max-width: 150px;
  line-height: 1.3;
}

#sondaj-banner-btn {
  background: #fff;
  color: #ea580c;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

#sondaj-banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

#sondaj-banner-close {
  background: rgba(255,255,255,0.25);
  border: none;
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.9;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sondaj-banner-close:hover { opacity: 1; background: rgba(255,255,255,0.4); }

@media (max-width: 640px) {
  #sondaj-banner { top: 10px; right: 10px; padding: 10px 12px; gap: 8px; }
  #sondaj-banner-text { max-width: 110px; font-size: 12px; }
}

/* ══════════════════════════════════════════════════════════════
   INFO PAGE (informatii.html)
   ══════════════════════════════════════════════════════════════ */
#info {
  display: block;
  margin: 32px auto;
  padding: 28px;
  width: 90%;
  max-width: 600px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  text-align: center;
}

#info a:first-child {
  display: inline-block;
  padding: 10px 24px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,119,192,0.25);
  transition: background 0.15s;
}

#info a:first-child:hover { background: var(--blue-dark); }

#info h3 {
  color: var(--text-dark);
  font-size: 17px;
  margin-bottom: 14px;
  font-weight: 600;
}

#info ul { list-style: none; padding: 0; margin: 0; }

#info li {
  margin: 8px 0;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

#info li a {
  color: var(--text-dark);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

#info li:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

#info li a:hover { color: var(--blue); }

/* Avertizare Grupează — bordură pulsantă când sunt 2+ dimensiuni active */
@keyframes grup-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); border-color: #dc3545; }
  50%       { box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);  border-color: #dc3545; }
}
#grup-atentionare.grup-highlight .selectie,
#grup-atentionare.grup-highlight > input[type="checkbox"] + div {
  border: 2px solid #dc3545 !important;
  border-radius: 6px;
  animation: grup-pulse 1.4s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media only screen and (max-width: 1100px) {
  .container {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  #tabel-context, #tabel-container, #butoane { width: 96%; }
}

@media only screen and (max-width: 768px) {
  #titlu {
    height: auto;
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  #logo { margin: 0 auto; }
  h1 { font-size: 14px; }

  #footer .footer-columns { grid-template-columns: repeat(2, 1fr); }
  #footer .footer-content { flex-direction: column; padding: 20px; }
  #footer-abonare-inner { flex-direction: column; gap: 14px; text-align: center; }
}

/* ══════════════════════════════════════════════════════════════
   INFORMATII.HTML — Styles preserved from v1 (not in new design)
   ══════════════════════════════════════════════════════════════ */
#back-ground {
  background-color: #0077C0;
  color: #fff;
  padding-top: 20px;
  padding-bottom: 20px;
  border-radius: 30px;
}

#back-ground h2 {
  display: block;
  margin: auto;
  text-align: center;
  margin-bottom: 50px;
  padding: 20px;
  background-color: #fff;
  color: #025d96;
  border-radius: 60px 30px;
  width: 50%;
  font-size: 22px;
}

#back-ground img {
  display: block;
  width: 90%;
  border-radius: 10px;
}

.two-columns {
  display: grid;
  grid-template-columns: 50% 50%;
  margin-bottom: 40px;
}

.text {
  width: 70%;
  display: block;
  margin: auto;
  margin-bottom: 30px;
  font-size: 17px;
  background-color: #144f75;
  padding: 40px;
  border-radius: 20px 60px;
}

.right {
  border-radius: 60px 20px;
}

.two-columns h3 {
  margin-left: 3%;
  font-style: italic;
}

.two-columns p {
  padding: 20px;
  display: block;
  margin: auto;
  text-align: center;
}

.two-columns img {
  display: block;
  margin: auto;
  border: 3px #025d96 solid;
}

#add-info {
  display: block;
  margin: auto;
  width: 80%;
  padding: 30px;
  color: #8b0f0f;
  font-size: 16px;
}

#add-info li {
  padding: 10px;
  list-style: none;
  width: 80%;
  padding-left: 5%;
  background-color: #fff;
  border-radius: 30px;
  margin-bottom: 25px;
  line-height: 1.6;
  font-weight: 600;
  margin-left: 0;
}

#add-info #r {
  margin-left: auto;
  margin-right: 0;
  padding-left: 7%;
}

/* ── Footer bottom bar ── */
#footer-bottom {
  background-color: #f5f5f5;
  font-size: 13px;
  color: #444;
  border-top: 1px solid #e0e0e0;
}

#footer-bottom-inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 30px;
  align-items: start;
  max-width: 900px;
  margin: 0 auto;
  padding: 25px 20px;
}

#footer-bottom p {
  margin: 5px 0;
  line-height: 1.5;
}

#footer-bottom a {
  color: #0077C0;
  text-decoration: none;
}

#footer-bottom a:hover {
  text-decoration: underline;
}

#footer-bottom-center {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  font-size: 12px;
  color: #666;
}

#footer-bottom-center img {
  flex-shrink: 0;
}

#footer-bottom-right {
  text-align: right;
}

#social-links {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

#social-links a {
  display: inline-block;
  color: #333;
  text-decoration: none;
  font-size: 20px;
  transition: color 0.2s;
}

#social-links a:hover {
  color: #0077C0;
}
