/*
 * Admin pre Fio párovanie.
 *
 * Farby, rádiusy a typografia sú prevzaté z témy iProbio (assets/iprobio-custom.css),
 * aby administrácia vyzerala ako súčasť toho istého sveta. Vzhľad je plochý:
 * plné farby, jasné hranice, tiene len tam, kde niečo naozaj pláva nad obsahom.
 */

:root {
  /* Značka */
  --teal: #17a19e;
  --teal-btn: #0f7d7a;     /* tmavší odtieň len pre plochy s bielym textom */
  --teal-dark: #0a5c59;
  --teal-soft: #e5f2f1;
  --navy: #1a547a;
  --ink: #081a26;

  /* Text */
  --text: #1b1d1f;
  --text-body: #4a5568;
  --text-muted: #5c6b7d;   /* AA 4,5:1 na bielej aj na --surface-alt */
  --text-invert: #f8fafc;

  /* Plochy */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f2f6f9;
  --line: rgba(26, 84, 122, 0.12);
  --line-soft: rgba(26, 84, 122, 0.06);

  /* Stavy */
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --alert: #c0392b;
  --alert-soft: #fbeae7;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-pill: 9999px;

  --shadow-pop: 0 10px 40px -10px rgba(26, 84, 122, 0.18);
  --transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  --sidebar-width: 232px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }

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

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }

/* ---------- Rozloženie ---------- */

.layout { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--ink);
  color: var(--text-invert);
  padding: 1.25rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: #fff;
  padding: 0 0.625rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar__brand span { color: var(--teal); }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  color: rgba(248, 250, 252, 0.72);
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.sidebar__link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.sidebar__link.is-active { background: var(--teal); color: #fff; }

.sidebar__count {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  padding: 0.0625rem 0.4375rem;
}

.sidebar__link.is-active .sidebar__count { background: rgba(0, 0, 0, 0.2); }

.sidebar__foot { margin-top: auto; font-size: 0.75rem; color: rgba(248, 250, 252, 0.5); padding: 0 0.625rem; }
.sidebar__foot a { color: rgba(248, 250, 252, 0.8); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0.875rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar__user { font-size: 0.8125rem; color: var(--text-body); }

.content { padding: 1.75rem; display: flex; flex-direction: column; gap: 1.25rem; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar__nav { flex-direction: row; }
  /* Meno používateľa je na mobile zbytočné, odhlásenie nie. */
  .sidebar__foot { padding: 0; border: 0; font-size: 0; }
  .sidebar__foot a { font-size: 0.8125rem; }
  .sidebar__foot br { display: none; }
  .content { padding: 1rem; }
}

/* ---------- Karty a tabuľky ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.card__head {
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card__body { padding: 1.125rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.875rem; }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
}

.stat__label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.stat__value { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat--alert .stat__value { color: var(--alert); }
.stat--ok .stat__value { color: var(--ok); }

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }

table.data th {
  text-align: left;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.625rem 0.875rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data td { padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-alt); }
table.data tbody tr:last-child td { border-bottom: 0; }

.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 0.75rem; }
.muted { color: var(--text-muted); }
.wrap { max-width: 320px; }

.empty { padding: 2.5rem 1.125rem; text-align: center; color: var(--text-muted); }

/* ---------- Odznaky ---------- */

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--alert { background: var(--alert-soft); color: var(--alert); }
.badge--muted { background: var(--surface-alt); color: var(--text-body); }
.badge--teal { background: var(--teal-soft); color: var(--teal-dark); }

/* ---------- Formuláre a tlačidlá ---------- */

label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-body); margin-bottom: 0.25rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  height: 36px;
  padding: 0 0.6875rem;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea { height: auto; padding: 0.5rem 0.6875rem; }

input:hover, select:hover { border-color: rgba(26, 84, 122, 0.28); }

input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 161, 158, 0.12);
}

/* Outline sa ruší len pri kliknutí myšou. Pri Tabe musí zostať viditeľný,
   inak sa formulár nedá obsluhovať klávesnicou. */
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) { outline: none; }

input::placeholder { color: var(--text-muted); }

/* Vlastný select. Natívna šípka vyzerá na každom systéme inak a nesedí
   s ostatnými poľami, tak ju nahradíme jednou šípkou vo farbe značky. */
select {
  appearance: none;
  padding-right: 2rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%231a547a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6875rem center;
}

select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%2317a19e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

select::-ms-expand { display: none; }

