/* WordGPT — Cookie consent & terms acceptance popup (GDPR/CCPA/UK compliant) */
/* Uses Syne (headings) and DM Sans (body) for popup; vars.css provides #5B4EE8 etc. */

.consent-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 11, 30, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  opacity: 0;
  animation: consentOverlayIn 0.3s ease forwards;
}
.consent-overlay.consent-exit {
  animation: consentOverlayOut 0.3s ease forwards;
}

.consent-card {
  font-family: 'DM Sans', system-ui, sans-serif;
  max-width: 520px;
  width: calc(100% - 32px);
  margin: 16px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.92);
  animation: consentCardIn 0.35s ease-out 0.05s forwards;
}
.consent-overlay.consent-exit .consent-card {
  animation: consentCardOut 0.3s ease forwards;
}

@media (max-width: 560px) {
  .consent-card {
    margin: 16px;
    border-radius: 16px;
    width: calc(100% - 32px);
  }
}

/* Stage 1 — Cookie consent */
.consent-stage {
  display: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.consent-stage.active {
  display: block;
  opacity: 1;
}
.consent-stage.consent-stage-out {
  opacity: 0;
}
.consent-stage.consent-stage-in {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.consent-cookie-header {
  padding: 28px 28px 20px;
  text-align: center;
}
.consent-cookie-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: #EAE8FF;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.consent-cookie-header h2 {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #1a1730;
  margin: 0 0 10px;
}
.consent-cookie-header p {
  font-size: 14px;
  color: #6B6791;
  line-height: 1.7;
  margin: 0;
}

.consent-toggles {
  padding: 0 28px 20px;
}
.cookie-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #E4E2F5;
}
.cookie-toggle-row:last-of-type {
  border-bottom: none;
}
.cookie-toggle-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.cookie-toggle-icon.essential { background: #DCFCE7; }
.cookie-toggle-icon.analytics { background: #EAE8FF; }
.cookie-toggle-icon.marketing { background: #F1F0FA; }
.cookie-toggle-label {
  flex: 1;
  min-width: 0;
}
.cookie-toggle-label strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #3A3660;
  margin-bottom: 2px;
}
.cookie-toggle-label span {
  font-size: 12px;
  color: #9E9ABF;
}
.cookie-toggle-state {
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}
.cookie-toggle-state.always-on { color: #22C55E; }
.cookie-toggle-state.not-used { color: #9E9ABF; }

.toggle-switch {
  width: 44px;
  height: 24px;
  border-radius: 100px;
  background: #E4E2F5;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease;
}
.toggle-switch.on {
  background: #5B4EE8;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.toggle-switch.on::after {
  transform: translateX(20px);
}
.toggle-switch.disabled {
  cursor: default;
  pointer-events: none;
}

.consent-manage-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 28px;
}
.consent-manage-panel.open {
  max-height: 120px;
}
.consent-manage-panel p {
  font-size: 13px;
  color: #6B6791;
  line-height: 1.6;
  margin: 0 0 8px;
  padding-bottom: 12px;
}
.consent-manage-panel a {
  font-size: 13px;
  color: #5B4EE8;
  text-decoration: none;
}
.consent-manage-panel a:hover {
  text-decoration: underline;
}

.consent-buttons {
  display: flex;
  gap: 12px;
  padding: 0 28px 20px;
  flex-wrap: wrap;
}
.consent-btn-outline {
  flex: 1;
  min-width: 140px;
  padding: 12px 20px;
  background: #fff;
  border: 1.5px solid #E4E2F5;
  color: #3A3660;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  transition: background 0.15s, border-color 0.15s;
}
.consent-btn-outline:hover {
  background: #F8F7FF;
  border-color: #d4d1eb;
}
.consent-btn-primary {
  flex: 1;
  min-width: 160px;
  padding: 12px 24px;
  background: #5B4EE8;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  box-shadow: 0 4px 16px rgba(91, 78, 232, 0.35);
  transition: background 0.15s, transform 0.15s;
}
.consent-btn-primary:hover {
  background: #4a3dd4;
  transform: translateY(-1px);
}
.consent-legal {
  padding: 0 28px 24px;
  font-size: 11px;
  color: #9E9ABF;
  text-align: center;
  line-height: 1.6;
}

/* Stage 2 — Terms acceptance */
.consent-terms-banner {
  background: linear-gradient(135deg, #5B4EE8, #3D32C4);
  border-radius: 12px 12px 0 0;
  padding: 20px 28px;
}
.consent-terms-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.consent-terms-logo {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', system-ui, sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: #fff;
}
.consent-terms-banner h3 {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin: 0;
}
.consent-terms-banner p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}
.consent-terms-body {
  padding: 28px;
}
.consent-terms-body h4 {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #1A1730;
  margin: 0 0 8px;
}
.consent-terms-body .consent-terms-sub {
  font-size: 14px;
  color: #6B6791;
  margin-bottom: 20px;
  line-height: 1.5;
}
.terms-check-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid #E4E2F5;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 10px;
  align-items: flex-start;
  text-align: left;
}
.terms-check-card:hover {
  border-color: #d4d1eb;
}
.terms-check-card.checked {
  border-color: #5B4EE8;
  background: #F4F1FF;
}
.terms-check-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #5B4EE8;
  flex-shrink: 0;
  cursor: pointer;
}
.terms-check-card label {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #3A3660;
  margin: 0;
  flex: 1;
}
.terms-check-card label a {
  color: #5B4EE8;
  font-weight: 500;
  text-decoration: none;
}
.terms-check-card label a:hover {
  text-decoration: underline;
}
.terms-check-desc {
  font-size: 12px;
  color: #9E9ABF;
  margin-top: 4px;
  line-height: 1.4;
  display: block;
  font-weight: 400;
}
.terms-check-card-inner {
  flex: 1;
  min-width: 0;
}

.consent-age-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  margin-bottom: 8px;
}
.consent-age-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #5B4EE8;
  cursor: pointer;
  flex-shrink: 0;
}
.consent-age-row label {
  font-size: 13px;
  color: #3A3660;
  cursor: pointer;
  margin: 0;
}

