/*
 * ============================================================
 *  COOKIE CONSENT COMPONENT  —  cookie-consent.css
 * ============================================================
 *  Fully self-contained.  Drop this file (and cookie-consent.js)
 *  into any project and link them.  No framework dependencies.
 *
 *  Customise the three CSS custom-properties below to match
 *  your site's brand without touching anything else.
 * ============================================================
 */

:root {
  /* ── Brand tokens (override these per project) ── */
  --cc-accent:      #ffffff;          /* primary button / toggle-on colour  */
  --cc-bg:          #111113;          /* banner / panel background           */
  --cc-surface:     #1f1f23;          /* card / inner element background     */
  --cc-text:        rgba(255,255,255,0.85);
  --cc-text-muted:  rgba(255,255,255,0.5);
  --cc-border:      rgba(255,255,255,0.1);
  --cc-radius:      14px;
  --cc-shadow:      0 24px 64px rgba(0,0,0,0.55);
  --cc-z:           99999;
}

/* ──────────────────────────────────────────────
   OVERLAY  (blocks interaction behind the banner)
────────────────────────────────────────────── */
#cc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: calc(var(--cc-z) - 1);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#cc-overlay.cc-visible {
  display: block;
  opacity: 1;
}

/* ──────────────────────────────────────────────
   MAIN BANNER  (bottom bar, always visible first)
────────────────────────────────────────────── */
#cc-banner {
  position: fixed;
  bottom: -100%;
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 720px);
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  z-index: var(--cc-z);
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  transition: bottom 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#cc-banner.cc-visible {
  bottom: 1.5rem;
}

/* cookie icon header */
.cc-banner-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cc-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cc-accent), transparent 85%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.15rem;
}

.cc-banner-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--cc-accent);
  margin: 0;
}

.cc-banner-body p {
  font-size: 0.875rem;
  color: var(--cc-text);
  line-height: 1.65;
  margin: 0;
}

.cc-banner-body a {
  color: var(--cc-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* action buttons row */
.cc-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.cc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}

.cc-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.cc-btn:active { transform: translateY(0); }

.cc-btn-accept {
  background: var(--cc-accent);
  color: #000;
}

.cc-btn-decline {
  background: transparent;
  color: var(--cc-text);
  border: 1px solid var(--cc-border);
}

.cc-btn-settings {
  background: transparent;
  color: var(--cc-text-muted);
  border: 1px solid transparent;
  padding-left: 0.25rem;
  font-size: 0.8rem;
}

.cc-btn-settings:hover { color: var(--cc-accent); opacity: 1; }

/* ──────────────────────────────────────────────
   SETTINGS PANEL  (slide-up modal)
────────────────────────────────────────────── */
#cc-settings {
  position: fixed;
  bottom: -100%;
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 560px);
  max-height: 82vh;
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow);
  z-index: calc(var(--cc-z) + 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: bottom 0.4s cubic-bezier(0.34, 1.15, 0.64, 1);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#cc-settings.cc-open {
  bottom: 1.5rem;
}

/* settings header */
.cc-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--cc-border);
  flex-shrink: 0;
}

.cc-settings-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cc-accent);
}

.cc-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cc-accent), transparent 90%);
  border: none;
  color: var(--cc-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.2s;
  flex-shrink: 0;
}

.cc-close-btn:hover {
  background: color-mix(in srgb, var(--cc-accent), transparent 75%);
}

/* scrollable body */
.cc-settings-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.cc-settings-body::-webkit-scrollbar { width: 5px; }
.cc-settings-body::-webkit-scrollbar-track { background: transparent; }
.cc-settings-body::-webkit-scrollbar-thumb { background: var(--cc-border); border-radius: 3px; }

.cc-settings-intro {
  font-size: 0.85rem;
  color: var(--cc-text-muted);
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

/* individual cookie category row */
.cc-category {
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: border-color 0.2s;
}

.cc-category:hover {
  border-color: color-mix(in srgb, var(--cc-accent), transparent 70%);
}

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

.cc-category-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cc-accent);
  margin: 0 0 0.2rem;
}

.cc-category-desc {
  font-size: 0.8rem;
  color: var(--cc-text-muted);
  line-height: 1.55;
  margin: 0;
}

/* Toggle switch */
.cc-toggle-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding-top: 2px;
}

.cc-toggle {
  position: relative;
  width: 44px;
  height: 24px;
}

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

.cc-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.25s;
  border: 1px solid var(--cc-border);
}

.cc-toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cc-text-muted);
  transition: left 0.25s, background 0.25s;
}

.cc-toggle input:checked + .cc-toggle-track {
  background: color-mix(in srgb, var(--cc-accent), transparent 15%);
  border-color: color-mix(in srgb, var(--cc-accent), transparent 50%);
}

.cc-toggle input:checked + .cc-toggle-track::after {
  left: calc(100% - 19px);
  background: var(--cc-accent);
}

.cc-toggle input:disabled + .cc-toggle-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.cc-toggle-label {
  font-size: 0.65rem;
  color: var(--cc-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Focus ring for accessibility */
.cc-toggle input:focus-visible + .cc-toggle-track {
  outline: 2px solid var(--cc-accent);
  outline-offset: 2px;
}

/* settings footer */
.cc-settings-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--cc-border);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.cc-btn-accept-all-settings {
  background: var(--cc-accent);
  color: #000;
  flex: 1;
  justify-content: center;
  min-width: 140px;
  font-weight: 700;
}

.cc-btn-save {
  background: transparent;
  color: var(--cc-text);
  border: 1px solid var(--cc-border);
  flex: 1;
  justify-content: center;
  min-width: 140px;
}

/* ──────────────────────────────────────────────
   RE-OPEN BUTTON  (shown after consent is given)
────────────────────────────────────────────── */
#cc-reopen {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: calc(var(--cc-z) - 2);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: var(--cc-text);
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

#cc-reopen.cc-show {
  display: flex;
}

#cc-reopen:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.55);
}

/* ──────────────────────────────────────────────
   TOAST  (brief confirmation message)
────────────────────────────────────────────── */
#cc-toast {
  position: fixed;
  bottom: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-radius: 50px;
  padding: 0.5rem 1.25rem;
  font-size: 0.82rem;
  color: var(--cc-text);
  z-index: calc(var(--cc-z) + 2);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

#cc-toast.cc-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ──────────────────────────────────────────────
   RESPONSIVE  tweaks
────────────────────────────────────────────── */
@media (max-width: 520px) {
  #cc-banner {
    padding: 1.25rem;
    bottom: -100%;
  }

  #cc-banner.cc-visible {
    bottom: 0.75rem;
  }

  #cc-settings.cc-open {
    bottom: 0.75rem;
  }

  .cc-banner-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cc-btn {
    justify-content: center;
  }

  .cc-btn-settings {
    text-align: center;
  }

  .cc-settings-footer {
    flex-direction: column;
  }
}
