/* =========================================================
   NIO Hub — právní dokumenty a souhlas s cookies
   ========================================================= */

/* ---------- Rozvržení ---------- */

.page-head--legal { background: linear-gradient(180deg, #F3F7FF, #FFF); }
.page-head--legal .crumbs { padding-top: 0; margin-bottom: 10px; }

.legal__updated {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 14px; padding: 6px 13px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 12.5px; color: var(--muted);
}
.legal__updated .icon { color: var(--blue-500); }

.legal-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px; align-items: start; margin-bottom: 40px;
}

.legal-main {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 34px 40px 38px;
  box-shadow: var(--sh-sm);
}

.legal-aside { display: grid; gap: 16px; position: sticky; top: calc(var(--header-h) + 16px); }

.legal-nav { display: grid; gap: 3px; }
.legal-nav__link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 13.8px; color: var(--ink-2);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.legal-nav__link:hover { background: var(--canvas); color: var(--blue-700); }
.legal-nav__link .icon { color: var(--muted-2); flex: none; }
.legal-nav__link.is-active {
  background: var(--blue-50); color: var(--blue-700); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--blue-600);
}
.legal-nav__link.is-active .icon { color: var(--blue-600); }

/* ---------- Text dokumentu ---------- */

.legal { font-size: 15px; line-height: 1.72; color: var(--ink-2); }

.legal__intro {
  font-size: 16.5px; line-height: 1.68; color: var(--ink);
  padding-bottom: 22px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line-2);
}

.legal h2 {
  margin: 34px 0 14px;
  font-size: 21px; font-weight: 700; color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.legal h2:first-of-type { margin-top: 26px; }

.legal h3 {
  margin: 24px 0 10px;
  font-size: 16.5px; font-weight: 700; color: var(--ink);
}

.legal p { margin-bottom: 13px; }
.legal p strong:first-child { color: var(--ink); }

.legal ul, .legal ol { margin: 0 0 16px; padding-left: 4px; }
.legal li {
  position: relative; padding-left: 22px; margin-bottom: 8px;
}
.legal ul li::before {
  content: ""; position: absolute; left: 6px; top: 10px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--blue-500);
}
.legal ol { counter-reset: item; }
.legal ol li { counter-increment: item; }
.legal ol li::before {
  content: counter(item) "."; position: absolute; left: 0; top: 0;
  color: var(--blue-600); font-weight: 700; font-size: 13.5px;
}

.legal a { color: var(--blue-600); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.legal a:hover { color: var(--blue-800); }

.legal code {
  font-family: "Cascadia Mono", Consolas, monospace; font-size: 12.8px;
  padding: 2px 7px; border-radius: 5px;
  background: var(--canvas); border: 1px solid var(--line-2); color: var(--ink);
}

/* Rámeček s údaji */
.legal__box {
  padding: 20px 22px; margin: 18px 0 20px;
  background: var(--canvas); border: 1px solid var(--line);
  border-radius: var(--r);
}
.legal__box p { margin: 0; line-height: 1.75; }

.legal__dl { display: grid; gap: 9px; margin: 0; }
.legal__dl div {
  display: grid; grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px; align-items: baseline;
}
.legal__dl dt { color: var(--muted); font-size: 13.5px; }
.legal__dl dd { margin: 0; font-weight: 600; color: var(--ink); }

/* Zvýrazněná poznámka */
.legal__note {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 16px 18px; margin: 20px 0;
  border-radius: var(--r); border: 1px solid var(--line);
  background: var(--canvas);
}
.legal__note > .icon { flex: none; margin-top: 2px; color: var(--blue-600); }
.legal__note p { margin: 6px 0 0; font-size: 14px; }
.legal__note p:last-child { margin-bottom: 0; }
.legal__note strong { color: var(--ink); }

.legal__note--warn { background: #FFFBEB; border-color: #FDE68A; }
.legal__note--warn > .icon { color: #B45309; }
.legal__note--warn strong { color: #92400E; }

.legal__note--ok { background: #ECFDF5; border-color: #A7F3D0; }
.legal__note--ok > .icon { color: #15803D; }
.legal__note--ok strong { color: #065F46; }

/* Tabulka */
.legal__table-wrap { overflow-x: auto; margin: 18px 0 22px; }
.legal__table {
  width: 100%; border-collapse: collapse; font-size: 13.8px; min-width: 560px;
}
.legal__table th {
  text-align: left; padding: 11px 14px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--canvas);
  border-bottom: 1px solid var(--line);
}
.legal__table th:first-child { border-radius: var(--r-sm) 0 0 0; }
.legal__table th:last-child { border-radius: 0 var(--r-sm) 0 0; }
.legal__table td {
  padding: 13px 14px; border-bottom: 1px solid var(--line-2);
  vertical-align: top; line-height: 1.6;
}
.legal__table tr:last-child td { border-bottom: 0; }
.legal__table strong { color: var(--ink); }

.legal__ref { display: inline-block; font-size: 12px; color: var(--muted-2); font-style: italic; }

/* Práva subjektu údajů */
.legal__rights {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; margin: 20px 0 24px;
}
.legal__right {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 16px 17px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.legal__right:hover { border-color: var(--blue-200); box-shadow: var(--sh-sm); }
.legal__right > .icon {
  width: 34px; height: 34px; flex: none; padding: 8px; border-radius: 9px;
  background: var(--blue-50); color: var(--blue-600); box-sizing: border-box;
}
.legal__right strong { display: block; font-size: 14.5px; color: var(--ink); margin-bottom: 3px; }
.legal__right p { margin: 0; font-size: 13.2px; line-height: 1.55; color: var(--muted); }

/* Kroky */
.legal__steps { display: grid; gap: 12px; margin: 20px 0 24px; }
.legal__step {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
}
.legal__step-no {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blue-600); color: #fff; font-size: 13.5px; font-weight: 700;
}
.legal__step strong { display: block; font-size: 14.8px; color: var(--ink); margin-bottom: 3px; }
.legal__step p { margin: 0; font-size: 13.5px; line-height: 1.6; }

/* Formulář pro odstoupení */
.legal__form {
  padding: 28px 30px; margin: 20px 0 24px;
  border: 1.5px solid var(--line); border-radius: var(--r);
  background: var(--surface);
}
.legal__form-to {
  padding-bottom: 18px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line-2); line-height: 1.7;
}
.legal__line { display: grid; gap: 5px; margin-bottom: 20px; }
.legal__line > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.legal__line > i {
  display: block; height: 30px;
  border-bottom: 1.5px dotted var(--muted-2);
}
.legal__line--split { grid-template-columns: 1fr 1fr; gap: 5px 24px; }
.legal__line--split > span:nth-child(3) { grid-column: 2; grid-row: 1; }
.legal__line--split > i:nth-child(2) { grid-column: 1; }
.legal__line--sign > span small { font-weight: 400; color: var(--muted-2); }

.legal__valid {
  margin-top: 32px; padding-top: 20px;
  border-top: 1px solid var(--line-2);
  font-size: 13.5px; color: var(--muted);
}

/* ---------- Lišta cookies ---------- */

.cookiebar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 150;
  animation: cookieIn .35s var(--ease);
}
@keyframes cookieIn {
  from { opacity: 0; transform: translateY(16px); }
}

.cookiebar__inner {
  max-width: var(--container); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 18px 22px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-lg);
}

.cookiebar__text { display: flex; gap: 14px; align-items: flex-start; flex: 1; min-width: 280px; }
.cookiebar__icon {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--blue-50); color: var(--blue-600);
}
.cookiebar__text strong { display: block; font-size: 15px; margin-bottom: 3px; }
.cookiebar__text p { font-size: 13.2px; color: var(--muted); line-height: 1.55; max-width: 720px; }
.cookiebar__text a { color: var(--blue-600); font-weight: 600; }

.cookiebar__actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* Podrobné nastavení */
.cookiemodal { position: fixed; inset: 0; z-index: 160; display: grid; place-items: center; padding: 16px; }
.cookiemodal[hidden], .cookiebar[hidden] { display: none; }
.cookiemodal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); }

