/* ==========================================================================
   Mechanizm zgód na cookies (RODO) — LegalnyMedyk
   Sterowany przez static/js/cookie-consent.js. Nieblokujący dolny banner +
   wyśrodkowany panel ustawień z tabelami kategorii.
   ========================================================================== */

.lm-cc, .lm-embed-gate {
  --cc-primary: var(--brand-primary, #27A3DC);
  --cc-primary-dark: var(--brand-primary-dark, #1A86B8);
  --cc-accent: var(--brand-accent, #F4BD37);
  --cc-ink: var(--ink-900, #333);
  --cc-ink-soft: var(--ink-600, #667085);
  --cc-line: var(--ink-300, #E0E8F0);
  --cc-paper: #fff;
  --cc-paper-2: var(--surface-warm, #FBFBFA);
  font-family: inherit;
  color: var(--cc-ink);
}
.lm-cc[hidden] { display: none; }

/* --- Baner (dolny, nieblokujący) ---------------------------------------- */
.lm-cc__banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9600;
  background: var(--cc-paper);
  border: 1px solid var(--cc-line);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(11, 31, 58, 0.18);
  animation: lm-cc-rise .28s ease both;
}
.lm-cc__banner[hidden] { display: none; }
.lm-cc__banner-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
  max-width: 1180px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.lm-cc__banner-text { flex: 1 1 420px; min-width: 260px; }
.lm-cc__title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--cc-ink);
}
.lm-cc__banner-text p {
  margin: 0;
  font-size: .92rem;
  line-height: 1.55;
  color: var(--cc-ink-soft);
}
.lm-cc__banner-text a { color: var(--cc-primary); font-weight: 600; }
.lm-cc__banner-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
}

/* --- Przyciski ---------------------------------------------------------- */
.lm-cc__btn {
  font: inherit;
  font-weight: 700;
  font-size: .9rem;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}
.lm-cc__btn:active { transform: translateY(1px); }
.lm-cc__btn--primary {
  background: var(--cc-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(39, 163, 220, .35);
}
.lm-cc__btn--primary:hover { background: var(--cc-primary-dark); }
.lm-cc__btn--ghost {
  background: transparent;
  color: var(--cc-ink);
  border-color: var(--cc-line);
}
.lm-cc__btn--ghost:hover { background: var(--cc-paper-2); border-color: var(--cc-primary); }

/* --- Panel ustawień (modal) --------------------------------------------- */
.lm-cc__overlay {
  position: fixed;
  inset: 0;
  z-index: 9700; /* pod topbarem (10000), by pasek pozostał widoczny nad przyciemnieniem */
  background: rgba(11, 31, 58, .55);
  display: flex;
  align-items: flex-start;              /* panel poniżej topbara, nie wyśrodkowany w pionie */
  justify-content: center;
  /* Offset: 84px (sticky topbar) + 20px odstęp, by okno nie wchodziło pod pasek menu. */
  padding: 104px 20px 24px;
  overflow-y: auto;
  animation: lm-cc-fade .2s ease both;
}
.lm-cc__overlay[hidden] { display: none; }
.lm-cc__panel {
  background: var(--cc-paper);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 128px);      /* mieści się między topbarem a dołem ekranu */
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(11, 31, 58, .35);
  animation: lm-cc-rise .26s ease both;
}
.lm-cc__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--cc-line);
}
.lm-cc__panel-head h2 { margin: 0; font-size: 1.2rem; font-weight: 800; }
.lm-cc__close {
  background: none;
  border: none;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--cc-ink-soft);
  cursor: pointer;
  padding: 0 4px;
}
.lm-cc__close:hover { color: var(--cc-ink); }
.lm-cc__panel-body { padding: 8px 24px 4px; overflow-y: auto; }
.lm-cc__intro {
  font-size: .92rem;
  line-height: 1.6;
  color: var(--cc-ink-soft);
  margin: 12px 0 16px;
}
.lm-cc__intro a { color: var(--cc-primary); font-weight: 600; }

