/**
 * AV Cookie Consent – UI aligned with Diskho.se (Flatsome / Inter).
 * Tokens from live site:
 * - font: Inter
 * - text: #0a0a0a
 * - brand: #7a8060
 * - dark CTA: #101010
 * - pill buttons
 */

:root {
  --avcc-font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --avcc-bg: #ffffff;
  --avcc-text: #0a0a0a;
  --avcc-muted: #5a5a5a;
  --avcc-border: #ebebeb;
  --avcc-border-strong: #d4d4d4;
  --avcc-brand: #7a8060;
  --avcc-brand-soft: #f3f4ef;
  --avcc-brand-text: #ffffff;
  --avcc-dark: #101010;
  --avcc-focus: #7a8060;
  --avcc-radius: 14px;
  --avcc-btn-radius: 999px;
  --avcc-shadow: 0 12px 40px rgba(16, 16, 16, 0.14), 0 2px 8px rgba(16, 16, 16, 0.06);
  --avcc-switch-off: #dcdcdc;
  --avcc-edge: 24px;
  --avcc-card-width: 420px;
}

.avcc-banner,
.avcc-modal,
.avcc-noscript,
.avcc-settings-link,
.avcc-cookie-table {
  font-family: var(--avcc-font);
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

.avcc-banner *,
.avcc-modal * {
  box-sizing: border-box;
}

/* ===== Banner card (desktop: bottom-left) ===== */
.avcc-banner {
  position: fixed;
  z-index: 99990;
  left: var(--avcc-edge);
  bottom: var(--avcc-edge);
  width: min(var(--avcc-card-width), calc(100vw - (var(--avcc-edge) * 2)));
  max-height: min(72vh, 560px);
  overflow: auto;
  background: var(--avcc-bg);
  color: var(--avcc-text);
  border: 1px solid var(--avcc-border);
  border-radius: var(--avcc-radius);
  box-shadow: var(--avcc-shadow);
  padding: 0;
}

.avcc-banner:not([hidden]) {
  animation: avcc-rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.avcc-banner__inner {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1.35rem 1.4rem 1.25rem;
  border-top: 3px solid var(--avcc-brand);
  border-radius: inherit;
}

.avcc-banner__title {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--avcc-text);
  margin: 0 0 0.5rem;
}

.avcc-banner__text {
  margin: 0;
  color: var(--avcc-muted);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.55;
}

.avcc-banner__links {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.avcc-banner__links a {
  color: var(--avcc-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color 0.15s ease;
}

.avcc-banner__links a:hover {
  color: var(--avcc-brand);
}

.avcc-banner__sync {
  margin: 0.55rem 0 0;
  font-size: 0.8125rem;
  color: var(--avcc-muted);
}

.avcc-banner__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  width: 100%;
}

.avcc-banner__actions .avcc-btn--primary {
  grid-column: 1 / -1;
}

/* Buttons */
.avcc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  min-width: 44px;
  padding: 0.6rem 1rem;
  border-radius: var(--avcc-btn-radius);
  border: 1px solid transparent;
  background: var(--avcc-bg);
  color: var(--avcc-dark);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.avcc-btn:hover {
  transform: translateY(-1px);
}

.avcc-btn:active {
  transform: translateY(0);
}

.avcc-btn--ghost {
  background: transparent;
  color: var(--avcc-muted);
  border-color: transparent;
  font-weight: 600;
}

.avcc-btn--ghost:hover {
  color: var(--avcc-text);
  background: #f6f6f6;
}

.avcc-btn--secondary {
  background: var(--avcc-bg);
  color: var(--avcc-dark);
  border-color: var(--avcc-dark);
}

.avcc-btn--secondary:hover {
  background: #f7f7f7;
}

.avcc-btn--primary {
  background: var(--avcc-dark);
  color: #fff;
  border-color: var(--avcc-dark);
  box-shadow: 0 1px 2px rgba(16, 16, 16, 0.12);
}

.avcc-btn--primary:hover {
  background: #2a2a2a;
  border-color: #2a2a2a;
}

.avcc-btn:focus-visible,
.avcc-switch input:focus-visible + .avcc-switch__ui,
.avcc-settings-link:focus-visible,
.avcc-banner__links a:focus-visible {
  outline: 3px solid var(--avcc-focus);
  outline-offset: 2px;
}

@keyframes avcc-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Preferences modal ===== */
.avcc-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
}

.avcc-modal:not([hidden]) .avcc-modal__backdrop {
  animation: avcc-fade 0.25s ease both;
}

.avcc-modal:not([hidden]) .avcc-modal__dialog {
  animation: avcc-rise 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.avcc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 16, 16, 0.42);
  backdrop-filter: blur(2px);
}

