/* ─────────────────────────────────────
   Cookie Consent CH — Stylesheet
   Design: Swiss Minimalism
───────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --ccch-accent:   #111111;
  --ccch-bg:       #ffffff;
  --ccch-surface:  #f7f7f5;
  --ccch-border:   #e0e0e0;
  --ccch-text:     #1a1a1a;
  --ccch-muted:    #6b6b6b;
  --ccch-radius:   6px;
  --ccch-font:     'DM Sans', system-ui, -apple-system, sans-serif;
  --ccch-shadow:   0 -2px 24px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  --ccch-shadow-panel: 4px 0 32px rgba(0,0,0,0.12);
  --ccch-transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ─────────────────────────── */
#ccch-banner *,
#ccch-panel * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--ccch-font);
}

/* ─── Overlay ────────────────────────── */
.ccch-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 99997;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--ccch-transition);
}
.ccch-overlay.ccch-visible {
  display: block;
  opacity: 1;
}

/* ─── Banner: Bottom Bar ─────────────── */
.ccch-banner {
  display: none;
  position: fixed;
  z-index: 99998;
  background: var(--ccch-bg);
  font-family: var(--ccch-font);
  transition: transform var(--ccch-transition), opacity var(--ccch-transition);
}

.ccch-banner.ccch-visible {
  display: block;
}

/* Bottom bar */
.ccch-bar {
  bottom: 0;
  left: 0;
  right: 0;
  box-shadow: var(--ccch-shadow);
  border-top: 1px solid var(--ccch-border);
  padding: 0;
  transform: translateY(100%);
  opacity: 0;
}
.ccch-bar.ccch-visible {
  transform: translateY(0);
  opacity: 1;
}

/* Modal */
.ccch-modal {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -44%) scale(0.96);
  width: min(520px, calc(100vw - 32px));
  border-radius: 10px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  opacity: 0;
}
.ccch-modal.ccch-visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* ─── Banner Inner ───────────────────── */
.ccch-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px 32px;
  align-items: center;
}

.ccch-modal .ccch-inner {
  grid-template-columns: 1fr;
  padding: 28px 32px;
}

.ccch-content {}

.ccch-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--ccch-surface);
  border: 1px solid var(--ccch-border);
  border-radius: 100px;
  padding: 3px 10px 3px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ccch-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.ccch-badge span { font-size: 13px; }

.ccch-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ccch-text);
  line-height: 1.4;
  margin-bottom: 6px;
}

.ccch-desc {
  font-size: 13px;
  color: var(--ccch-muted);
  line-height: 1.6;
}

.ccch-desc a {
  color: var(--ccch-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Action Buttons ─────────────────── */
.ccch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.ccch-modal .ccch-actions {
  margin-top: 20px;
  justify-content: flex-end;
}

.ccch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--ccch-radius);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--ccch-font);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.ccch-btn:focus-visible {
  outline: 2px solid var(--ccch-accent);
  outline-offset: 2px;
}

/* Accept All */
.ccch-btn-accept {
  background: var(--ccch-accent);
  color: #fff;
}
.ccch-btn-accept:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* Reject */
.ccch-btn-reject {
  background: transparent;
  color: var(--ccch-text);
  border: 1px solid var(--ccch-border);
}
.ccch-btn-reject:hover {
  background: var(--ccch-surface);
  border-color: #c0c0c0;
}

/* Customize */
.ccch-btn-manage {
  background: transparent;
  color: var(--ccch-muted);
  padding: 9px 12px;
  font-size: 12px;
}
.ccch-btn-manage:hover {
  color: var(--ccch-text);
  background: var(--ccch-surface);
  border-radius: var(--ccch-radius);
}

/* ─── Panel (slide-in) ───────────────── */
.ccch-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--ccch-bg);
  z-index: 99999;
  overflow-y: auto;
  box-shadow: var(--ccch-shadow-panel);
  transform: translateX(100%);
  transition: transform var(--ccch-transition);
  font-family: var(--ccch-font);
}
.ccch-panel.ccch-visible {
  display: block;
  transform: translateX(0);
}