.consent-get-started {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: #5B4EE8;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  margin-top: 20px;
  box-shadow: 0 4px 20px rgba(91, 78, 232, 0.35);
  transition: background 0.15s, box-shadow 0.15s;
}
.consent-get-started:hover:not(:disabled) {
  background: #4a3dd4;
}
.consent-get-started:disabled {
  background: #B8B5D4;
  cursor: not-allowed;
  box-shadow: none;
}
.consent-signin-link {
  display: block;
  text-align: center;
  font-size: 13px;
  color: #9E9ABF;
  margin-top: 16px;
}
.consent-signin-link a {
  color: #5B4EE8;
  text-decoration: none;
  font-weight: 500;
}
.consent-signin-link a:hover {
  text-decoration: underline;
}

/* Cookie settings floating link */
.consent-settings-trigger {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  background: rgba(13, 11, 30, 0.8);
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 100px;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  border: none;
  transition: background 0.2s, color 0.2s;
}
.consent-settings-trigger:hover {
  background: rgba(13, 11, 30, 0.95);
  color: #fff;
}
.consent-settings-trigger.hidden {
  display: none;
}

/* Toast */
.consent-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  background: #0D0B1E;
  color: #fff;
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 340px;
  transform: translateX(120%);
  animation: consentToastIn 0.4s ease forwards;
}
.consent-toast.consent-toast-out {
  animation: consentToastOut 0.3s ease forwards;
}
.consent-toast-icon {
  width: 28px;
  height: 28px;
  background: #DCFCE7;
  color: #22C55E;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  flex-shrink: 0;
}
.consent-toast-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.consent-toast-text span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}
.consent-toast-close {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.consent-toast-close:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Animations */
@keyframes consentOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes consentOverlayOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes consentCardIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes consentCardOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.98);
  }
}
@keyframes consentToastIn {
  from { transform: translateX(120%); }
  to { transform: translateX(0); }
}
@keyframes consentToastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(120%); }
}
