/**
 * Custom Cookie Consent Styles for Quaerens AI Labs
 * Matches the dark theme of the website with indigo accents
 */

/* Override library defaults with site theme colors */
:root {
  --cc-bg: #0a0a16;
  --cc-text: #ffffff;
  --cc-btn-primary-bg: #4f46e5;
  --cc-btn-primary-hover-bg: #4338ca;
  --cc-btn-secondary-bg: transparent;
  --cc-btn-secondary-hover-bg: rgba(255, 255, 255, 0.05);
  --cc-toggle-bg-off: #374151;
  --cc-toggle-bg-on: #4f46e5;
  --cc-toggle-bg-readonly: #1f2937;
  --cc-cookie-category-block-bg: rgba(255, 255, 255, 0.02);
  --cc-cookie-category-block-bg-hover: rgba(255, 255, 255, 0.05);
  --cc-separator-border-color: rgba(255, 255, 255, 0.1);
  --cc-overlay-bg: rgba(0, 0, 0, 0.75);
}

/* Consent Modal (initial popup) */
#cc-main .cm {
  background: var(--cc-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  max-width: 500px;
  padding: 2rem;
}

#cc-main .cm__title {
  color: var(--cc-text) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

#cc-main .cm__desc {
  color: rgba(255, 255, 255, 0.8) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Buttons */
#cc-main .cm__btn,
#cc-main .pm__btn {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 500;
  border-radius: 8px;
  padding: 12px 24px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

#cc-main .cm__btn.cm__btn--primary,
#cc-main .pm__btn.pm__btn--primary {
  background: var(--cc-btn-primary-bg) !important;
  color: white !important;
}

#cc-main .cm__btn.cm__btn--primary:hover,
#cc-main .pm__btn.pm__btn--primary:hover {
  background: var(--cc-btn-primary-hover-bg) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

#cc-main .cm__btn.cm__btn--secondary,
#cc-main .pm__btn.pm__btn--secondary {
  background: var(--cc-btn-secondary-bg) !important;
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

#cc-main .cm__btn.cm__btn--secondary:hover,
#cc-main .pm__btn.pm__btn--secondary:hover {
  background: var(--cc-btn-secondary-hover-bg) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Button container */
#cc-main .cm__btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Settings Modal (preferences panel) */
#cc-main .pm {
  background: var(--cc-bg) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  max-width: 700px;
}

#cc-main .pm__header {
  border-bottom: 1px solid var(--cc-separator-border-color);
  padding: 1.5rem 2rem;
}

#cc-main .pm__title {
  color: var(--cc-text) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.75rem;
  font-weight: 600;
}

#cc-main .pm__body {
  padding: 2rem;
  max-height: 60vh;
  overflow-y: auto;
}

#cc-main .pm__section {
  background: var(--cc-cookie-category-block-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 1.25rem;
  transition: background 0.2s ease;
}

#cc-main .pm__section:hover {
  background: var(--cc-cookie-category-block-bg-hover);
}

#cc-main .pm__section-title {
  color: var(--cc-text) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#cc-main .pm__section-desc,
#cc-main .pm__section-desc-wrapper {
  color: rgba(255, 255, 255, 0.7) !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  margin-top: 0.5rem;
}

/* Toggle Switch */
#cc-main .section__toggle {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

#cc-main .toggle__icon {
  width: 48px;
  height: 24px;
  background: var(--cc-toggle-bg-off);
  border-radius: 12px;
  position: relative;
  transition: background 0.3s ease;
}

#cc-main .toggle__icon-circle {
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
}

#cc-main .section__toggle.toggle--checked .toggle__icon {
  background: var(--cc-toggle-bg-on);
}

#cc-main .section__toggle.toggle--checked .toggle__icon-circle {
  transform: translateX(24px);
}

#cc-main .section__toggle.toggle--readonly {
  cursor: not-allowed;
  opacity: 0.7;
}

#cc-main .section__toggle.toggle--readonly .toggle__icon {
  background: var(--cc-toggle-bg-readonly);
}

/* Cookie Table */
#cc-main .pm__table {
  width: 100%;
  margin-top: 1rem;
  border-collapse: collapse;
  color: rgba(255, 255, 255, 0.8) !important;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.85rem;
}

#cc-main .pm__table th {
  color: var(--cc-text) !important;
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 2px solid var(--cc-separator-border-color);
}

#cc-main .pm__table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}

#cc-main .pm__table tr:last-child td {
  border-bottom: none;
}

/* Links */
#cc-main .cc-link {
  color: #60a5fa !important;
  text-decoration: underline;
  transition: color 0.2s ease;
  cursor: pointer;
}

#cc-main .cc-link:hover {
  color: #93c5fd !important;
}

/* Close Button */
#cc-main .pm__close-btn {
  color: rgba(255, 255, 255, 0.6) !important;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0.5rem;
  transition: color 0.2s ease;
  line-height: 1;
}

#cc-main .pm__close-btn:hover {
  color: white !important;
}

/* Footer with action buttons */
#cc-main .pm__footer {
  border-top: 1px solid var(--cc-separator-border-color);
  padding: 1.5rem 2rem;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Overlay (backdrop) */
#cc-main .cc__overlay {
  background: var(--cc-overlay-bg) !important;
  backdrop-filter: blur(8px);
}

/* Custom scrollbar for settings modal */
#cc-main .pm__body::-webkit-scrollbar {
  width: 8px;
}

#cc-main .pm__body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

#cc-main .pm__body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

#cc-main .pm__body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  #cc-main .cm {
    max-width: 90%;
    margin: 20px;
    padding: 1.5rem;
  }

  #cc-main .pm {
    max-width: 95%;
    margin: 10px;
  }

  #cc-main .cm__btns,
  #cc-main .pm__footer {
    flex-direction: column;
  }

  #cc-main .cm__btn,
  #cc-main .pm__btn {
    width: 100%;
    margin-bottom: 8px;
  }

  #cc-main .pm__table {
    font-size: 0.75rem;
  }

  #cc-main .pm__table th,
  #cc-main .pm__table td {
    padding: 0.5rem 0.25rem;
  }

  #cc-main .pm__body {
    max-height: 50vh;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  #cc-main .cm__title {
    font-size: 1.25rem;
  }

  #cc-main .pm__title {
    font-size: 1.5rem;
  }

  #cc-main .cm,
  #cc-main .pm {
    border-radius: 12px;
  }
}

/* Animation */
@keyframes cc-fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cc-slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#cc-main .cm {
  animation: cc-fadeIn 0.3s ease-out;
}

#cc-main .pm {
  animation: cc-slideUp 0.3s ease-out;
}

/* Focus states for accessibility */
#cc-main .cm__btn:focus,
#cc-main .pm__btn:focus,
#cc-main .cc-link:focus,
#cc-main .section__toggle:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  #cc-main .cm,
  #cc-main .pm {
    border: 2px solid rgba(255, 255, 255, 0.3);
  }

  #cc-main .cm__btn,
  #cc-main .pm__btn {
    border: 2px solid currentColor;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  #cc-main .cm,
  #cc-main .pm {
    animation: none;
  }

  #cc-main .toggle__icon-circle,
  #cc-main .cm__btn,
  #cc-main .pm__btn,
  #cc-main .cc-link {
    transition: none;
  }
}
