/**
 * Wigton – Cookie consent banner and preferences modal
 * Enhanced modal, responsive layout, accessibility.
 */

/* ----- Banner (fixed at bottom) ----- */
.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
  padding: 16px 20px;
  font-size: 15px;
  line-height: 1.5;
  transform: translateY(100%);
  transition: transform 0.35s ease-out;
}

.cookie-consent-banner.is-visible {
  transform: translateY(0);
}

.cookie-consent-banner__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
}

.cookie-consent-banner__text {
  flex: 1 1 260px;
  margin: 0;
  min-width: 0;
}

.cookie-consent-banner__text a {
  color: var(--wigton-red-light, #dc2626);
  text-decoration: underline;
}

.cookie-consent-banner__text a:hover {
  color: #fff;
}

.cookie-consent-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cookie-consent-banner__btn {
  display: inline-block;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.cookie-consent-banner__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.cookie-consent-banner__btn--accept {
  background: var(--wigton-red, #b91c1c);
  color: #fff;
}

.cookie-consent-banner__btn--accept:hover {
  background: var(--wigton-red-dark, #991b1b);
  color: #fff;
}

.cookie-consent-banner__btn--reject {
  background: transparent;
  color: #ccc;
  border: 1px solid #555;
}

.cookie-consent-banner__btn--reject:hover {
  background: #333;
  color: #fff;
}

.cookie-consent-banner__btn--customize {
  background: transparent;
  color: #fff;
  border: 1px solid #888;
}

.cookie-consent-banner__btn--customize:hover {
  background: #333;
  color: #fff;
}

/* ----- Overlay ----- */
.cookie-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.cookie-consent-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ----- Preferences modal ----- */
.cookie-consent-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10001;
  transform: translate(-50%, -50%) scale(0.96);
  width: calc(100% - 32px);
  max-width: 540px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  color: #1a1a1a;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.06);
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s, transform 0.25s ease-out;
}

.cookie-consent-modal.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal header with close */
.cookie-consent-modal__header {
  position: relative;
  padding: 24px 24px 8px;
  padding-right: 52px;
}

.cookie-consent-modal__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.25;
}

.cookie-consent-modal__close {
  position: absolute;
  top: 20px;
  right: 16px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.cookie-consent-modal__close:hover {
  background: #f0f0f0;
  color: #1a1a1a;
}

.cookie-consent-modal__close:focus-visible {
  outline: 2px solid var(--wigton-red, #b91c1c);
  outline-offset: 2px;
}

.cookie-consent-modal__close svg {
  width: 20px;
  height: 20px;
}

.cookie-consent-modal__intro {
  margin: 0 24px 20px;
  font-size: 14px;
  color: #555;
  line-height: 1.55;
}

.cookie-consent-modal__list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 24px 20px;
}

.cookie-consent-modal__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid #eee;
}

.cookie-consent-modal__item:first-child {
  padding-top: 0;
}

.cookie-consent-modal__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cookie-consent-modal__label {
  flex: 1;
  min-width: 0;
}

.cookie-consent-modal__label strong {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.cookie-consent-modal__toggle {
  flex-shrink: 0;
  width: 48px;
  height: 26px;
  border-radius: 13px;
  background: #ccc;
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.cookie-consent-modal__toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease-out;
}

.cookie-consent-modal__toggle.is-on {
  background: var(--wigton-red, #b91c1c);
}

.cookie-consent-modal__toggle.is-on::after {
  transform: translateX(22px);
}

.cookie-consent-modal__toggle:focus-visible {
  outline: 2px solid var(--wigton-red, #b91c1c);
  outline-offset: 2px;
}

.cookie-consent-modal__toggle[disabled] {
  cursor: not-allowed;
  opacity: 0.85;
}

.cookie-consent-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px 24px;
  background: #fafafa;
  border-radius: 0 0 14px 14px;
  border-top: 1px solid #eee;
}

.cookie-consent-modal__btn {
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s;
}

.cookie-consent-modal__btn:focus-visible {
  outline: 2px solid var(--wigton-red, #b91c1c);
  outline-offset: 2px;
}

.cookie-consent-modal__btn--secondary {
  background: #e5e5e5;
  color: #333;
}

.cookie-consent-modal__btn--secondary:hover {
  background: #d4d4d4;
}

.cookie-consent-modal__btn--primary {
  background: var(--wigton-red, #b91c1c);
  color: #fff;
}

.cookie-consent-modal__btn--primary:hover {
  background: var(--wigton-red-dark, #991b1b);
  color: #fff;
}

/* ----- Responsive ----- */
@media (max-width: 480px) {
  .cookie-consent-banner {
    padding: 14px 16px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .cookie-consent-banner__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .cookie-consent-banner__text {
    font-size: 14px;
  }

  .cookie-consent-banner__actions {
    flex-direction: column;
    width: 100%;
  }

  .cookie-consent-banner__btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
  }

  .cookie-consent-modal {
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    top: 50%;
    left: 50%;
    margin-top: 0;
    border-radius: 12px;
  }

  .cookie-consent-modal__header {
    padding: 20px 20px 6px;
    padding-right: 48px;
  }

  .cookie-consent-modal__title {
    font-size: 20px;
  }

  .cookie-consent-modal__close {
    top: 16px;
    right: 12px;
    width: 44px;
    height: 44px;
  }

  .cookie-consent-modal__intro {
    margin-left: 20px;
    margin-right: 20px;
    margin-bottom: 16px;
    font-size: 13px;
  }

  .cookie-consent-modal__list {
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 16px;
  }

  .cookie-consent-modal__item {
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 0;
  }

  .cookie-consent-modal__toggle {
    width: 52px;
    height: 28px;
    border-radius: 14px;
  }

  .cookie-consent-modal__toggle::after {
    width: 24px;
    height: 24px;
  }

  .cookie-consent-modal__toggle.is-on::after {
    transform: translateX(24px);
  }

  .cookie-consent-modal__actions {
    padding: 14px 20px 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    border-radius: 0 0 12px 12px;
  }

  .cookie-consent-modal__btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 18px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .cookie-consent-modal {
    width: calc(100% - 40px);
  }
}
