/* Cookie consent & privacy modals */

.consent-modal-open {
  overflow: hidden;
}

/* Banner inferior */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: var(--space-sm);
  animation: consent-slide-up 0.4s ease-out;
}

@keyframes consent-slide-up {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.cookie-banner__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.cookie-banner__title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.cookie-banner__text {
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: var(--space-md);
  max-width: 900px;
}

.cookie-banner__text a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cookie-banner__text a:hover {
  color: var(--color-primary-hover);
}

.cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.cookie-banner__actions .btn {
  flex: 1 1 auto;
  min-width: 140px;
}

@media (min-width: 768px) {
  .cookie-banner__inner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-md);
    align-items: center;
  }
  .cookie-banner__text { margin-bottom: 0; }
  .cookie-banner__actions {
    flex-direction: column;
    min-width: 200px;
  }
}

/* Modales */
.consent-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}

.consent-modal[hidden] {
  display: none;
}

.consent-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.consent-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: min(90vh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  animation: consent-fade-in 0.25s ease-out;
}

.consent-modal__dialog--wide {
  max-width: 680px;
}

@keyframes consent-fade-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.consent-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}

.consent-modal__title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.consent-modal__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: all var(--transition);
}

.consent-modal__close:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.consent-modal__body {
  padding: var(--space-md) var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.consent-modal__footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.consent-modal__footer .btn {
  flex: 1 1 auto;
}

/* Categorías de cookies */
.consent-category {
  padding: var(--space-md);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}

.consent-category:last-child {
  margin-bottom: 0;
}

.consent-category__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.consent-category__label {
  font-weight: 600;
  font-size: 0.9375rem;
}

.consent-category__desc {
  font-size: 0.8125rem;
  color: var(--color-muted);
  line-height: 1.5;
  margin: 0;
}

/* Toggle switch */
.consent-toggle {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

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

.consent-toggle__track {
  width: 44px;
  height: 24px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.consent-toggle__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--color-text);
  border-radius: 50%;
  transition: transform var(--transition);
}

.consent-toggle input:checked + .consent-toggle__track {
  background: var(--color-primary);
}

.consent-toggle input:checked + .consent-toggle__track::after {
  transform: translateX(20px);
}

.consent-toggle input:disabled + .consent-toggle__track {
  opacity: 0.5;
  cursor: not-allowed;
}

.consent-toggle input:focus-visible + .consent-toggle__track {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Privacy modal content */
.privacy-modal__summary {
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.7;
}

.privacy-modal__summary h3 {
  font-size: 1rem;
  color: var(--color-text);
  margin: var(--space-md) 0 var(--space-xs);
}

.privacy-modal__summary h3:first-child {
  margin-top: 0;
}

.privacy-modal__summary ul {
  padding-left: 1.25rem;
  margin: var(--space-xs) 0;
}

.privacy-modal__summary li {
  margin-bottom: 0.25rem;
}

.privacy-modal__disclaimer {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}

/* Footer legal links */
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  justify-content: center;
  margin-top: var(--space-xs);
}

.footer-legal a,
.footer-legal button {
  font-size: 0.8125rem;
  color: var(--color-muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

.footer-legal a:hover,
.footer-legal button:hover {
  color: var(--color-primary);
}

.footer-legal button {
  text-decoration: underline;
  text-underline-offset: 2px;
}
