/**
 * Cookie Consent RGPD - Estilos
 * Versión: 1.0.0
 * Responsive, Accesible (WCAG 2.1 AA)
 */

/* ============================================
   VARIABLES CSS
   ============================================ */
:root {
  --cc-primary-color: #E31E24;
  --cc-secondary-color: #333333;
  --cc-text-color: #FFFFFF;
  --cc-bg-color: rgba(0, 0, 0, 0.95);
  --cc-border-radius: 8px;
  --cc-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --cc-z-index: 999999;
  --cc-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   BANNER DE COOKIES
   ============================================ */
.cookie-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  z-index: var(--cc-z-index);
  font-family: var(--cc-font-family);
  opacity: 0;
  transform: translateY(100%);
  transition: var(--cc-transition);
}

.cookie-consent-banner-bottom {
  bottom: 0;
}

.cookie-consent-banner-top {
  top: 0;
  transform: translateY(-100%);
}

.cookie-consent-banner.cookie-consent-show {
  opacity: 1;
  transform: translateY(0);
}

/* Overlay */
.cookie-consent-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

/* Contenido del banner */
.cookie-consent-content {
  background: var(--cc-bg-color);
  color: var(--cc-text-color);
  padding: 1.5rem;
  max-width: 100%;
  margin: 0 auto;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
  .cookie-consent-content {
    padding: 2rem 3rem;
    max-width: 1200px;
    border-radius: var(--cc-border-radius) var(--cc-border-radius) 0 0;
  }
  
  .cookie-consent-banner-top .cookie-consent-content {
    border-radius: 0 0 var(--cc-border-radius) var(--cc-border-radius);
  }
}

/* Header */
.cookie-consent-header {
  margin-bottom: 1rem;
}

.cookie-consent-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--cc-text-color);
}

@media (min-width: 768px) {
  .cookie-consent-title {
    font-size: 1.5rem;
  }
}

/* Body */
.cookie-consent-body {
  margin-bottom: 1.5rem;
}

.cookie-consent-description {
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

@media (min-width: 768px) {
  .cookie-consent-description {
    font-size: 1rem;
  }
}

.cookie-consent-link {
  color: var(--cc-primary-color);
  text-decoration: underline;
  transition: opacity 0.2s;
}

.cookie-consent-link:hover {
  opacity: 0.8;
}

/* Footer (botones) */
.cookie-consent-footer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .cookie-consent-footer {
    flex-direction: row;
    justify-content: flex-end;
    gap: 1rem;
  }
}

/* Botones */
.cookie-consent-button {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--cc-border-radius);
  cursor: pointer;
  transition: var(--cc-transition);
  font-family: var(--cc-font-family);
  white-space: nowrap;
}

@media (min-width: 768px) {
  .cookie-consent-button {
    padding: 0.875rem 2rem;
    font-size: 1rem;
  }
}

.cookie-consent-button:focus {
  outline: 2px solid var(--cc-primary-color);
  outline-offset: 2px;
}

.cookie-consent-button-accept {
  background: var(--cc-primary-color);
  color: #FFFFFF;
}

.cookie-consent-button-accept:hover {
  background: color-mix(in srgb, var(--cc-primary-color) 85%, black);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(227, 30, 36, 0.3);
}

.cookie-consent-button-reject {
  background: var(--cc-secondary-color);
  color: #FFFFFF;
}

.cookie-consent-button-reject:hover {
  background: color-mix(in srgb, var(--cc-secondary-color) 85%, black);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.cookie-consent-button-configure {
  background: transparent;
  color: var(--cc-text-color);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.cookie-consent-button-configure:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   MODAL DE CONFIGURACIÓN
   ============================================ */
.cookie-consent-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--cc-z-index) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: var(--cc-font-family);
  opacity: 0;
  transition: var(--cc-transition);
}

.cookie-consent-modal.cookie-consent-show {
  opacity: 1;
}

.cookie-consent-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  cursor: pointer;
}

