/* ================================================================
   Athle2 Cookie Consent — cookie-consent.css
   Matches dark theme: bg #0D1117 · teal accent #00C9A7
   ================================================================ */

/* ── Banner ──────────────────────────────────────────────────────── */
#cc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  background: #0D1117;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.55);
  padding: 16px 24px;
  transform: translateY(110%);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

#cc-banner.cc-banner--visible {
  transform: translateY(0);
}

.cc-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.cc-banner__text {
  color: #94A3B8;
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.cc-banner__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Shared Button Base ──────────────────────────────────────────── */
.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  padding: 0.5rem 1.125rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
  outline: none;
  text-decoration: none;
}

.cc-btn:focus-visible {
  outline: 2px solid #00C9A7;
  outline-offset: 2px;
}

.cc-btn--primary {
  background: #00C9A7;
  color: #0D1117;
}

.cc-btn--primary:hover {
  background: #00b597;
  box-shadow: 0 4px 16px rgba(0, 201, 167, 0.35);
}

.cc-btn--ghost {
  background: transparent;
  color: #94A3B8;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.cc-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.22);
}

/* Privacy policy link inside banner text */
.cc-link {
  color: #00C9A7;
  text-decoration: underline;
  text-decoration-color: rgba(0, 201, 167, 0.4);
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.cc-link:hover {
  color: #00b597;
}

/* ── Modal Overlay ───────────────────────────────────────────────── */
#cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

/* ── Modal ───────────────────────────────────────────────────────── */
#cc-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  z-index: 10000;
  background: #0D1117;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 1rem;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 201, 167, 0.06);
  width: min(480px, calc(100vw - 32px));
  max-height: min(90vh, 640px);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
  /* Custom scrollbar inside modal */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

#cc-modal::-webkit-scrollbar {
  width: 4px;
}

#cc-modal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

#cc-modal.cc-modal--visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal: Header */
.cc-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
  position: sticky;
  top: 0;
  background: #0D1117;
  z-index: 1;
}

.cc-modal__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
}

.cc-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748B;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
  outline: none;
  flex-shrink: 0;
}

.cc-modal__close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.cc-modal__close:focus-visible {
  outline: 2px solid #00C9A7;
  outline-offset: 2px;
}

/* Modal: Body */
.cc-modal__body {
  padding: 16px 24px 0;
}

.cc-modal__desc {
  font-size: 0.8125rem;
  color: #94A3B8;
  margin: 0 0 4px;
  line-height: 1.6;
}

/* ── Category Rows ───────────────────────────────────────────────── */
.cc-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cc-category__info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.cc-category__name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  display: block;
}

.cc-category__desc {
  font-size: 0.75rem;
  color: #64748B;
  line-height: 1.45;
  display: block;
}

/* ── Toggle ──────────────────────────────────────────────────────── */
.cc-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  min-width: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
  padding: 0;
  outline: none;
}

.cc-toggle:focus-visible {
  outline: 2px solid #00C9A7;
  outline-offset: 2px;
}

/* ON state — set via both class and aria-checked for reliability */
.cc-toggle--on,
.cc-toggle[aria-checked="true"] {
  background: #00C9A7;
}

/* Locked (strictly necessary) — always on, not interactive */
.cc-toggle--locked {
  background: #00C9A7;
  opacity: 0.55;
  cursor: not-allowed;
}

/* Knob */
.cc-toggle__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease;
  pointer-events: none;
  display: block;
}

.cc-toggle--on .cc-toggle__knob,
.cc-toggle[aria-checked="true"] .cc-toggle__knob {
  transform: translateX(20px);
}

/* ── Modal Footer ────────────────────────────────────────────────── */
.cc-modal__footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  padding: 20px 24px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 16px;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  #cc-banner {
    padding: 16px;
  }

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

  .cc-banner__text {
    min-width: unset;
  }

  .cc-banner__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* "Accept All" spans full width on mobile (first in DOM, last visually via order) */
  .cc-banner__actions .cc-btn--primary {
    grid-column: 1 / -1;
    order: -1;
  }

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

  .cc-modal__footer .cc-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Reduced Motion ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #cc-banner,
  #cc-overlay,
  #cc-modal,
  .cc-toggle,
  .cc-toggle__knob,
  .cc-btn,
  .cc-modal__close {
    transition: none;
  }
}
