/* Cookie preferences component */

.cookie-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.cookie-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cookie-panel {
  width: 100%;
  max-height: min(94dvh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--doc-bg);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.cookie-overlay.open .cookie-panel {
  transform: translateY(0);
}

.cookie-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  background: var(--doc-bg);
  border-bottom: 1px solid rgba(11, 82, 89, 0.12);
}

.cookie-title {
  color: var(--label);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.cookie-subtitle {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.4;
  color: #555;
  max-width: 26ch;
}

.cookie-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(11, 82, 89, 0.08);
  color: var(--label);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cookie-close:hover {
  background: rgba(11, 82, 89, 0.14);
}

.cookie-close svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  fill: none;
}

.cookie-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 18px 10px;
}

.cookie-demo-note {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(11, 82, 89, 0.07);
  color: var(--label);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.cookie-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(11, 82, 89, 0.1);
}

.cookie-row:last-child {
  border-bottom: none;
}

.cookie-row-title {
  color: var(--label);
  font-size: 14px;
  font-weight: 700;
}

.cookie-row-copy {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.38;
  color: #555;
  max-width: 30ch;
}

.cookie-switch {
  position: relative;
  display: inline-flex;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
}

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

.cookie-switch-track {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #c9c9c9;
  transition: background 0.15s ease;
  position: relative;
  cursor: pointer;
}

.cookie-switch-track::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.cookie-switch input:checked + .cookie-switch-track {
  background: var(--banner-bg);
}

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

.cookie-switch input:focus-visible + .cookie-switch-track {
  outline: 3px solid rgba(11, 82, 89, 0.22);
  outline-offset: 2px;
}

.cookie-switch input:disabled + .cookie-switch-track {
  opacity: 0.58;
  cursor: not-allowed;
}

.cookie-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 18px 14px;
  background: var(--doc-bg);
  border-top: 1px solid rgba(11, 82, 89, 0.12);
}

.cookie-btn {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 5px;
  border: 1.5px solid var(--banner-bg);
  font-family: "Dosis", sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 3px var(--content-bg);
}

.cookie-btn-primary {
  background: var(--banner-bg);
  color: var(--banner-text);
  grid-column: 1 / -1;
}

.cookie-btn-secondary {
  background: #fff;
  color: var(--label);
}

.cookie-btn:hover {
  filter: brightness(0.98);
}

body.cookie-open {
  overflow: hidden;
}

.cookie-subtitle a {
  color: inherit;
  font-weight: bold;
  text-decoration: underline;
}

@media (min-width: 768px) {
  .cookie-overlay {
    align-items: center;
    padding: 28px;
  }

  .cookie-panel {
    width: min(600px, 100%);
    max-height: min(84dvh, 760px);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(16px) scale(0.97);
  }

  .cookie-overlay.open .cookie-panel {
    transform: translateY(0) scale(1);
  }

  .cookie-header {
    padding: 22px 24px 18px;
    background: #fff;
  }

  .cookie-subtitle {
    max-width: none;
  }

  .cookie-body {
    padding: 12px 24px 16px;
  }

  .cookie-demo-note {
    margin-bottom: 18px;
  }

  .cookie-row {
    padding: 20px 0;
  }

  .cookie-row-copy {
    max-width: none;
  }

  .cookie-actions {
    grid-template-columns: 1fr 1fr 1.25fr;
    padding: 16px 24px 20px;
    background: #fff;
  }

  .cookie-btn-primary {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  .menu-overlay,
  .menu-drawer,
  .drawer-panel,
  .picker-overlay,
  .picker-sheet,
  .setting-expand,
  .cookie-overlay,
  .cookie-panel,
  .cookie-switch-track,
  .confirm-overlay,
  .confirm-dialog {
    transition: none !important;
  }
}
