/**
 * UX4X Consent Management Styles
 * Clean, simple, and elegant design following best practices
 * Version: 3.0.0 - Complete redesign
 */

/* =============================================================================
   CONSENT BANNER VISIBILITY ANIMATIONS
   ============================================================================= */

.consent-banner-visible {
  transform: translateY(0) !important;
  opacity: 1 !important;
}

/* =============================================================================
   CONSENT PREFERENCES MODAL
   ============================================================================= */

.consent-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  background: rgba(0, 0, 0, 0.4);
}

.consent-modal-visible {
  opacity: 1;
  visibility: visible;
}

.consent-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: pointer;
}

.consent-modal-content {
  position: relative;
  z-index: 1;
  background: white;
  border-radius: 12px;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 562px;
  width: calc(100vw - 60px);
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

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

/* =============================================================================
   MODAL HEADER
   ============================================================================= */

.consent-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.consent-modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
}

.consent-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.consent-modal-close:hover {
  background: #f1f5f9;
  color: #334155;
}

/* =============================================================================
   MODAL BODY
   ============================================================================= */

.consent-modal-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.consent-modal-description {
  font-size: 0.875rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 1.5rem 0;
}

/* =============================================================================
   PREFERENCES LIST - CLEAN & SIMPLE
   ============================================================================= */

.consent-preferences-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.consent-preference-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  transition: border-color 0.15s ease;
}

.consent-preference-item:hover {
  border-color: #cbd5e1;
}

.consent-preference-required {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.consent-preference-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.consent-preference-info {
  flex: 1;
  min-width: 0;
}

.consent-preference-info h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 0.25rem 0;
}

.consent-preference-info p {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.consent-preference-examples {
  font-size: 0.6875rem;
  color: #94a3b8;
  line-height: 1.3;
}

.consent-preference-examples strong {
  color: #64748b;
  font-weight: 500;
}

/* =============================================================================
   SIMPLE & ELEGANT TOGGLE SWITCHES
   ============================================================================= */

.consent-preference-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

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

/* Toggle Track - using the span.consent-toggle-slider */
.consent-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #e2e8f0;
  border-radius: 12px;
  transition: background-color 0.2s ease;
}

/* Toggle Thumb */
.consent-toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Checked State - Blue */
.consent-preference-toggle input:checked + .consent-toggle-slider {
  background: #3b82f6;
}

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

/* Disabled State - Green for Required */
.consent-preference-toggle input:disabled + .consent-toggle-slider {
  background: #10b981 !important;
}

.consent-preference-toggle input:disabled + .consent-toggle-slider::before {
  transform: translateX(20px);
}

.consent-preference-toggle input:disabled {
  cursor: not-allowed;
}

/* Hover States */
.consent-preference-toggle:hover input:not(:disabled) + .consent-toggle-slider {
  background: #cbd5e1;
}

.consent-preference-toggle:hover input:checked:not(:disabled) + .consent-toggle-slider {
  background: #2563eb;
}

/* Focus States */
.consent-preference-toggle input:focus + .consent-toggle-slider {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =============================================================================
   MODAL ACTIONS - SIMPLE BUTTONS
   ============================================================================= */

.consent-modal-actions {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.5rem;
  border-top: 1px solid #f1f5f9;
  justify-content: flex-end;
}

.consent-btn {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 80px;
}

.consent-btn-primary {
  background: #2b72e6;
  color: white;
  border-color: #2b72e6;
}

.consent-btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.consent-btn-secondary {
  background: white;
  color: #64748b;
  border-color: #e2e8f0;
}

.consent-btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

/* =============================================================================
   DARK MODE SUPPORT
   ============================================================================= */

.dark .consent-modal-content {
  background: #1e293b;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.dark .consent-modal-header {
  border-bottom-color: #334155;
}

.dark .consent-modal-header h2 {
  color: #f8fafc;
}

.dark .consent-modal-close {
  color: #94a3b8;
}

.dark .consent-modal-close:hover {
  background: #334155;
  color: #f1f5f9;
}

.dark .consent-modal-description {
  color: #94a3b8;
}

.dark .consent-preference-item {
  border-color: #334155;
}

.dark .consent-preference-item:hover {
  border-color: #475569;
}

.dark .consent-preference-required {
  background: #064e3b;
  border-color: #065f46;
}

.dark .consent-preference-info h3 {
  color: #f8fafc;
}

.dark .consent-preference-info p {
  color: #94a3b8;
}

.dark .consent-preference-examples {
  color: #64748b;
}

.dark .consent-preference-toggle::before {
  background: #475569;
}

.dark .consent-preference-toggle input:checked::before {
  background: #3b82f6;
}

.dark .consent-modal-actions {
  border-top-color: #334155;
}

.dark .consent-btn-secondary {
  background: #334155;
  color: #cbd5e1;
  border-color: #475569;
}

.dark .consent-btn-secondary:hover {
  background: #475569;
  color: #f1f5f9;
  border-color: #64748b;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 640px) {
  .consent-modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }

  .consent-modal-header {
    padding: 1rem 1rem 0.75rem;
  }

  .consent-modal-body {
    padding: 0 1rem 0.75rem;
  }

  .consent-modal-actions {
    flex-direction: column;
    padding: 0.75rem 1rem 1rem;
  }

  .consent-preference-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .consent-preference-toggle {
    align-self: flex-start;
  }
}

/* =============================================================================
   ACCESSIBILITY
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
  .consent-modal,
  .consent-modal-content,
  .consent-preference-toggle::before,
  .consent-preference-toggle::after {
    transition: none;
  }
}

@media print {
  .consent-modal {
    display: none !important;
  }
}
