/* Dokumentace FormCraft 365 - společný styl (světlý/tmavý motiv, responzivní, tisk). */
:root {
  --brand: #0f6cbd;
  --brand-hover: #115ea3;
  --bg: #ffffff;
  --bg-subtle: #f5f7fa;
  --bg-code: #f1f4f8;
  --text: #1f2933;
  --text-muted: #5f6c7b;
  --border: #d9dfe7;
  --link: #0f6cbd;
  --note-bg: #eaf3fc;   --note-bd: #0f6cbd;
  --tip-bg: #e9f7ee;    --tip-bd: #1e8a4c;
  --warn-bg: #fff6e0;   --warn-bd: #c27c00;
  --danger-bg: #fdecec; --danger-bd: #c42b2b;
  --todo-bg: #fff9db;   --todo-bd: #b59a00;
  --header-h: 56px;
  --sidebar-w: 280px;
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #4aa3ee;
    --brand-hover: #7bbcf3;
    --bg: #14181d;
    --bg-subtle: #1b2128;
    --bg-code: #20272f;
    --text: #e4e8ec;
    --text-muted: #9aa6b2;
    --border: #2d3640;
    --link: #6ab4f2;
    --note-bg: #14283b;   --note-bd: #4aa3ee;
    --tip-bg: #12301f;    --tip-bd: #3fb26f;
    --warn-bg: #3a2c0b;   --warn-bd: #e0a030;
    --danger-bg: #3d1a1a; --danger-bd: #e05a5a;
    --todo-bg: #3a350f;   --todo-bd: #c9b02a;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); }
a:hover { color: var(--brand-hover); }

/* Hlavička */
.site-header {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.site-header .brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; }
.site-header .brand span { color: var(--text-muted); font-weight: 400; }
.menu-toggle {
  display: none; background: none; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); font-size: 20px; line-height: 1; padding: 6px 10px; cursor: pointer;
}
.search { position: relative; margin-left: auto; width: min(360px, 50vw); }
.lang-switch { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; flex-shrink: 0; }
.lang-switch a { padding: 5px 9px; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--text-muted); background: var(--bg-subtle); line-height: 1.2; }
.lang-switch a:hover { color: var(--text); }
.lang-switch a.active { background: var(--brand); color: #ffffff; }
.md-export { position: relative; flex-shrink: 0; }
.md-export-btn {
  padding: 5px 9px; font-size: 12px; font-weight: 600; font-family: inherit; line-height: 1.2;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.md-export-btn:hover { border-color: var(--brand); color: var(--brand); }
.md-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; z-index: 40;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 4px;
}
.md-menu[hidden] { display: none; }
.md-menu button, .md-menu a {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--text); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer;
}
.md-menu button:hover, .md-menu a:hover { background: var(--bg-subtle); color: var(--brand); }
.search input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-subtle); color: var(--text); font: inherit; font-size: 14px;
}
.search-results {
  position: absolute; right: 0; left: 0; top: calc(100% + 6px); max-height: 70vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.search-results[hidden] { display: none; }
.search-results a { display: block; padding: 8px 12px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--bg-subtle); }
.search-results small { display: block; color: var(--text-muted); }
.search-results .empty { padding: 10px 12px; color: var(--text-muted); }

/* Rozvržení */
.layout { display: flex; align-items: flex-start; max-width: 1400px; margin: 0 auto; }
.sidebar {
  position: sticky; top: var(--header-h); flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  height: calc(100vh - var(--header-h)); overflow-y: auto; padding: 16px 12px 32px 16px;
  border-right: 1px solid var(--border); font-size: 14px;
}
.sidebar h4 {
  margin: 18px 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted);
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 4px 10px; border-radius: 6px; color: var(--text); text-decoration: none; }
.sidebar a:hover { background: var(--bg-subtle); }
.sidebar a.current { background: var(--note-bg); color: var(--brand); font-weight: 600; }
.sidebar .sub a { padding-left: 24px; }
.content { flex: 1 1 auto; min-width: 0; max-width: 860px; padding: 24px 32px 64px; }
.site-footer {
  max-width: 1400px; margin: 0 auto; padding: 16px 32px 32px; color: var(--text-muted); font-size: 13px;
  border-top: 1px solid var(--border);
}

/* Typografie */
h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.5rem; margin: 2.2rem 0 .6rem; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.2rem; margin: 1.8rem 0 .4rem; }
h4 { font-size: 1.05rem; margin: 1.4rem 0 .3rem; }
.lead { font-size: 1.1rem; color: var(--text-muted); margin: 0 0 1.5rem; }
p, ul, ol, dl { margin: .6rem 0 1rem; }
li { margin: .2rem 0; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--text-muted); }

/* Kotvy nadpisů s odkazem */
.anchor { margin-left: .4em; opacity: 0; text-decoration: none; font-weight: 400; color: var(--text-muted); }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }

/* Kód */
code, kbd { font-family: var(--mono); font-size: .9em; }
code { background: var(--bg-code); padding: .1em .35em; border-radius: 4px; }
pre {
  background: var(--bg-code); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; overflow-x: auto; line-height: 1.5; margin: .8rem 0 1.2rem;
}
pre code { background: none; padding: 0; font-size: 13.5px; }
pre[data-lang]::before {
  content: attr(data-lang); display: block; font: 600 11px/1 var(--mono); text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px; letter-spacing: .05em;
}
kbd {
  display: inline-block; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; background: var(--bg-subtle); color: var(--text); white-space: nowrap;
}

/* Tabulky */
table { border-collapse: collapse; width: 100%; margin: .8rem 0 1.2rem; font-size: 15px; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
th { background: var(--bg-subtle); }

/* Poznámky */
.note, .tip, .warning, .danger, .todo {
  margin: 1rem 0; padding: 10px 14px 10px 16px; border-left: 4px solid; border-radius: 0 var(--radius) var(--radius) 0;
}
.note > :first-child, .tip > :first-child, .warning > :first-child, .danger > :first-child { margin-top: 0; }
.note > :last-child, .tip > :last-child, .warning > :last-child, .danger > :last-child { margin-bottom: 0; }
.note { background: var(--note-bg); border-color: var(--note-bd); }
.tip { background: var(--tip-bg); border-color: var(--tip-bd); }
.warning { background: var(--warn-bg); border-color: var(--warn-bd); }
.danger { background: var(--danger-bg); border-color: var(--danger-bd); }
.todo { background: var(--todo-bg); border-color: var(--todo-bd); border-style: dashed; border-width: 1px 1px 1px 4px; font-style: italic; }
.note::before, .tip::before, .warning::before, .danger::before {
  display: block; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px;
}
.note::before { content: "Poznámka"; color: var(--note-bd); }
.tip::before { content: "Tip"; color: var(--tip-bd); }
.warning::before { content: "Pozor"; color: var(--warn-bd); }
.danger::before { content: "Nebezpečí"; color: var(--danger-bd); }

/* Štítky */
.badge {
  display: inline-block; padding: 1px 8px; margin-left: 4px; border-radius: 999px; vertical-align: middle;
  font: 600 11px/1.6 system-ui, sans-serif; letter-spacing: .03em; background: var(--bg-subtle);
  border: 1px solid var(--border); color: var(--text-muted);
}
.badge.pro { background: #7a3cd1; border-color: #7a3cd1; color: #fff; }
.badge.owner { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-bd); }
.badge.new { background: var(--tip-bg); border-color: var(--tip-bd); color: var(--tip-bd); }
.badge.dev { background: var(--note-bg); border-color: var(--note-bd); color: var(--note-bd); }

/* Kroky */
ol.steps { list-style: none; counter-reset: step; padding-left: 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 2px 0 10px 44px; min-height: 32px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff; text-align: center; line-height: 30px; font-weight: 700; font-size: 14px;
}

/* Definiční seznam funkcí (kotvy field-/fn-/ctx- ...) */
dl.features dt { font-weight: 700; margin-top: 1.1rem; }
dl.features dd { margin-left: 0; padding-left: 14px; border-left: 3px solid var(--border); }

/* Karty (úvodní stránka) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 1.5rem 0; }
.card {
  display: block; padding: 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-subtle);
  text-decoration: none; color: var(--text);
}
.card:hover { border-color: var(--brand); }
.card h3 { margin: 0 0 6px; color: var(--brand); }
.card p { margin: 0; color: var(--text-muted); font-size: 15px; }

/* Screenshoty */
figure.shot { margin: 1.2rem 0; padding: 0; }
figure.shot img { max-width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: var(--radius); }
figure.shot figcaption { margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.shot-ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 160px; padding: 20px; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--bg-subtle); color: var(--text-muted);
}
.shot-ph strong { color: var(--text); }
.shot-ph code { font-size: 12px; }

/* Předchozí / další */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 3rem; padding-top: 16px; border-top: 1px solid var(--border); }
.pager a {
  flex: 1 1 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text);
}
.pager a:hover { border-color: var(--brand); }
.pager a small { display: block; color: var(--text-muted); }
.pager .next { text-align: right; }

/* Úzké obrazovky */
@media (max-width: 900px) {
  .menu-toggle { display: inline-block; }
  .sidebar {
    position: fixed; left: 0; top: var(--header-h); z-index: 25; background: var(--bg);
    transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 16px rgba(0, 0, 0, .2);
  }
  body.nav-open .sidebar { transform: none; }
  .content { padding: 16px; }
  .site-footer { padding: 16px; }
  .site-header .brand span { display: none; }
}

/* Tisk */
@media print {
  .site-header, .sidebar, .pager, .anchor, .search, .lang-switch, .md-export { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .content { max-width: none; padding: 0; }
  a { color: #000; text-decoration: underline; }
  pre, .note, .tip, .warning, .danger, figure.shot, table { break-inside: avoid; }
  pre { white-space: pre-wrap; }
}