/* Spinner pri číslach je len ďalšia šípka navyše, ktorá mätie so selectom. */
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.45;
  transition: opacity var(--transition);
}
input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 0.9; }

/* Prepínač namiesto holého štvorčeka. */
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 36px;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition), background var(--transition);
}

.check:hover { border-color: rgba(26, 84, 122, 0.28); }
.check:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }

.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.check span { font-size: 0.8125rem; font-weight: 500; color: var(--text-body); }
.check:has(input:checked) span { color: var(--teal-dark); }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem 0.875rem;
  align-items: end;
}

.filters__actions { display: flex; gap: 0.5rem; align-items: center; }
.filters__actions .btn { height: 36px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn:hover { text-decoration: none; }
.btn--primary { background: var(--teal-btn); color: #fff; }
.btn--primary:hover { background: var(--teal-dark); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--text-body); }
.btn--ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn--danger { background: var(--alert); color: #fff; }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 0.3125rem 0.625rem; font-size: 0.75rem; }

/* ---------- Hlásenia ---------- */

.flash { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.8125rem; border: 1px solid; }
.flash--success { background: var(--ok-soft); border-color: rgba(21, 128, 61, 0.2); color: var(--ok); }
.flash--error { background: var(--alert-soft); border-color: rgba(192, 57, 43, 0.2); color: var(--alert); }
.flash--info { background: var(--teal-soft); border-color: rgba(23, 161, 158, 0.25); color: var(--teal-dark); }

/* ---------- Prihlásenie ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--ink); }

.login__card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-pop);
}

.login__brand { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; margin-bottom: 0.25rem; }
.login__brand span { color: var(--teal); }
.login__sub { color: var(--text-muted); font-size: 0.8125rem; margin: 0 0 1.25rem; }
.login__field { margin-bottom: 0.875rem; }
.login__row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.125rem; font-size: 0.8125rem; color: var(--text-body); }
.login__row input { width: auto; }
.login__row label { margin: 0; font-weight: 400; }

/* ---------- Stránkovanie ---------- */

.pagination { display: flex; flex-wrap: wrap; gap: 0.25rem; list-style: none; padding: 1rem 1.125rem; margin: 0; font-size: 0.8125rem; }
.pagination a, .pagination span { display: block; padding: 0.25rem 0.5rem; border-radius: var(--radius-sm); }
.pagination .current { background: var(--teal-btn); color: #fff; font-weight: 600; }
.pagination .disabled { color: var(--text-muted); }

.dl { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 0.5rem 1.25rem; margin: 0; font-size: 0.8125rem; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; }

/* Formulárová mriežka pre nastavenia — dve polia vedľa seba, na mobile pod sebou. */
.form-grid { display: grid; gap: 0.875rem 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid--rule { align-items: start; }
.form-grid--rule > div:last-child { align-self: end; }

/* Omrvinky. Sedia nad nadpisom, tenké — orientáciu majú dať, nie ťahať pozornosť. */
.topbar__title { min-width: 0; }
.crumbs { margin-bottom: 0.125rem; }
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.crumbs li { display: flex; align-items: center; gap: 0.375rem; }
.crumbs li + li::before { content: "/"; color: var(--line-strong, var(--line)); }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--navy); }
.crumbs [aria-current="page"] { color: var(--text); }

/* Klikateľný riadok. Odkaz v riadku zostáva, toto len rozširuje plochu. */
table.data tbody tr[data-href] { cursor: pointer; }
table.data tbody tr[data-href]:hover { background: var(--surface-alt); }

/* Text len pre čítačky obrazovky. Rozlíši rovnako pomenované tlačidlá v tabuľke. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Vodorovné rolovanie tabuliek musí byť vidieť, inak sa stĺpce vpravo stratia. */
.table-wrap { -webkit-overflow-scrolling: touch; }
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

@media (max-width: 900px) {
  /* Safari na iPhone približuje stránku pri vstupe do poľa menšieho než 16 px
     a späť ju už neoddiali. */
  input, select, textarea { font-size: 16px; }
  /* Klikacia plocha aspoň 44 px, ako žiada WCAG 2.5.5. */
  .btn { min-height: 44px; }
  .btn--sm { min-height: 38px; }
  .card__head { flex-wrap: wrap; }
  .card__head form { width: 100%; }
  .card__head input[type="text"] { width: 100% !important; }
}

/* Dlaždice na prehľade sú odkazy — číslo, ktorým sa začína deň, musí byť klikateľné. */
a.stat { color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--teal); }
