/* ─── Admin CSS — FK Nový Jičín U8 ────────────────────────────────────────── */

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

:root {
  --primary:      #1a4b8c;
  --primary-dark: #133a6e;
  --primary-light:#e8f0fb;
  --accent:       #e8b800;
  --danger:       #dc2626;
  --danger-light: #fee2e2;
  --success:      #16a34a;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --bg:           #f8fafc;
  --bg-white:     #ffffff;
  --sidebar-w:    240px;
  --header-h:     56px;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 25px rgba(0,0,0,.12);
}

body { font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }

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

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; border: 1.5px solid transparent;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn--outline  { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn--outline:hover { background: var(--primary-light); }
.btn--danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { background: #b91c1c; }
.btn--sm       { padding: 4px 10px; font-size: 12px; }
.btn--block    { width: 100%; justify-content: center; }
.btn--icon-only { padding: 4px 8px; }

/* ─── Inputs ──────────────────────────────────────────────────────────────── */

.input {
  display: block; width: 100%;
  padding: 7px 10px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13px; font-family: inherit; color: var(--text); background: var(--bg-white);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,75,140,.12); }
.input--sm { padding: 4px 8px; font-size: 12px; }
select.input { cursor: pointer; }
.textarea { resize: vertical; min-height: 80px; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .03em;
  background: var(--primary-light); color: var(--primary);
}
.role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; background: #f1f5f9; color: var(--text-muted);
}

/* ─── LOGIN SCREEN ────────────────────────────────────────────────────────── */

.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 20px;
}
.login-box {
  background: var(--bg-white); border-radius: 16px; padding: 40px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-title { font-size: 20px; font-weight: 700; color: var(--primary); }
.login-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 13px; }
.login-form { text-align: left; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.login-error {
  background: var(--danger-light); color: var(--danger); border-radius: var(--radius);
  padding: 8px 12px; margin-bottom: 12px; font-size: 13px;
}
.login-form .btn--primary { margin-top: 4px; padding: 10px; font-size: 14px; }

/* ─── ADMIN LAYOUT ────────────────────────────────────────────────────────── */

.admin-app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); background: var(--primary); color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: transform .25s;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px; border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar__logo { font-size: 28px; }
.sidebar__title { font-weight: 700; font-size: 15px; }
.sidebar__sub { font-size: 11px; opacity: .7; }
.sidebar__nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar__link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: rgba(255,255,255,.8); font-size: 14px;
  cursor: pointer; border: none; background: none; width: 100%;
  text-align: left; border-radius: 0; transition: background .15s, color .15s;
  font-family: inherit;
}
.sidebar__link:hover, .sidebar__link--active { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.sidebar__link--active { font-weight: 600; }
.sidebar__link--back { border-top: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.6); font-size: 13px; }
.sidebar__link--logout { color: rgba(255,255,255,.5); font-size: 13px; }
.sidebar__footer { padding: 8px 0; border-top: 1px solid rgba(255,255,255,.12); }

/* Main */
.admin-main {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-height: 100vh;
}
.admin-header {
  height: var(--header-h); background: var(--bg-white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow);
}
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px 8px; }
.admin-header__title { font-size: 18px; font-weight: 700; flex: 1; }
.admin-content { padding: 20px; flex: 1; }

/* ─── TOOLBAR ─────────────────────────────────────────────────────────────── */

