/* ==========================================================================
   EU-konform Cookie Consent Banner & Native <dialog> Inspector
   ========================================================================== */

.cookie-banner {
  position: fixed;
  inset-inline: 16px;
  inset-block-end: 16px;
  z-index: 900;
  max-width: 1120px;
  margin-inline: auto;
  background: var(--surface, #ffffff);
  color: var(--ink, #0f172a);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius-md, 14px);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.16);
  padding: 18px 22px;
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}

.cookie-banner__copy {
  flex: 1 1 420px;
  min-width: 0;
}

.cookie-banner__title {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink, #0f172a);
}

.cookie-banner__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-light, #334155);
}

.cookie-banner__text a {
  color: var(--sky-dark, #21618c);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
}

/* Egyenrangú, sötét mintázatoktól mentes gombok */
.cookie-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: var(--radius-sm, 8px);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cookie-btn:focus-visible,
.cookie-tab:focus-visible,
.cookie-dialog__close:focus-visible,
.cookie-footer-btn:focus-visible {
  outline: 2px solid var(--sky, #3498db);
  outline-offset: 2px;
}

.cookie-btn--equal {
  background: var(--sky-contrast, #154360);
  color: #ffffff;
  border-color: var(--sky-contrast, #154360);
}

.cookie-btn--equal:hover {
  background: var(--sky-dark, #21618c);
  border-color: var(--sky-dark, #21618c);
}

.cookie-btn--secondary {
  background: var(--surface-subtle, #f8fafc);
  color: var(--ink, #0f172a);
  border-color: var(--line, #e2e8f0);
}

.cookie-btn--secondary:hover {
  background: var(--line-light, #f1f5f9);
  border-color: var(--muted, #64748b);
}

.cookie-btn--small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.84rem;
  background: var(--surface-subtle, #f8fafc);
  color: var(--ink, #0f172a);
  border-color: var(--line, #e2e8f0);
}

.cookie-btn--small:hover {
  background: var(--line-light, #f1f5f9);
}

/* Natív <dialog> modál */
.cookie-dialog {
  width: min(920px, calc(100vw - 24px));
  max-height: min(88dvh, 820px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius-lg, 20px);
  background: var(--surface, #ffffff);
  color: var(--ink, #0f172a);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.cookie-dialog[open] {
  display: flex;
  flex-direction: column;
}

.cookie-dialog:modal {
  overscroll-behavior: contain;
}

.cookie-dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(2px);
}

.cookie-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.cookie-dialog__title {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink, #0f172a);
}

.cookie-dialog__subtitle {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted, #64748b);
}

.cookie-dialog__close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 1px solid var(--line, #e2e8f0);
  background: var(--surface-subtle, #f8fafc);
  color: var(--ink, #0f172a);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cookie-dialog__close:hover {
  background: var(--line-light, #f1f5f9);
}

.cookie-dialog__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 24px;
  background: var(--surface-subtle, #f8fafc);
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.cookie-tab {
  appearance: none;
  border: 1px solid var(--line, #e2e8f0);
  background: var(--surface, #ffffff);
  color: var(--ink-light, #334155);
  border-radius: var(--radius-pill, 9999px);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.cookie-tab.is-active {
  background: var(--sky-contrast, #154360);
  border-color: var(--sky-contrast, #154360);
  color: #ffffff;
}

.cookie-dialog__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px 24px;
}

.cookie-panel[hidden] {
  display: none;
}

.cookie-consent-status {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 8px);
  background: var(--sky-light, #ebf5fb);
  border: 1px solid var(--sky-border, #aed6f1);
  color: var(--sky-contrast, #154360);
  font-size: 0.86rem;
  line-height: 1.45;
}

.cookie-category-list {
  display: grid;
  gap: 12px;
}

.cookie-category {
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius-md, 14px);
  padding: 14px 16px;
  background: var(--surface, #ffffff);
}

.cookie-category__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.cookie-category__title {
  margin: 0 0 3px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink, #0f172a);
}

.cookie-category__legal {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted, #64748b);
}

.cookie-category__desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-light, #334155);
}

.cookie-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill, 9999px);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.cookie-badge--required {
  background: var(--success-bg, #ecfdf5);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.cookie-badge--active {
  background: var(--sky-light, #ebf5fb);
  color: var(--sky-contrast, #154360);
}

.cookie-badge--muted {
  background: var(--line-light, #f1f5f9);
  color: var(--ink-light, #334155);
}

.cookie-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.cookie-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.cookie-switch__track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 9999px;
  background: #cbd5e1;
  transition: background-color 0.15s ease;
}

.cookie-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s ease;
}

.cookie-switch input:checked + .cookie-switch__track {
  background: var(--sky-contrast, #154360);
}

.cookie-switch input:checked + .cookie-switch__track::after {
  transform: translateX(20px);
}

.cookie-switch input:focus-visible + .cookie-switch__track {
  outline: 2px solid var(--sky, #3498db);
  outline-offset: 2px;
}

.cookie-switch__label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-light, #334155);
}

.cookie-live-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cookie-live-note {
  flex: 1 1 420px;
  margin: 0 0 12px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink-light, #334155);
}

.cookie-live-toolbar .cookie-live-note {
  margin-bottom: 0;
}

/* Reszponzív táblázat (modern-web-guidance: @container + sticky headers) */
.cookie-table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(440px, 55vh);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--radius-sm, 8px);
  container-type: inline-size;
}

.cookie-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  text-align: left;
}

.cookie-table__caption {
  padding: 10px 12px;
  font-weight: 800;
  font-size: 0.88rem;
  text-align: left;
  background: var(--surface-subtle, #f8fafc);
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.cookie-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  background: var(--surface-subtle, #f8fafc);
}

.cookie-table th,
.cookie-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-light, #f1f5f9);
  vertical-align: top;
}

.cookie-table thead th {
  font-weight: 800;
  color: var(--ink, #0f172a);
  border-bottom: 1px solid var(--line, #e2e8f0);
  white-space: nowrap;
}

.cookie-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: var(--surface, #ffffff);
  font-weight: 700;
  color: var(--ink, #0f172a);
}

.cookie-table code {
  font-size: 0.8rem;
  background: var(--line-light, #f1f5f9);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-word;
}

.cookie-table--live {
  --label-1: "Név";
  --label-2: "Típus";
  --label-3: "Kategória";
  --label-4: "Állapot";
  --label-5: "Lejárat";
  --label-6: "Adatkezelési cél";
}

.cookie-table--registry {
  --label-1: "Név";
  --label-2: "Szolgáltató";
  --label-3: "Kategória";
  --label-4: "Megőrzési idő";
  --label-5: "Jogalap";
  --label-6: "Adatkezelési cél";
}

@container (width < 600px) {
  .cookie-table,
  .cookie-table thead,
  .cookie-table tbody,
  .cookie-table tr,
  .cookie-table th,
  .cookie-table td {
    display: block;
  }

  .cookie-table thead {
    display: none;
  }

  .cookie-table tbody tr {
    margin: 10px;
    border: 1px solid var(--line, #e2e8f0);
    border-radius: var(--radius-sm, 8px);
    overflow: hidden;
  }

  .cookie-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--surface-subtle, #f8fafc);
    border-bottom: 1px solid var(--line, #e2e8f0);
  }

  .cookie-table td::before {
    font-weight: 700;
    color: var(--muted, #64748b);
    display: block;
    font-size: 0.76rem;
    margin-bottom: 2px;
  }

  .cookie-table td:nth-child(2)::before { content: var(--label-2); }
  .cookie-table td:nth-child(3)::before { content: var(--label-3); }
  .cookie-table td:nth-child(4)::before { content: var(--label-4); }
  .cookie-table td:nth-child(5)::before { content: var(--label-5); }
  .cookie-table td:nth-child(6)::before { content: var(--label-6); }
}

.cookie-dialog__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line, #e2e8f0);
  background: var(--surface-subtle, #f8fafc);
}

.cookie-dialog__privacy-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--sky-dark, #21618c);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cookie-footer-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .cookie-banner {
    inset-inline: 10px;
    inset-block-end: 10px;
    padding: 16px;
  }

  .cookie-banner__actions,
  .cookie-dialog__actions {
    width: 100%;
    flex-direction: column;
  }

  .cookie-banner__actions .cookie-btn,
  .cookie-dialog__actions .cookie-btn {
    width: 100%;
  }

  .cookie-dialog__header,
  .cookie-dialog__tabs,
  .cookie-dialog__body,
  .cookie-dialog__footer {
    padding-inline: 16px;
  }
}