.avcc-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(440px, calc(100% - 1.5rem));
  max-height: min(90vh, 720px);
  overflow: auto;
  margin: 8vh auto;
  background: var(--avcc-bg);
  color: var(--avcc-text);
  border-radius: var(--avcc-radius);
  border: 1px solid var(--avcc-border);
  box-shadow: var(--avcc-shadow);
  padding: 0;
}

.avcc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.2rem 1.35rem 0.85rem;
  border-top: 3px solid var(--avcc-brand);
  border-radius: var(--avcc-radius) var(--avcc-radius) 0 0;
}

.avcc-modal__header h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--avcc-text);
}

.avcc-modal__close {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--avcc-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.avcc-modal__close:hover {
  background: #f5f5f5;
  color: var(--avcc-text);
}

.avcc-modal__body {
  padding: 0.25rem 1.35rem 0.5rem;
}

.avcc-cat {
  border-top: 1px solid var(--avcc-border);
  padding: 1rem 0;
}

.avcc-cat:first-of-type {
  border-top: 0;
  padding-top: 0.35rem;
}

.avcc-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.avcc-cat h3 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--avcc-text);
}

.avcc-cat p {
  margin: 0.4rem 0 0;
  color: var(--avcc-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.avcc-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--avcc-brand-soft);
  font-size: 0.6875rem;
  color: var(--avcc-brand);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.avcc-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 52px;
  cursor: pointer;
  flex-shrink: 0;
}

.avcc-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.avcc-switch__ui {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--avcc-switch-off);
  border: 1px solid var(--avcc-border-strong);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.avcc-switch__ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.avcc-switch input:checked + .avcc-switch__ui {
  background: var(--avcc-brand);
  border-color: var(--avcc-brand);
}

.avcc-switch input:checked + .avcc-switch__ui::after {
  transform: translateX(20px);
}

.avcc-modal__footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin: 0;
  padding: 1rem 1.35rem 1.25rem;
  border-top: 1px solid var(--avcc-border);
}

.avcc-modal__footer .avcc-btn--primary {
  grid-column: 1 / -1;
}

.avcc-visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.avcc-noscript {
  padding: 0.75rem 1rem;
  background: #f5f5f5;
  color: var(--avcc-text);
  text-align: center;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--avcc-border);
}

.avcc-settings-link {
  background: none;
  border: 0;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font: inherit;
  padding: 0.25rem 0;
  min-height: 44px;
}

.avcc-table-wrap {
  overflow-x: auto;
}

.avcc-cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  color: var(--avcc-text);
}

.avcc-cookie-table th,
.avcc-cookie-table td {
  border: 1px solid var(--avcc-border);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.avcc-cookie-table th {
  background: #f7f7f7;
  font-weight: 700;
}

html.avcc-modal-open {
  overflow: hidden;
}

@keyframes avcc-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .avcc-banner:not([hidden]),
  .avcc-modal:not([hidden]) .avcc-modal__backdrop,
  .avcc-modal:not([hidden]) .avcc-modal__dialog {
    animation: none;
  }

  .avcc-btn,
  .avcc-switch__ui,
  .avcc-switch__ui::after,
  .avcc-banner__links a {
    transition: none;
  }

  .avcc-btn:hover {
    transform: none;
  }
}

/* ===== Mobile: bottom sheet ===== */
@media (max-width: 640px) {
  :root {
    --avcc-edge: 12px;
  }

  .avcc-banner {
    left: var(--avcc-edge);
    right: var(--avcc-edge);
    bottom: var(--avcc-edge);
    width: auto;
    max-height: min(58vh, 460px);
  }

  .avcc-banner__inner {
    padding: 1.15rem 1.15rem 1.05rem;
    gap: 1rem;
  }

  .avcc-banner__title {
    font-size: 1.0625rem;
  }

  .avcc-banner__text {
    font-size: 0.875rem;
  }

  .avcc-banner__actions {
    grid-template-columns: 1fr;
  }

  .avcc-modal__dialog {
    margin: auto var(--avcc-edge) var(--avcc-edge);
    width: calc(100% - (var(--avcc-edge) * 2));
    max-height: min(85vh, 640px);
    position: absolute;
    left: var(--avcc-edge);
    right: var(--avcc-edge);
    bottom: var(--avcc-edge);
  }

  .avcc-modal__footer {
    grid-template-columns: 1fr;
  }
}