.cookie-consent-modal-content {
  position: relative;
  background: var(--cc-bg-color);
  color: var(--cc-text-color);
  border-radius: var(--cc-border-radius);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: var(--cc-transition);
}

.cookie-consent-modal.cookie-consent-show .cookie-consent-modal-content {
  transform: scale(1);
}

/* Modal Header */
.cookie-consent-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cookie-consent-modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--cc-text-color);
}

.cookie-consent-modal-close {
  background: transparent;
  border: none;
  color: var(--cc-text-color);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.cookie-consent-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Modal Body */
.cookie-consent-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.cookie-consent-modal-description {
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
  color: rgba(255, 255, 255, 0.9);
}

/* Categorías */
.cookie-consent-categories {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cookie-consent-category {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--cc-border-radius);
  padding: 1rem;
  transition: background 0.2s;
}

.cookie-consent-category:hover {
  background: rgba(255, 255, 255, 0.08);
}

.cookie-consent-category-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.cookie-consent-category-info {
  flex: 1;
}

.cookie-consent-category-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--cc-text-color);
}

.cookie-consent-category-description {
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
}

/* Switch Toggle */
.cookie-consent-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  flex-shrink: 0;
}

.cookie-consent-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-consent-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.2);
  transition: 0.3s;
  border-radius: 26px;
}

.cookie-consent-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.cookie-consent-switch input:checked + .cookie-consent-slider {
  background-color: var(--cc-primary-color);
}

.cookie-consent-switch input:checked + .cookie-consent-slider:before {
  transform: translateX(24px);
}

.cookie-consent-switch input:disabled + .cookie-consent-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

.cookie-consent-switch input:focus + .cookie-consent-slider {
  box-shadow: 0 0 0 2px rgba(227, 30, 36, 0.3);
}

/* Modal Footer */
.cookie-consent-modal-footer {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  justify-content: flex-end;
}

.cookie-consent-button-primary {
  background: var(--cc-primary-color);
  color: #FFFFFF;
}

.cookie-consent-button-primary:hover {
  background: color-mix(in srgb, var(--cc-primary-color) 85%, black);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(227, 30, 36, 0.3);
}

.cookie-consent-button-secondary {
  background: var(--cc-secondary-color);
  color: #FFFFFF;
}

.cookie-consent-button-secondary:hover {
  background: color-mix(in srgb, var(--cc-secondary-color) 85%, black);
}

/* ============================================
   BADGE FLOTANTE
   ============================================ */
.cookie-consent-badge {
  position: fixed;
  z-index: var(--cc-z-index);
  background: var(--cc-primary-color);
  color: #FFFFFF;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: var(--cc-transition);
  font-family: var(--cc-font-family);
}

.cookie-consent-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.cookie-consent-badge-bottom-left {
  bottom: 1rem;
  left: 1rem;
}

.cookie-consent-badge-bottom-right {
  bottom: 1rem;
  right: 1rem;
}

.cookie-consent-badge-top-left {
  top: 1rem;
  left: 1rem;
}

.cookie-consent-badge-top-right {
  top: 1rem;
  right: 1rem;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 767px) {
  .cookie-consent-modal-content {
    max-height: 100vh;
    border-radius: 0;
  }
  
  .cookie-consent-modal-footer {
    flex-direction: column;
  }
  
  .cookie-consent-button {
    width: 100%;
  }
  
  .cookie-consent-badge {
    font-size: 0;
    padding: 0.875rem;
    border-radius: 50%;
  }
  
  .cookie-consent-badge span {
    display: none;
  }
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .cookie-consent-banner,
  .cookie-consent-modal,
  .cookie-consent-button,
  .cookie-consent-badge,
  .cookie-consent-slider {
    transition: none;
  }
}

/* Focus visible para navegación por teclado */
.cookie-consent-button:focus-visible,
.cookie-consent-modal-close:focus-visible,
.cookie-consent-badge:focus-visible {
  outline: 2px solid var(--cc-primary-color);
  outline-offset: 2px;
}

/* ============================================
   DARK MODE (opcional)
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --cc-bg-color: rgba(20, 20, 20, 0.98);
  }
}
