/* Cookie consent banner & preferences */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  padding: 16px;
  transform: translateY(110%);
  transition: transform 0.4s ease;
  pointer-events: none;
}

.cookie-banner.is-visible {
  transform: translateY(0);
  pointer-events: auto;
}

.cookie-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
  padding: 20px 24px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.cookie-banner-text {
  flex: 1 1 280px;
  min-width: 0;
}

.cookie-banner-text strong {
  display: block;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.cookie-banner-text p {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.cookie-banner-actions .btn {
  white-space: nowrap;
}

.btn-cookie-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-cookie-ghost:hover {
  background: var(--grey-5);
  color: var(--text-primary);
}

/* Preferences modal */
.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(12, 20, 28, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cookie-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.cookie-modal-panel {
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 640px);
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 28px 24px;
}

.cookie-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.cookie-modal-header h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0;
}

.cookie-modal-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--grey-5);
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition);
}

.cookie-modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.cookie-modal-intro {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.cookie-pref-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.cookie-pref-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--grey-5);
}

.cookie-pref-info h3 {
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin: 0 0 4px;
}

.cookie-pref-info p {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.cookie-pref-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-700);
  white-space: nowrap;
  padding-top: 2px;
}

/* Toggle switch */
.cookie-toggle {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
}

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

.cookie-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background var(--transition);
}

.cookie-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background: var(--primary-700);
}

.cookie-toggle input:checked + .cookie-toggle-slider::before {
  transform: translateX(20px);
}

.cookie-toggle input:disabled + .cookie-toggle-slider {
  opacity: 0.65;
  cursor: not-allowed;
}

.cookie-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.footer-cookie-link {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-cookie-link:hover {
  color: var(--primary-700);
}

.footer-bottom .footer-cookie-wrap {
  margin-top: 8px;
}

@media (max-width: 600px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-banner-actions {
    flex-direction: column;
  }

  .cookie-banner-actions .btn,
  .cookie-banner-actions .btn-cookie-ghost {
    width: 100%;
    text-align: center;
  }

  .cookie-pref-item {
    flex-direction: column;
    gap: 12px;
  }

  .cookie-modal-actions {
    flex-direction: column;
  }

  .cookie-modal-actions .btn,
  .cookie-modal-actions .btn-cookie-ghost {
    width: 100%;
  }
}
