/* ── Cookie Banner ─────────────────────────────────────────────────────────── */

#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.10);
  font-family: "Work Sans", "Open Sans", Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #333;

  /* entrance animation: starts off-screen */
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#cookie-banner.cb-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */

.cb-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 28px;
}

.cb-main {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

/* ── Text ───────────────────────────────────────────────────────────────────── */

.cb-text {
  flex: 1;
  min-width: 220px;
}

.cb-text p {
  margin: 0 0 6px;
}

.cb-links {
  font-size: 0.8125rem;
  color: #777;
  margin-top: 2px;
}

.cb-links a {
  color: #478ac9;
  text-decoration: none;
}

.cb-links a:hover {
  text-decoration: underline;
}

/* ── Action buttons ─────────────────────────────────────────────────────────── */

.cb-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cb-btn {
  padding: 10px 22px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  border: 2px solid #1a1a1a;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.cb-btn:focus-visible {
  outline: 3px solid #478ac9;
  outline-offset: 2px;
}

/* Accept — filled dark */
.cb-btn-accept {
  background: #1a1a1a;
  color: #fff;
}
.cb-btn-accept:hover {
  background: #333;
  border-color: #333;
}

/* Reject — same size, same border, inverted fill — equal prominence */
.cb-btn-reject {
  background: #fff;
  color: #1a1a1a;
}
.cb-btn-reject:hover {
  background: #f2f2f2;
}

/* Customize — tonal blue */
.cb-btn-customize {
  background: transparent;
  color: #478ac9;
  border-color: #478ac9;
}
.cb-btn-customize:hover {
  background: #eef5fb;
}

/* Save selection (inside panel) */
.cb-btn-save {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}
.cb-btn-save:hover {
  background: #333;
  border-color: #333;
}

/* ── Customize panel ────────────────────────────────────────────────────────── */

.cb-customize-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #ebebeb;
}

/* Collapsed state — no display:none so height can be measured */
.cb-customize-panel[hidden] {
  display: none;
}

.cb-category-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.cb-category {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fafafa;
}

.cb-category-info {
  flex: 1;
  min-width: 0;
}

.cb-category-name {
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 3px;
}

.cb-category-desc {
  font-size: 0.8rem;
  color: #777;
  line-height: 1.45;
}

/* ── Toggle switch ──────────────────────────────────────────────────────────── */

.cb-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}

.cb-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.cb-toggle-track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  transition: background 0.2s ease;
}

.cb-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease;
}

.cb-toggle input:checked ~ .cb-toggle-track {
  background: #478ac9;
}

.cb-toggle input:checked ~ .cb-toggle-thumb {
  transform: translateX(20px);
}

.cb-toggle input:disabled ~ .cb-toggle-track {
  background: #478ac9;
  opacity: 0.55;
}

.cb-toggle input:disabled ~ .cb-toggle-thumb {
  transform: translateX(20px);
}

.cb-toggle input:disabled {
  cursor: not-allowed;
}

.cb-toggle:has(input:disabled) {
  cursor: not-allowed;
}

.cb-toggle input:focus-visible ~ .cb-toggle-track {
  outline: 3px solid #478ac9;
  outline-offset: 2px;
}

/* ── Mobile — bottom sheet ──────────────────────────────────────────────────── */

@media (max-width: 768px) {
  #cookie-banner {
    border-radius: 16px 16px 0 0;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .cb-inner {
    padding: 22px 18px 28px;
  }

  .cb-main {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .cb-actions {
    flex-direction: column;
  }

  .cb-btn {
    width: 100%;
    text-align: center;
    padding: 13px 22px;
  }

  .cb-category-list {
    grid-template-columns: 1fr;
  }

  .cb-save-actions {
    flex-direction: column;
  }

  .cb-save-actions .cb-btn-save {
    width: 100%;
  }
}