/* --- Kategoria ---------------------------------------------------------- */
.lm-cc__cat {
  border: 1px solid var(--cc-line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--cc-paper-2);
}
.lm-cc__cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lm-cc__cat-toggle {
  background: none;
  border: none;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  color: var(--cc-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
}
.lm-cc__cat-toggle i {
  color: var(--cc-primary);
  font-size: .8rem;
  transition: transform .18s ease;
}
.lm-cc__cat-toggle[aria-expanded="true"] i { transform: rotate(90deg); }
.lm-cc__cat-desc {
  margin: 8px 0 0;
  font-size: .87rem;
  line-height: 1.55;
  color: var(--cc-ink-soft);
}

/* Przełącznik */
.lm-cc__switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  cursor: pointer;
}
.lm-cc__switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.lm-cc__switch-track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--ink-400, #cbd5e1);
  position: relative;
  transition: background .18s ease;
  flex: 0 0 auto;
}
.lm-cc__switch-track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.lm-cc__switch input:checked + .lm-cc__switch-track { background: var(--cc-primary); }
.lm-cc__switch input:checked + .lm-cc__switch-track::after { transform: translateX(20px); }
.lm-cc__switch input:disabled + .lm-cc__switch-track { background: var(--success-leaf, #4CAF50); opacity: .7; cursor: default; }
.lm-cc__switch input:focus-visible + .lm-cc__switch-track { outline: 2px solid var(--cc-primary); outline-offset: 2px; }
.lm-cc__switch-label { font-size: .78rem; font-weight: 700; color: var(--success-leaf, #4CAF50); }

/* --- Tabela cookies ----------------------------------------------------- */
.lm-cc__cat-details { margin-top: 12px; }
.lm-cc__cat-details[hidden] { display: none; }
.lm-cc__table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.lm-cc__table th, .lm-cc__table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cc-line);
  vertical-align: top;
  line-height: 1.45;
}
.lm-cc__table th {
  font-weight: 700;
  color: var(--cc-ink);
  background: rgba(39, 163, 220, .06);
  white-space: nowrap;
}
.lm-cc__table td { color: var(--cc-ink-soft); }

/* --- Stopka panelu ------------------------------------------------------ */
.lm-cc__panel-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--cc-line);
  background: var(--cc-paper);
}

/* --- Osadzenia bramkowane (Faza 2) -------------------------------------- */
.lm-embed-gate {
  border: 1px dashed var(--cc-line);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  background: var(--cc-paper-2);
  color: var(--cc-ink-soft);
  font-size: .9rem;
}
.lm-embed-gate p { margin: 0 0 14px; line-height: 1.5; }
.lm-embed-gate .lm-cc__btn { font-size: .85rem; }

/* --- Animacje ----------------------------------------------------------- */
@keyframes lm-cc-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes lm-cc-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .lm-cc__banner, .lm-cc__panel, .lm-cc__overlay { animation: none; }
  .lm-cc__btn, .lm-cc__cat-toggle i, .lm-cc__switch-track::after { transition: none; }
}

/* --- Responsywność ------------------------------------------------------ */
@media (max-width: 720px) {
  /* Mobile: topbar niższy (height:auto) — mniejszy offset. */
  .lm-cc__overlay { padding: 76px 10px 16px; }
  .lm-cc__panel { max-height: calc(100vh - 92px); }

  .lm-cc__banner { left: 8px; right: 8px; bottom: 8px; border-radius: 14px; }
  .lm-cc__banner-inner { padding: 16px; gap: 14px; }
  .lm-cc__banner-actions { width: 100%; }
  .lm-cc__banner-actions .lm-cc__btn { flex: 1 1 auto; text-align: center; }
  .lm-cc__panel-foot .lm-cc__btn { flex: 1 1 auto; }

  /* Tabela → karty (unikamy poziomego scrolla na mobile) */
  .lm-cc__table, .lm-cc__table tbody, .lm-cc__table tr, .lm-cc__table td { display: block; width: 100%; }
  .lm-cc__table thead { display: none; }
  .lm-cc__table tr { border: 1px solid var(--cc-line); border-radius: 10px; padding: 6px 4px; margin-bottom: 10px; background: #fff; }
  .lm-cc__table td { border: none; padding: 5px 12px; }
  .lm-cc__table td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--cc-ink);
  }
}

/* --- OS dark mode (użytkownik z systemowym ciemnym motywem) ------------- */
@media (prefers-color-scheme: dark) {
  .lm-cc {
    --cc-ink: #E8EDF3;
    --cc-ink-soft: #9BA8B7;
    --cc-line: #2A3646;
    --cc-paper: #131b26;
    --cc-paper-2: #0e1620;
  }
  .lm-cc__table th { background: rgba(39, 163, 220, .14); }
  .lm-cc__table tr { background: #131b26; }
  .lm-cc__btn--ghost { color: var(--cc-ink); }
}
