/* =========================================================================
   base.css — znovupoužitelný základ ECDL systému
   Design tokeny (CSS proměnné) + univerzální komponentní třídy.
   Modré téma (úřední) + kompaktní hustota.
   ========================================================================= */

:root {
  /* Barvy — modré téma */
  --primary:      #173b5e;
  --accent:       #2f6fed;
  --accent-soft:  #e8eefc;
  --bg:           #eef1f4;
  --surface:      #ffffff;
  --surface-alt:  #f6f8fa;
  --border:       #dce1e7;
  --border-soft:  #e9edf1;
  --text:         #15212e;
  --text-soft:    #566472;
  --muted:        #8392a2;

  /* Stavové barvy (fg + bg) */
  --ok-fg:     #15724a;  --ok-bg:     #e4f3ea;
  --warn-fg:   #985c08;  --warn-bg:   #fbeed6;
  --danger-fg: #a52121;  --danger-bg: #f8e3e3;
  --gray-fg:   #52606d;  --gray-bg:   #ebeff3;

  /* Rádiusy */
  --r-chip:   6px;
  --r-btn:    8px;
  --r-field:  9px;
  --r-card:   12px;
  --r-modal:  15px;
  --r-pill:   99px;

  /* Typografie */
  --font:  'Public Sans', -apple-system, system-ui, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, monospace;

  /* Stíny */
  --shadow-modal: 0 24px 60px rgba(0,0,0,.3);
  --shadow-toast: 0 12px 34px rgba(0,0,0,.28);
  --shadow-seg:   0 1px 2px rgba(0,0,0,.12);
}

/* ----- Reset & základní typografie ----- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
input, select, button, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: #c5ccd4; border-radius: 8px; }

@keyframes ddIn  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.text-soft { color: var(--text-soft); }

/* ----- Tlačítka ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-size: 12.5px; font-weight: 700;
  padding: 7px 14px; border-radius: var(--r-btn);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  background: var(--surface-alt); color: var(--text);
  transition: filter .12s ease;
}
.btn:hover { filter: brightness(.97); }
.btn--accent  { background: var(--accent);  color: #fff; }
.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--ok      { background: var(--ok-bg);   color: var(--ok-fg);   border-color: color-mix(in srgb, var(--ok-fg) 25%, transparent); }
.btn--warn    { background: var(--warn-bg); color: var(--warn-fg); border-color: color-mix(in srgb, var(--warn-fg) 25%, transparent); }
.btn--danger-outline { background: transparent; color: var(--danger-fg); border-color: var(--border); }
.btn--ghost   { background: transparent; color: var(--text-soft); border-color: var(--border); }
.btn--outline { background: var(--surface-alt); color: var(--primary); border-color: var(--border); }
.btn--disabled { background: var(--gray-bg); color: var(--gray-fg); cursor: not-allowed; }
.btn--disabled:hover { filter: none; }
.btn--block { width: 100%; }
.btn--wide  { width: 100%; padding: 10px; font-size: 13.5px; }
.btn--sm    { padding: 6px 11px; font-size: 12px; }

/* ----- Odkaz jako tlačítko (např. "Zobrazit vše →") ----- */
.link-accent {
  background: transparent; border: none; cursor: pointer;
  color: var(--accent); font-weight: 700; font-size: 12.5px; font-family: inherit;
}

