/* ============================================================
   Cookie Consent — banner + Manage Cookies modal
   Markup: app/Views/partials/cookie-consent.php
   ============================================================ */

.cc-banner,
.cc-backdrop,
.cc-overlay {
  --cc-pink: #E20074;
  --cc-pink-hover: #C10063;
  --cc-heading: #2E2E2E;
  --cc-text: #64748B;
  --cc-border: #CBD5E1;
  --cc-divider: #E2E8F0;
  --cc-cookie: #8B4513;
  font-family: 'DM Sans', sans-serif;
  box-sizing: border-box;
}

.cc-banner *,
.cc-overlay * {
  box-sizing: border-box;
}

.cc-banner[hidden],
.cc-backdrop[hidden],
.cc-overlay[hidden],
.cc-item__gpc[hidden] {
  display: none !important;
}

/* ---------- Shared ---------- */
.cc-text {
  margin: 0;
  color: var(--cc-text);
  font-size: 15px;
  line-height: 1.6;
}

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

.cc-text a:hover {
  color: var(--cc-pink-hover);
}

.cc-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

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

.cc-btn--primary {
  background: var(--cc-pink);
  border: 1px solid var(--cc-pink);
  color: #fff;
}

.cc-btn--primary:hover {
  background: var(--cc-pink-hover);
  border-color: var(--cc-pink-hover);
}

.cc-btn--outline {
  background: #fff;
  border: 1px solid var(--cc-border);
  color: #1E1E1E;
}

.cc-btn--outline:hover {
  border-color: #94A3B8;
  background: #F8FAFC;
}

/* ---------- Backdrop (page dimmed + blurred until a choice is made) ---------- */
.cc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 15, 20, 0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: cc-fade-in .3s ease-out;
}

/* ---------- Banner (floating card with a gap from the screen edges) ---------- */
.cc-banner {
  position: fixed;
  z-index: 10000;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 16px 16px 18px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
  animation: cc-slide-up .35s ease-out;
}

.cc-banner__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.cc-banner__icon {
  flex-shrink: 0;
  color: var(--cc-cookie);
  margin-top: 2px;
}

.cc-banner__title {
  margin: 0;
  color: var(--cc-heading);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.25;
}

/* Phone: smaller type so the banner covers less of the screen */
@media (max-width: 639px) {
  .cc-banner__head {
    margin-bottom: 8px;
  }

  .cc-banner__icon {
    width: 24px;
    height: 24px;
  }

  .cc-banner__title {
    font-size: 18px;
  }

  .cc-banner .cc-text {
    font-size: 13px;
    line-height: 1.5;
  }

  .cc-banner .cc-actions {
    gap: 8px;
    margin-top: 12px;
  }

  .cc-banner .cc-btn {
    min-height: 40px;
    font-size: 15px;
  }
}

/* Tablet: buttons in one row */
@media (min-width: 640px) {
  .cc-banner {
    left: 20px;
    right: 20px;
    bottom: 20px;
    padding: 20px 32px;
  }

  .cc-banner__title {
    font-size: 24px;
  }

  .cc-banner .cc-text {
    font-size: 14px;
    line-height: 1.55;
  }

  .cc-banner .cc-actions {
    flex-direction: row;
    margin-top: 16px;
  }

  .cc-banner .cc-btn {
    flex: 1 1 0;
    min-height: 42px;
    padding: 8px 12px;
  }
}

/* Desktop: compact rows - title, text, buttons */
@media (min-width: 1200px) {
  .cc-banner {
    /* centred card with a gap above the bottom edge */
    left: 0;
    right: 0;
    bottom: 24px;
    width: min(1000px, calc(100vw - 64px));
    margin-inline: auto;
    padding: 14px 40px 16px;
    text-align: center;
  }

  .cc-banner__head {
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
  }

  .cc-banner__icon {
    width: 22px;
    height: 22px;
    margin-top: 0;
  }

  .cc-banner__title {
    font-size: 20px;
  }

  .cc-banner .cc-actions {
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
  }

  .cc-banner .cc-btn {
    flex: 0 0 auto;
    min-width: 180px;
    min-height: 38px;
    padding: 6px 24px;
    font-size: 16px;
  }
}

/* ---------- Modal ---------- */
.cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 15, 20, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: cc-fade-in .2s ease-out;
}

/* Only the body scrolls; the action bar stays visible at the bottom */
.cc-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1000px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

.cc-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 20px 20px;
}

.cc-modal:focus {
  outline: none;
}

.cc-modal__title {
  margin: 0 0 12px;
  color: var(--cc-heading);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
}

.cc-modal__intro {
  margin-bottom: 20px;
}

.cc-list {
  border: 1px solid var(--cc-divider);
  border-radius: 10px;
}

.cc-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
}

.cc-item + .cc-item {
  border-top: 1px solid var(--cc-divider);
}

.cc-item__body {
  flex: 1 1 auto;
  min-width: 0;
}

.cc-item__title {
  margin: 0 0 6px;
  color: var(--cc-heading);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.3;
}

.cc-item__desc {
  margin: 0;
  color: var(--cc-text);
  font-size: 13px;
  line-height: 1.55;
}

.cc-item__gpc {
  margin: 8px 0 0;
  color: var(--cc-pink);
  font-size: 13px;
}

.cc-item__required {
  flex-shrink: 0;
  width: 70px;
  color: #111;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* Toggle switch */
.cc-switch {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  justify-content: center;
  width: 70px;
  cursor: pointer;
}

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

.cc-switch__track {
  position: relative;
  display: block;
  width: 50px;
  height: 26px;
  border: 2.5px solid #94A3B8;
  border-radius: 999px;
  background: #fff;
  transition: background-color .2s ease, border-color .2s ease;
}

.cc-switch__track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #94A3B8;
  transform: translateY(-50%);
  transition: left .2s ease, background-color .2s ease;
}

.cc-switch input:checked + .cc-switch__track {
  background: var(--cc-pink);
  border-color: var(--cc-pink);
}

.cc-switch input:checked + .cc-switch__track::after {
  left: 27px;
  background: #fff;
}

.cc-switch input:focus-visible + .cc-switch__track {
  outline: 2px solid var(--cc-pink);
  outline-offset: 2px;
}

.cc-modal__actions {
  flex-shrink: 0;
  margin-top: 0;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--cc-divider);
  background: #fff;
  box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.06);
}

@media (min-width: 768px) {
  .cc-overlay {
    padding: 24px;
  }

  .cc-modal__body {
    padding: 32px 32px 24px;
  }

  .cc-modal__actions {
    padding: 16px 32px 20px;
  }

  .cc-modal__title {
    font-size: 30px;
  }

  .cc-item {
    gap: 24px;
    padding: 18px 24px;
  }

  .cc-item__title {
    font-size: 22px;
  }

  .cc-modal__actions {
    flex-direction: row;
    gap: 16px;
  }

  .cc-modal__actions .cc-btn {
    flex: 1 1 0;
  }

  .cc-modal__actions .cc-btn--primary {
    flex-grow: 1.25;
  }
}

/* ---------- Motion ---------- */
@keyframes cc-slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cc-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-banner,
  .cc-backdrop,
  .cc-overlay {
    animation: none;
  }
}