.cookiemodal__panel {
  position: relative; width: 100%; max-width: 620px; max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--sh-lg); overflow: hidden;
  animation: cookieIn .28s var(--ease);
}

.cookiemodal__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line-2);
}
.cookiemodal__head h2 {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 18px;
}
.cookiemodal__head .icon { color: var(--blue-600); }

.cookiemodal__body { padding: 20px 24px; overflow-y: auto; }
.cookiemodal__lead { font-size: 13.8px; color: var(--muted); margin-bottom: 18px; line-height: 1.6; }
.cookiemodal__lead a { color: var(--blue-600); font-weight: 600; }

.cookiemodal__foot {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  padding: 16px 24px; border-top: 1px solid var(--line-2); background: var(--canvas);
}

.cookieopt {
  padding: 16px 18px; margin-bottom: 11px;
  border: 1px solid var(--line); border-radius: var(--r);
}
.cookieopt:last-child { margin-bottom: 0; }
.cookieopt__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 7px;
}
.cookieopt__head > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cookieopt__head strong { font-size: 15px; }
.cookieopt p { font-size: 13px; color: var(--muted); line-height: 1.58; margin: 0; }
.cookieopt--off { opacity: .68; }

/* Přepínač */
.switch {
  position: relative; width: 44px; height: 25px; flex: none;
  display: inline-block; cursor: pointer;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: var(--r-pill);
  background: var(--line); transition: background .2s var(--ease);
}
.switch i::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: #fff; box-shadow: var(--sh-xs);
  transition: transform .2s var(--ease);
}
.switch input:checked + i { background: var(--blue-600); }
.switch input:checked + i::before { transform: translateX(19px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--blue-50); }
.switch--locked { cursor: default; }
.switch--locked i { background: var(--green); }
.switch--locked i::before { transform: translateX(19px); }
.switch--off { cursor: not-allowed; }
.switch--off i { background: var(--line); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.footer__operator { font-size: 12px; color: rgba(255, 255, 255, .42); }

/* ---------- Responzivita ---------- */

@media (max-width: 1080px) {
  .legal-layout { grid-template-columns: 1fr; }
  .legal-aside { position: static; }
  .legal-main { padding: 26px 24px 30px; }
}

@media (max-width: 720px) {
  .legal__dl div { grid-template-columns: 1fr; gap: 2px; }
  .legal__rights { grid-template-columns: 1fr; }
  .legal__line--split { grid-template-columns: 1fr; }
  .legal__line--split > span:nth-child(3) { grid-column: 1; grid-row: auto; }
  .legal__form { padding: 20px 18px; }
  .cookiebar { left: 8px; right: 8px; bottom: 8px; }
  .cookiebar__inner { padding: 16px; }
  .cookiebar__actions { width: 100%; }
  .cookiebar__actions .btn { flex: 1; }
  .cookiemodal__foot .btn { flex: 1; }
}

@media print {
  .site-header, .site-footer, .legal-aside, .cookiebar, .cookiemodal,
  .crumbs, .noprint { display: none !important; }
  .legal-layout { grid-template-columns: 1fr; }
  .legal-main { border: 0; box-shadow: none; padding: 0; }
  body { background: #fff; }
}