.ccch-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--ccch-border);
  position: sticky;
  top: 0;
  background: var(--ccch-bg);
  z-index: 1;
}

.ccch-panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ccch-text);
}

.ccch-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ccch-surface);
  border: none;
  cursor: pointer;
  color: var(--ccch-muted);
  font-size: 18px;
  line-height: 1;
  transition: all 0.15s;
}
.ccch-close-btn:hover {
  background: var(--ccch-border);
  color: var(--ccch-text);
}

.ccch-panel-body {
  padding: 16px 24px 24px;
}

.ccch-panel-intro {
  font-size: 13px;
  color: var(--ccch-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ─── Category Item ──────────────────── */
.ccch-category {
  border: 1px solid var(--ccch-border);
  border-radius: var(--ccch-radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.ccch-category:focus-within {
  border-color: var(--ccch-accent);
}

.ccch-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--ccch-surface);
  cursor: pointer;
  gap: 12px;
}

.ccch-category-info {
  flex: 1;
}

.ccch-category-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ccch-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ccch-tag-required {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ccch-muted);
  background: var(--ccch-border);
  padding: 2px 7px;
  border-radius: 100px;
}

.ccch-category-desc {
  font-size: 12px;
  color: var(--ccch-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* Toggle Switch */
.ccch-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.ccch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.ccch-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--ccch-border);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.2s;
}
.ccch-toggle input:checked ~ .ccch-toggle-track {
  background: var(--ccch-accent);
}
.ccch-toggle input:disabled ~ .ccch-toggle-track {
  opacity: 0.5;
  cursor: not-allowed;
}
.ccch-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.ccch-toggle input:checked ~ .ccch-toggle-track::after {
  transform: translateX(18px);
}

/* Category detail (expandable) */
.ccch-category-detail {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--ccch-muted);
  line-height: 1.6;
  border-top: 1px solid var(--ccch-border);
  background: var(--ccch-bg);
}

.ccch-cookie-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 11px;
}
.ccch-cookie-table th {
  text-align: left;
  padding: 5px 8px;
  background: var(--ccch-surface);
  color: var(--ccch-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--ccch-border);
}
.ccch-cookie-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--ccch-border);
  color: var(--ccch-text);
  vertical-align: top;
}
.ccch-cookie-table tr:last-child td {
  border-bottom: none;
}

/* ─── Panel Footer ───────────────────── */
.ccch-panel-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--ccch-border);
  display: flex;
  gap: 8px;
  background: var(--ccch-bg);
  position: sticky;
  bottom: 0;
}

.ccch-panel-footer .ccch-btn {
  flex: 1;
  justify-content: center;
}

/* ─── Legal line ─────────────────────── */
.ccch-legal {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--ccch-border);
  font-size: 11px;
  color: var(--ccch-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}
.ccch-legal a {
  color: var(--ccch-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Snackbar ───────────────────────── */
.ccch-snackbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ccch-accent);
  color: #fff;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-family: var(--ccch-font);
  font-weight: 500;
  z-index: 100000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  pointer-events: none;
}
.ccch-snackbar.ccch-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Re-open button ─────────────────── */
#ccch-reopen {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 99996;
  background: var(--ccch-bg);
  border: 1px solid var(--ccch-border);
  border-radius: 100px;
  padding: 7px 14px 7px 10px;
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: var(--ccch-font);
  color: var(--ccch-muted);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.15s;
}
#ccch-reopen.ccch-visible {
  display: flex;
}
#ccch-reopen:hover {
  color: var(--ccch-text);
  border-color: #bbb;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* ─── Responsive ─────────────────────── */
@media (max-width: 680px) {
  .ccch-inner {
    grid-template-columns: 1fr;
    padding: 18px 20px;
    gap: 16px;
  }
  .ccch-actions {
    width: 100%;
  }
  .ccch-btn-accept,
  .ccch-btn-reject {
    flex: 1;
    justify-content: center;
  }
  .ccch-panel {
    width: 100vw;
  }
  .ccch-modal {
    width: calc(100vw - 24px);
  }
  .ccch-legal {
    flex-direction: column;
  }
}
