/**
 * Cookie Consent Banner Styles
 * AEPD 2024 Compliant & WCAG 2.1 AA Accessible
 */

/* Cookie Banner */
#cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 3px solid var(--primary);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  padding: 1.5rem;
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.cookie-banner-close {
  position: absolute;
  top: -0.5rem;
  right: 0;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  transition:
    color 0.3s ease,
    transform 0.2s ease;
  border-radius: 4px;
}

.cookie-banner-close:hover {
  color: var(--text-primary);
  transform: scale(1.1);
}

.cookie-banner-close:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cookie-banner-icon {
  display: inline-block;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.cookie-banner-icon .icon {
  width: 2.5rem;
  height: 2.5rem;
}

.cookie-banner-title {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.cookie-banner-description {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.cookie-banner-description a {
  color: var(--primary);
  text-decoration: underline;
  transition: color 0.3s ease;
}

.cookie-banner-description a:hover {
  color: var(--primary-dark);
}

.cookie-banner-description a:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cookie-banner-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.cookie-btn {
  flex: 1;
  min-width: 160px;
  padding: 0.875rem 1.5rem;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.cookie-btn .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.cookie-btn:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.cookie-btn-accept {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.cookie-btn-accept:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(98, 0, 255, 0.4);
}

.cookie-btn-reject {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.cookie-btn-reject:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.cookie-btn-configure {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--primary);
}

.cookie-btn-configure:hover {
  background: rgba(98, 0, 255, 0.1);
  transform: translateY(-2px);
}

/* Cookie Configure Panel */
#cookie-configure-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.cookie-config-content {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.cookie-config-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  transition:
    color 0.3s ease,
    transform 0.2s ease;
  border-radius: 4px;
}

.cookie-config-close:hover {
  color: var(--text-primary);
  transform: scale(1.1);
}

.cookie-config-close:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cookie-config-title {
  font-size: 1.75rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cookie-config-options {
  margin-bottom: 2rem;
}

.cookie-option {
  padding: 1.25rem;
  background: var(--bg-primary);
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.05);
  transition: border-color 0.3s ease;
}

.cookie-option:hover {
  border-color: rgba(98, 0, 255, 0.3);
}

.cookie-option-header {
  margin-bottom: 0.75rem;
}

.cookie-option-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 1.1rem;
}

.cookie-option-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

.cookie-option-label input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.cookie-option-label input[type="checkbox"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.cookie-option-title {
  color: var(--text-primary);
  font-weight: 600;
}

.cookie-option-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.cookie-option-description strong {
  color: #ff9800;
}

.cookie-config-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.cookie-config-buttons .cookie-btn {
  flex: 1;
  min-width: 140px;
}

/* Responsive Design */
@media (max-width: 768px) {
  #cookie-consent-banner {
    padding: 1rem;
  }

  .cookie-banner-title {
    font-size: 1.25rem;
  }

  .cookie-banner-description {
    font-size: 0.9rem;
  }

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

  .cookie-btn {
    width: 100%;
    min-width: 100%;
  }

  .cookie-config-content {
    padding: 1.5rem;
    max-height: 95vh;
  }

  .cookie-config-title {
    font-size: 1.5rem;
  }

  .cookie-option {
    padding: 1rem;
  }

  .cookie-option-label {
    font-size: 1rem;
  }

  .cookie-config-buttons {
    flex-direction: column;
  }

  .cookie-config-buttons .cookie-btn {
    width: 100%;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  #cookie-consent-banner {
    border-top-width: 4px;
  }

  .cookie-btn {
    border-width: 3px;
  }

  .cookie-btn:focus {
    outline-width: 4px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  #cookie-consent-banner,
  #cookie-configure-panel,
  .cookie-config-content {
    animation: none;
  }

  .cookie-btn,
  .cookie-banner-close,
  .cookie-config-close {
    transition: none;
  }

  .cookie-btn:hover {
    transform: none;
  }
}

/* Print Styles */
@media print {
  #cookie-consent-banner,
  #cookie-configure-panel {
    display: none;
  }
}
