/* ---------- Design tokens ---------- */
:root {
  --bg: #EAF0F7;
  --surface: #FFFFFF;
  --ink: #16202E;
  --ink-soft: #5A6B80;
  --primary: #163A5E;
  --primary-soft: #2C567E;
  --accent: #E7A335;
  --accent-ink: #3A2205;
  --success: #2F855A;
  --success-soft: #E4F3EA;
  --danger: #C0392B;
  --danger-soft: #FBEAE7;
  --line: #D6E1EC;
  --radius: 14px;
  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: 32px;
}

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #F4F6F3;
  padding: 14px 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.topbar__back {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 22px;
  text-decoration: none;
  color: #F4F6F3;
  background: rgba(255,255,255,0.08);
}

.topbar__title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
  margin: 0;
  flex: 1;
  text-align: center;
  text-transform: uppercase;
}

.topbar__title--home {
  text-align: left;
  font-size: 1.4rem;
  padding-left: 4px;
}

.topbar__spacer {
  width: 40px;
  min-width: 40px;
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

/* ---------- Flash messages ---------- */
.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.flash {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
}

.flash--success { background: var(--success-soft); color: var(--success); }
.flash--error { background: var(--danger-soft); color: var(--danger); }

/* ---------- Menu (home) ---------- */
.menu-eyebrow {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 4px 0 14px;
}

.menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.menu-divider {
  margin: 10px 0 -2px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.menu-divider--first {
  border-top: none;
  padding-top: 0;
  margin-top: -6px;
}

.menu-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px;
  min-height: 60px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 1.02rem;
  transition: transform 0.08s ease;
}

.menu-tile:active { transform: scale(0.98); }

.menu-tile__icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg);
  font-size: 1.1rem;
  color: var(--primary);
}

.menu-tile--accent .menu-tile__icon {
  background: var(--accent);
  color: var(--accent-ink);
}

.menu-tile--stat .menu-tile__icon {
  background: var(--primary);
  color: #fff;
  font-family: var(--font-display);
}

.menu-tile--full {
  width: 100%;
  border: 1px solid var(--accent);
  font-family: var(--font-body);
  cursor: pointer;
}

/* ---------- Cards & forms ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.form-inline {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.form-inline:last-child { margin-bottom: 0; }

input[type="text"],
input[type="date"] {
  flex: 1;
  min-width: 0;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn--outline {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
}

.btn--block {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  margin-bottom: 10px;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stats-header .stats-total { margin: 0; }

.btn--danger-outline {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
  width: 100%;
  margin-top: 8px;
}

.btn--sticky {
  position: sticky;
  bottom: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  font-size: 1.05rem;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

.details-edit {
  font-size: 0.92rem;
}

.details-edit summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
}

.details-edit form {
  margin-top: 12px;
}

/* ---------- Roster / children list ---------- */
.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster__row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.roster__row--inactive { opacity: 0.55; }

.roster__edit-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.roster__name-input {
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  padding: 6px 4px;
  flex: 1;
  min-width: 0;
}

.roster__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  border: none;
  background: var(--bg);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
}

.icon-btn--danger { background: var(--danger-soft); }

.chip {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.chip--on { background: var(--success-soft); color: var(--success); }
.chip--off { background: var(--line); color: var(--ink-soft); }

/* ---------- Checklist (attendance) ---------- */
.progress-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}

.progress-summary__count {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--primary);
  line-height: 1;
}

.progress-summary__label {
  color: var(--ink-soft);
  font-weight: 500;
}

.roster--check .roster__row { padding: 0; overflow: hidden; }

.check-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 14px;
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.check-row__box {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--surface);
  position: relative;
  transition: all 0.12s ease;
}

.check-row__box::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 12px;
  border: solid white;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
  opacity: 0;
}

.check-row input:checked + .check-row__box {
  background: var(--success);
  border-color: var(--success);
}

.check-row input:checked + .check-row__box::after { opacity: 1; }

.check-row__name {
  font-weight: 600;
  font-size: 1.02rem;
}

.check-row:has(input:checked) {
  background: var(--success-soft);
}

/* ---------- Plain list (trainings/tournaments) ---------- */
.list-plain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-plain__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}

.list-plain__date {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.list-plain__arrow {
  color: var(--ink-soft);
  font-size: 1.3rem;
}

/* ---------- Stats page (signature ring element) ---------- */
.stats-total {
  color: var(--ink-soft);
  margin: 4px 0 16px;
}

.stats-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.stats-row__ring {
  --size: 52px;
  width: var(--size);
  height: var(--size);
  min-width: var(--size);
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--pct) * 1%), var(--line) 0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-row__ring span {
  width: calc(var(--size) - 10px);
  height: calc(var(--size) - 10px);
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--primary);
}

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

.stats-row__name {
  font-weight: 700;
}

.stats-row__sub {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------- Vyhledávací pole ---------- */
.search-box {
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--ink);
}

/* ---------- Filtr období u statistik ---------- */
.period-filter {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.period-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.period-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--primary);
  background: var(--bg);
}

.period-chip--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.period-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.period-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
  flex: 1;
  min-width: 130px;
}

.period-form .btn {
  height: 44px;
}

/* ---------- Patička ---------- */
.app-footer {
  max-width: 480px;
  margin: 24px auto 0;
  padding: 16px 14px 4px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.app-version {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.6;
}

/* ---------- Přihlašovací obrazovka ---------- */
.login-body {
  display: flex;
  min-height: 100vh;
}

.login-wrap {
  margin: auto;
  width: 100%;
  max-width: 360px;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
}

.login-title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin: 0 0 4px;
}

.login-subtitle {
  color: var(--ink-soft);
  margin: 0 0 18px;
  font-size: 0.92rem;
}

.login-input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--bg);
  color: var(--ink);
  margin-bottom: 12px;
}

/* ---------- Lišta aktivní sezóny ---------- */
.season-bar {
  display: block;
  text-align: center;
  background: var(--primary-soft);
  color: #EAF1F8;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 10px;
  text-decoration: none;
}

.season-hint {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin: 0 0 12px;
}

.season-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
}

.season-row--active {
  border-color: var(--primary);
  background: #EAF1F8;
}

.season-row__name {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

/* ---------- Poznámka k tréninku/turnaji ---------- */
.note-banner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.92rem;
  color: var(--ink);
  margin-bottom: 14px;
}

.note-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
  margin: 8px 0;
}

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

.list-plain__note {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------- Archiv ---------- */
.archive-block summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
}

.archive-block .list-plain {
  margin-top: 12px;
}

/* ---------- Hromadné akce a autosave ---------- */
.bulk-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.bulk-actions .btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 10px 8px;
}

.autosave-indicator {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--success);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.autosave-indicator--visible {
  opacity: 1;
}

/* ---------- Statický chip "Vlastní výběr" ---------- */
.period-chip--static {
  cursor: default;
  border-style: dashed;
}

/* ---------- Admin: účty trenérů ---------- */
.account-row {
  align-items: center;
}

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

.account-row__name {
  font-weight: 700;
}

.account-row__meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 400;
}

.account-actions {
  position: relative;
}

.account-actions summary {
  list-style: none;
  cursor: pointer;
}

.account-actions summary::-webkit-details-marker {
  display: none;
}

.account-actions__form {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  gap: 6px;
  z-index: 20;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  min-width: 220px;
}

.account-actions__form input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ---------- Empty state ---------- */
.empty-state {
  color: var(--ink-soft);
  text-align: center;
  padding: 30px 10px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
