/**
 * Cookie Consent Banner
 * Simple, clean, GDPR/CCPA compliant
 */

/* Banner Styles - Compact Design */
#cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  z-index: 9999;
  display: none;
  animation: slideUp 0.3s ease;
}

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

.cookie-consent-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.cookie-consent-text {
  flex: 1;
  min-width: 0;
}

.cookie-consent-text h3 {
  display: inline;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
}

.cookie-consent-text p {
  display: inline;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.cookie-consent-text a {
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
}

.cookie-consent-text a:hover {
  text-decoration: underline;
}

.cookie-consent-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cookie-consent-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.cookie-consent-btn-accept {
  background: var(--brand);
  color: #fff;
}

.cookie-consent-btn-accept:hover {
  background: var(--brand-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(91, 138, 255, 0.3);
}

.cookie-consent-btn-decline {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.cookie-consent-btn-decline:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.cookie-consent-btn-settings {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.cookie-consent-btn-settings:hover {
  background: rgba(91, 138, 255, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  #cookie-consent-banner {
    padding: 0.75rem 0.75rem;
    z-index: 10001 !important; /* Above chatbot and theme toggle */
    position: fixed !important;
  }

  .cookie-consent-container {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .cookie-consent-text {
    min-width: 0;
  }

  .cookie-consent-text h3 {
    display: block;
    margin-bottom: 0.25rem;
  }

  .cookie-consent-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .cookie-consent-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
  }

  .cookie-consent-btn-settings {
    grid-column: 1 / -1;
  }
}

/* Preferences Modal */
#cookie-preferences-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 10002; /* Above banner (10001) and buttons (10000-10001) */
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

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

.cookie-preferences-content {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease;
}

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

.cookie-preferences-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cookie-preferences-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text);
}

.cookie-preferences-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
}

.cookie-preferences-close:hover {
  color: var(--text);
}

.cookie-preferences-body {
  padding: 1.5rem;
}

.cookie-category {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.cookie-category:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.cookie-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

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

.cookie-toggle {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

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

.cookie-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border);
  transition: 0.3s;
  border-radius: 26px;
}

.cookie-toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.3s;
  border-radius: 50%;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
  background: var(--brand);
}

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

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

.cookie-category-description {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.cookie-category-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.badge-required {
  background: rgba(62, 213, 152, 0.2);
  color: var(--good);
}

.cookie-preferences-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .cookie-preferences-footer {
    flex-direction: column-reverse;
  }

  .cookie-preferences-footer button {
    width: 100%;
  }
}