/* ----- Badge / pill ----- */
.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: var(--r-pill); white-space: nowrap;
}
.badge--ok     { color: var(--ok-fg);     background: var(--ok-bg); }
.badge--warn   { color: var(--warn-fg);   background: var(--warn-bg); }
.badge--danger { color: var(--danger-fg); background: var(--danger-bg); }
.badge--gray   { color: var(--gray-fg);   background: var(--gray-bg); }
.badge--accent { color: #fff; background: var(--accent); }

/* ----- Chip (kód modulu) ----- */
.chip {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  padding: 2px 6px; border-radius: var(--r-chip);
  background: var(--accent-soft); color: var(--accent);
}
.chip--lg { padding: 3px 7px; }
.chip-row { display: flex; gap: 5px; flex-wrap: wrap; }

/* ----- Karty & povrchy ----- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 16px;
}
.card--pad15 { padding: 15px 16px; }
.card--flush { padding: 0; overflow: hidden; }

/* ----- Progress bar ----- */
.progress {
  height: 7px; background: var(--border-soft);
  border-radius: var(--r-pill); overflow: hidden;
}
.progress--sm { height: 5px; }
.progress--lg { height: 8px; }
.progress__bar { height: 100%; background: var(--accent); }
.progress__bar.is-accent { background: var(--accent); }
.progress__bar.is-warn   { background: var(--warn-fg); }
.progress__bar.is-danger { background: var(--danger-fg); }

/* ----- Formulářové prvky ----- */
.input, .select {
  border: 1px solid var(--border); border-radius: var(--r-field);
  padding: 8px 12px; font-size: 13px; background: var(--surface);
  color: var(--text); outline: none;
}
.select { cursor: pointer; font-weight: 600; }
.input:focus, .select:focus { border-color: var(--accent); }
.input--search { padding-left: 33px; width: 240px; max-width: 46vw; }

/* ----- Tabulka ----- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 10.5px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted); font-weight: 700;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.table td {
  padding: var(--row-pad, 9px 14px);
  border-bottom: 1px solid var(--border-soft); vertical-align: middle;
  font-size: 13px;
}
.table tr:last-child td { border-bottom: none; }
.th-sort {
  display: inline-flex; align-items: center; gap: 2px;
  color: inherit; text-decoration: none; cursor: pointer; white-space: nowrap;
  background: none; border: 0; padding: 0; font: inherit;
  text-transform: inherit; letter-spacing: inherit;
}
.th-sort:hover { color: var(--text); }
.th-sort.is-sorted { color: var(--text); }
.th-sort .sort-arrow { font-size: 11px; }

/* ----- Stat karta (dashboard) ----- */
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 15px 16px; }
.stat-card__label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.stat-card__value { font-size: 30px; font-weight: 800; color: var(--primary); line-height: 1.05; margin-top: 9px; }
.stat-card__sub   { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

/* ----- Segmentovaný přepínač / taby ----- */
.segment { display: inline-flex; gap: 4px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--r-field); padding: 3px; }
.segment__btn { padding: 6px 13px; border-radius: 7px; border: none; cursor: pointer; font-size: 12.5px; font-weight: 700; font-family: inherit; background: transparent; color: var(--text-soft); }
.segment__btn.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-seg); }

.tab { padding: 7px 14px; border-radius: var(--r-btn); border: 1px solid var(--border); cursor: pointer; font-size: 12.5px; font-weight: 600; font-family: inherit; background: var(--surface); color: var(--text-soft); }
.tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ----- Avatar ----- */
.avatar {
  width: 36px; height: 36px; border-radius: var(--r-field);
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex: 0 0 auto;
}
.avatar--sm { width: 34px; height: 34px; border-radius: 8px; font-size: 12px; }
.avatar--xs { width: 32px; height: 32px; border-radius: 8px; font-size: 11.5px; }

/* ----- Modal ----- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(12,22,33,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 18px; animation: fadeIn .15s ease;
}
.modal {
  background: var(--surface); width: 540px; max-width: 96vw; max-height: 90vh;
  overflow: auto; border-radius: var(--r-modal); animation: ddIn .2s ease;
  box-shadow: var(--shadow-modal);
}
.modal__head { background: var(--primary); color: #fff; padding: 18px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal__close { background: rgba(255,255,255,.16); border: none; color: #fff; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 16px; flex: 0 0 auto; line-height: 1; }
.modal__body { padding: 20px; }

/* ----- Toast ----- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--primary); color: #fff; padding: 12px 22px;
  border-radius: 11px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-toast); z-index: 80; animation: ddIn .22s ease;
}

/* ----- Navigační položka (sidebar) ----- */
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: var(--r-field); border: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; font-family: inherit; margin-bottom: 2px;
  background: transparent; color: rgba(255,255,255,.72);
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.is-active { background: rgba(255,255,255,.15); color: #fff; }
.nav-item__text { flex: 1; }
.nav-item__badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); }

.icon { flex: 0 0 auto; }

/* ----- Pomocné utility ----- */
.empty-state { padding: 32px; text-align: center; color: var(--text-soft); font-size: 13.5px; }
