/* ============================================================
   styl.css – sdílené styly svach.eu statistiky
   ============================================================ */

:root[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #161920;
  --border: #252930;
  --border-strong: #363c47;
  --text: #dde1e8;
  --muted: #7a8290;
  --accent: #5b8dee;
  --accent-dim: #1e2d4a;
  --section-label: #3d4452;
  --tag-bg: #1a1f28;
  --tag-border: #2a3040;
  --tag-text: #6b7585;
  --placeholder: #2a3040;
  --placeholder-text: #3d4452;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --ok: #4caf7d;
  --danger: #e05c5c;
  --icon-sun: block;
  --icon-moon: none;
}

:root[data-theme="light"] {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --border: #e0e4eb;
  --border-strong: #c8cdd8;
  --text: #1a1f2e;
  --muted: #6b7280;
  --accent: #3b6fd4;
  --accent-dim: #dce8ff;
  --section-label: #c0c6d0;
  --tag-bg: #f5f7fa;
  --tag-border: #dde1eb;
  --tag-text: #8892a0;
  --placeholder: #e8ecf2;
  --placeholder-text: #c0c6d0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --ok: #2e7d55;
  --danger: #c0392b;
  --icon-sun: none;
  --icon-moon: block;
}

/* BASE */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.logo {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-back {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.header-back:hover { color: var(--accent); border-color: var(--accent); }

.theme-btn {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-sun { display: var(--icon-sun); }
.icon-moon { display: var(--icon-moon); }

/* MAIN */
main {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

/* CARD */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* FORM ELEMENTS */
label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  margin-bottom: 14px;
  transition: border-color 0.15s;
}
input:focus { outline: none; border-color: var(--accent); }

select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  margin-bottom: 14px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8290' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s;
}
select:focus { outline: none; border-color: var(--accent); }

button.btn-primary {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
button.btn-primary:hover { opacity: 0.88; }

/* MESSAGES */
.msg {
  font-size: 12px;
  margin-top: 10px;
  min-height: 1.2em;
}
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* USER BAR */
.userbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.userbar span { color: var(--muted); font-size: 13px; }
.btn-logout {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

/* TABLE */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
tr:last-child td { border-bottom: none; }

/* DOBA – zadávání časového intervalu (minuty / sekundy / setiny) */
.doba-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.doba-field {
  display: flex;
  flex-direction: column;
}
.doba-field label {
  font-size: 10px;
  margin-bottom: 4px;
}
.doba-field input {
  margin-bottom: 0;
}
.doba-preview {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  min-height: 1.4em;
}
.doba-preview span {
  color: var(--accent);
  font-weight: 600;
}


/* DATUM HINT – ISO formát zobrazený pod date inputem */
.datum-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: -10px;
  margin-bottom: 14px;
}


/* DATUM – zadávání data přes tři inputy (dd / mm / yyyy) */
.datum-wrap {
  display: grid;
  grid-template-columns: 56px 56px 80px;
  gap: 8px;
  margin-bottom: 14px;
}
.datum-field { display: flex; flex-direction: column; }
.datum-field label { font-size: 10px; margin-bottom: 4px; }
.datum-field input { margin-bottom: 0; text-align: center; }
.datum-preview {
  font-size: 11px;
  color: var(--muted);
  margin-top: -10px;
  margin-bottom: 14px;
}
.datum-preview span { color: var(--accent); }


/* ROZCESTNIK – tabulka statistik na index.html */
.stats-table {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.section-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px 120px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 6px 16px;
  gap: 8px;
}
.section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--section-label);
  align-self: center;
}
.col-header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--placeholder-text);
  text-align: center;
}
.stat-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px 120px;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  gap: 8px;
  align-items: center;
  transition: background 0.1s;
}
.stat-row:last-child { border-bottom: none; }
.stat-row:hover { background: var(--accent-dim); }
.stat-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-cell { text-align: center; }
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  transition: background 0.15s, color 0.15s;
}
.btn-action:hover { background: var(--accent); color: #fff; }
.btn-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  border: 1px dashed var(--placeholder);
  color: var(--placeholder-text);
  background: none;
  cursor: default;
  user-select: none;
}

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

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }


/* DATA TABLE – tabulka s daty, ovládáním a stránkováním */
/* Přidat na konec styl.css (před případný komentář /* UTILITY */) */

.tbl-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.tbl-controls-left, .tbl-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tbl-label {
  font-size: 12px;
  color: var(--muted);
}
.tbl-select {
  width: auto;
  padding: 5px 28px 5px 10px;
  font-size: 13px;
  margin-bottom: 0;
}
.tbl-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  width: auto;
}
.tbl-btn:hover { border-color: var(--accent); color: var(--accent); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--bg);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--accent-dim); }
.data-table tbody tr.editing { background: var(--accent-dim); }
.data-table tbody tr.row-saved { animation: rowFlash 0.6s ease; }

@keyframes rowFlash {
  0%   { background: color-mix(in srgb, var(--ok) 40%, transparent); }
  100% { background: transparent; }
}

.col-sortable { cursor: pointer; user-select: none; }
.col-sortable:hover { color: var(--accent); }
.sort-arrow { color: var(--accent); font-size: 11px; }
.col-actions { width: 72px; text-align: right; white-space: nowrap; }

.tbl-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity 0.15s;
  width: auto;
}
.tbl-icon-btn:hover { opacity: 1; }

.edit-input {
  width: 100%;
  padding: 5px 8px;
  border-radius: 5px;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 0;
}
.edit-input:focus { outline: none; }

.tbl-loading, .tbl-empty {
  text-align: center;
  padding: 24px !important;
  color: var(--muted);
  font-size: 13px;
}

/* STRÁNKOVÁNÍ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 13px;
}
.page-info {
  color: var(--muted);
  font-size: 12px;
  margin-right: 8px;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  width: auto;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); cursor: default; }
.page-btn:disabled { opacity: 0.35; cursor: default; }
.page-dots { color: var(--muted); padding: 0 4px; }
.page-jump {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-jump input {
  width: 52px;
  padding: 4px 6px;
  text-align: center;
  font-size: 12px;
  margin-bottom: 0;
}