.toolbar {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar .input { max-width: 240px; }

/* ─── DATA TABLE ──────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table {
  width: 100%; border-collapse: collapse; background: var(--bg-white);
  font-size: 13px;
}
.data-table thead th {
  background: #f1f5f9; padding: 10px 12px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border);
}
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table td { padding: 10px 12px; vertical-align: middle; }
.td-actions { display: flex; gap: 6px; }
.td-name { font-weight: 500; }
.td-note { color: var(--text-muted); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.thumb-placeholder { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: #f1f5f9; border-radius: 6px; font-size: 20px; }

/* ─── CATEGORY GRID ───────────────────────────────────────────────────────── */

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cat-card {
  background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 12px;
}
.cat-card__color { width: 6px; height: 48px; border-radius: 3px; flex-shrink: 0; }
.cat-card__info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.cat-slug { font-size: 11px; color: var(--text-muted); background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }
.cat-card__actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── EXPORT SECTION ──────────────────────────────────────────────────────── */

.export-section { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.export-card {
  background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.export-card h2 { font-size: 15px; font-weight: 600; }
.export-card p { color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.export-card code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.export-card--warn { border-top: 3px solid var(--accent); }
.export-card--danger { border-top: 3px solid var(--danger); }
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.import-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.status-msg { padding: 8px 12px; border-radius: var(--radius); font-size: 13px; }
.status-msg--success { background: #dcfce7; color: var(--success); }
.status-msg--error   { background: var(--danger-light); color: var(--danger); }

/* ─── MODAL ───────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 200; display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.modal {
  background: var(--bg-white); border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 680px; margin: auto;
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 16px; font-weight: 700; }
.modal__close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; }
.modal__close:hover { background: #f1f5f9; }
.modal__body { padding: 20px; }

/* ─── FORM HELPERS ────────────────────────────────────────────────────────── */

.modal-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field--grow { flex: 1; min-width: 140px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.req { color: var(--danger); }
.hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 6px; }

.form-details { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.form-details summary { padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 13px; background: #f8fafc; user-select: none; }
.form-details summary:hover { background: #f1f5f9; }
.form-details > .form-row, .form-details > .form-field { padding: 14px; }
.form-details[open] summary { border-bottom: 1px solid var(--border); }
.form-details > *:not(summary) { padding: 14px; }

/* Image */
.image-tabs { display: flex; gap: 0; margin-bottom: 6px; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; width: fit-content; }
.img-tab { padding: 5px 14px; font-size: 12px; font-weight: 500; background: var(--bg-white); border: none; cursor: pointer; color: var(--text-muted); font-family: inherit; }
.img-tab:hover { background: #f1f5f9; }
.img-tab--active { background: var(--primary); color: #fff; }
.img-tab-panel { display: flex; flex-direction: column; gap: 6px; }
.img-preview-wrap { position: relative; width: fit-content; margin-top: 8px; }
.img-preview-wrap img { max-width: 100%; max-height: 200px; border-radius: var(--radius); border: 1px solid var(--border); display: block; }
.btn--icon-only.btn--danger { position: absolute; top: 4px; right: 4px; padding: 2px 6px; font-size: 11px; }

/* Video */
.video-preview-wrap { margin-top: 8px; }
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); background: #000; }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* Color picker */
.color-picker-row { display: flex; align-items: center; gap: 10px; }
.color-input { width: 48px; height: 36px; padding: 2px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; background: none; }
.color-preview { width: 36px; height: 36px; border-radius: var(--radius); border: 1px solid var(--border); }

/* ─── TOAST ───────────────────────────────────────────────────────────────── */

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 500; z-index: 999; box-shadow: var(--shadow-lg);
  transition: transform .3s ease, opacity .3s ease; opacity: 0; pointer-events: none;
  white-space: nowrap;
}
.toast--visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast--error   { background: var(--danger); }
.toast--info    { background: var(--primary); }

/* ─── EMPTY STATE ─────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--text-muted);
  background: var(--bg-white); border-radius: var(--radius); box-shadow: var(--shadow);
}
.empty-state p { font-size: 15px; }

/* ─── RESPONSIVE ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar--open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-toggle { display: flex; }
  .admin-main { margin-left: 0; }
  .td-actions { flex-direction: column; }
  .export-section { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: 1fr; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 12px 12px 0 0; max-width: 100%; }
}

/* ─── Concept editor ──────────────────────────────────────────────────────── */
.concept-months-admin { display: flex; flex-direction: column; gap: 16px; margin-bottom: 12px; }
.concept-month-row {
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
}
.concept-month-row__header { display: flex; align-items: flex-start; gap: 8px; }
.concept-month-row__num { font-weight: 700; color: var(--text-muted); font-size: 15px; padding-top: 28px; min-width: 20px; }

/* ─── Classification rules editor ────────────────────────────────────────── */
.rules-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rule-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 8px 10px;
}
.rule-row__if, .rule-row__then { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.rule-keyword { max-width: 160px; }
.rule-type    { max-width: 160px; }

/* ─── Markdown toolbar ───────────────────────────────────────────────────── */
.md-toolbar { display:flex; gap:4px; margin-bottom:4px; flex-wrap:wrap; }
.md-toolbar button { padding:3px 9px; font-size:12px; border:1.5px solid var(--border); border-radius:4px; background:var(--bg-white); cursor:pointer; font-family:inherit; color:var(--text); }
.md-toolbar button:hover { background:var(--bg); }
.md-preview { border:1.5px solid var(--border); border-radius:var(--radius); padding:10px 12px; min-height:80px; font-size:13px; line-height:1.6; background:var(--bg-white); }
.md-preview p { margin:0 0 .4em; }
.md-preview ul, .md-preview ol { padding-left:1.4em; margin:.2em 0; }
.md-preview strong { font-weight:700; }
.md-preview hr { border:none; border-top:1px solid var(--border); margin:.5em 0; }

/* ─── Training composer ──────────────────────────────────────────────────── */
.comp-topbar { display:flex; align-items:center; gap:12px; margin-bottom:1.5rem; flex-wrap:wrap; }
.comp-topbar__title { flex:1; font-size:17px; font-weight:700; }
.comp-header-form { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; margin-bottom:16px; padding:16px; background:var(--bg-white); border:1.5px solid var(--border); border-radius:var(--radius); }
.comp-dur-display { margin-top:6px; font-size:15px; }
.comp-phase { border:1.5px solid var(--border); border-radius:var(--radius); margin-bottom:10px; overflow:hidden; }
.comp-phase summary { padding:10px 14px; cursor:pointer; font-weight:600; display:flex; align-items:center; gap:8px; background:var(--bg); list-style:none; }
.comp-phase summary::-webkit-details-marker { display:none; }
.comp-phase[open] summary { border-bottom:1px solid var(--border); }
.comp-phase-time { font-size:13px; font-weight:700; color:var(--primary); }
.comp-phase-sugg { font-size:11px; color:var(--text-muted); font-weight:400; }
.comp-phase-body { padding:12px; }
.comp-phase-list { list-style:none; padding:0; display:flex; flex-direction:column; gap:8px; margin-bottom:10px; }
.comp-ex-item { display:flex; align-items:center; gap:6px; background:var(--bg-white); border:1px solid var(--border); border-radius:6px; padding:8px 10px; flex-wrap:wrap; }
.comp-ex-item__handle { cursor:grab; color:var(--text-muted); font-size:16px; }
.comp-ex-item__name { flex:1; font-weight:500; font-size:13px; min-width:100px; }
.comp-ex-item__dur { display:flex; align-items:center; gap:4px; font-size:13px; }
.comp-ex-item__dur input { width:52px; }
.comp-ex-item__notes { min-width:140px; flex:1; font-size:12px; }
.comp-picker { border:1.5px solid var(--border); border-radius:var(--radius); padding:14px; margin-top:12px; background:var(--bg); }
.comp-picker__filters { display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.comp-picker__grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:10px; max-height:340px; overflow-y:auto; }
.comp-pick-card { background:var(--bg-white); border:1.5px solid var(--border); border-radius:var(--radius); padding:10px; cursor:pointer; transition:border-color .15s; }
.comp-pick-card:hover { border-color:var(--primary); background:var(--primary-light); }
.comp-pick-card__thumb { width:100%; height:72px; object-fit:cover; border-radius:4px; margin-bottom:6px; }
.comp-pick-card__thumb--empty { background:#f1f5f9; display:flex; align-items:center; justify-content:center; font-size:22px; }
.comp-pick-card__name { font-size:12px; font-weight:600; margin-bottom:4px; }
.comp-pick-card__dur { font-size:11px; color:var(--text-muted); margin-top:4px; }

/* ─── Test history ───────────────────────────────────────────────────────── */
.test-history { width:100%; border-collapse:collapse; font-size:13px; margin-bottom:1.5rem; }
.test-history th { background:#f1f5f9; padding:8px 10px; text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-muted); border-bottom:1.5px solid var(--border); }
.test-history td { padding:8px 10px; border-bottom:1px solid var(--border); vertical-align:middle; }
.best-val { font-weight:700; color:var(--primary); }
.td-attempts { font-size:12px; }
.attempt-list { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-bottom:4px; }
.attempt-list input { width:80px; }
.attempt-best-hint { font-size:12px; color:var(--primary); font-weight:600; min-height:18px; }

/* ─── Testing event editor ───────────────────────────────────────────────── */
.tevt-test { margin-bottom: 1.25rem; }
.tevt-test-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.tevt-test-config { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.tevt-testname { flex: 1; min-width: 200px; }
.tevt-results-wrap { overflow-x: auto; }
.tevt-results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tevt-results-table th { background: #f1f5f9; padding: 6px 10px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.tevt-results-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tevt-player-col { min-width: 160px; }
.tevt-addcol { width: 100px; }
.tevt-player-name { font-size: 13px; white-space: nowrap; }
.tevt-num { display: inline-block; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 24px; margin-right: 4px; }
.tevt-val { width: 72px; }
.tevt-attempt-th { min-width: 80px; }
