/* ============================================
   Cookie Consent Banner & Settings Modal
   Extracted from legal.css for standalone use.
   Works on both standalone pages (auth_login)
   and app pages (app_base.html) by using
   fallback chains.
   ============================================ */

/* Fallback variables — resolve design-system tokens
   OR legal.css tokens, whichever is loaded. */
.cookie-consent-banner,
.cookie-settings-modal {
  --cc-bg:         var(--color-surface-1, var(--bg-primary, #0d1018));
  --cc-bg-alt:     var(--color-surface-2, var(--bg-secondary, #141820));
  --cc-text:       var(--color-text-primary, var(--text-primary, #fff));
  --cc-text-sec:   var(--color-text-secondary, var(--text-secondary, rgba(255,255,255,0.7)));
  --cc-text-muted: var(--color-text-muted, var(--text-muted, rgba(255,255,255,0.5)));
  --cc-border:     var(--color-border-default, var(--border-light, rgba(255,255,255,0.1)));
  --cc-primary:    var(--color-brand, var(--primary, #3b82f6));
  --cc-primary-dk: var(--color-brand-dark, var(--primary-dark, #2563eb));
}

/* ── Banner ── */
.cookie-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cc-bg);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  padding: 1.5rem 2rem;
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.4s ease;
}

.cookie-consent-banner.visible {
  transform: translateY(0);
}

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

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

.cookie-consent-text h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--cc-text);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cookie-consent-text p {
  color: var(--cc-text-sec);
  font-size: 0.9375rem;
  margin: 0;
}

.cookie-consent-text a {
  color: var(--cc-primary);
  text-decoration: none;
}

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

/* ── Buttons ── */
.cookie-consent-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.cookie-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.cookie-btn-accept {
  background: linear-gradient(135deg, var(--cc-primary) 0%, var(--cc-primary-dk) 100%);
  color: white;
}

.cookie-btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.cookie-btn-customize {
  background: transparent;
  color: var(--cc-text-sec);
  border: 1px solid var(--cc-border);
}

.cookie-btn-customize:hover {
  background: var(--cc-bg-alt);
  color: var(--cc-text);
}

.cookie-btn-reject {
  background: transparent;
  color: var(--cc-text-muted);
}

.cookie-btn-reject:hover {
  color: var(--cc-text);
}

/* ── Settings Modal ── */
.cookie-settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.cookie-settings-modal.visible {
  opacity: 1;
  visibility: visible;
}

.cookie-settings-content {
  background: var(--cc-bg);
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

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

.cookie-settings-header h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--cc-text);
}

.cookie-settings-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  color: var(--cc-text-muted);
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
}

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

/* ── Cookie Categories ── */
.cookie-category {
  padding: 1.25rem;
  background: var(--cc-bg-alt);
  border-radius: 12px;
  margin-bottom: 1rem;
}

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

.cookie-category-header h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--cc-text);
}

.cookie-category p {
  color: var(--cc-text-muted);
  font-size: 0.875rem;
  margin: 0;
}

/* ── Toggle Switch ── */
.cookie-toggle {
  position: relative;
  width: 48px;
  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(--cc-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%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

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

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

/* ── Footer ── */
.cookie-settings-footer {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--cc-border);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .cookie-consent-content {
    flex-direction: column;
    text-align: center;
  }

  .cookie-consent-actions {
    width: 100%;
    justify-content: center;
  }
}
