/* Cookie-consent banner + preferences modal.
   Three visual modes driven by the `data-mode` attribute on .cookie-banner:
     - eu / uk : full-width modal-grade banner anchored to the viewport
                 bottom; blocking style (page interactable but banner is
                 prominent until choice is made).
     - ca      : narrow opt-out bar with "Do not sell/share" link.
     - other   : slim notice bar with "Got it" dismiss.
*/

.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 2147483000;            /* above almost everything */
  background: var(--surface, #1a1f29);
  color: var(--text, #e6eaf0);
  border-top: 1px solid var(--border, #2a2f3a);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.35);
  padding: 16px 24px;
  font-size: 14px;
  line-height: 1.45;
  display: none;
}
.cookie-banner[data-open="1"] { display: block; }

.cookie-banner .cb-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.cookie-banner .cb-text { flex: 1 1 360px; min-width: 240px; }
.cookie-banner .cb-text h3 {
  margin: 0 0 6px 0; font-size: 15px; font-weight: 600;
}
.cookie-banner .cb-text p { margin: 0; opacity: 0.85; }
.cookie-banner .cb-text a { color: var(--accent, #6fb8ff); text-decoration: underline; }

.cookie-banner .cb-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.cookie-banner .cb-actions button {
  font: inherit; cursor: pointer; padding: 8px 14px;
  border-radius: 4px; border: 1px solid transparent;
  background: transparent; color: inherit;
}
.cookie-banner .cb-actions .cb-primary {
  background: var(--accent, #2f72ec); color: #fff;
  border-color: var(--accent, #2f72ec);
}
.cookie-banner .cb-actions .cb-primary:hover { filter: brightness(1.1); }
.cookie-banner .cb-actions .cb-secondary {
  border-color: var(--border, #2a2f3a);
  background: var(--surface-2, #232936);
}
.cookie-banner .cb-actions .cb-link {
  text-decoration: underline; opacity: 0.85;
}

/* CA opt-out variant: smaller, less aggressive */
.cookie-banner[data-mode="ca"] { padding: 12px 20px; }
.cookie-banner[data-mode="ca"] .cb-text h3 { display: none; }

/* "Other" jurisdictions: minimal notice */
.cookie-banner[data-mode="other"] { padding: 10px 18px; font-size: 13px; }
.cookie-banner[data-mode="other"] .cb-text h3 { display: none; }
.cookie-banner[data-mode="other"] .cb-actions .cb-reject,
.cookie-banner[data-mode="other"] .cb-actions .cb-manage { display: none; }

/* Preferences modal */
.cookie-prefs-back {
  position: fixed; inset: 0; z-index: 2147483001;
  background: rgba(0,0,0,0.55);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.cookie-prefs-back[data-open="1"] { display: flex; }
.cookie-prefs-card {
  background: var(--surface, #1a1f29);
  color: var(--text, #e6eaf0);
  border: 1px solid var(--border, #2a2f3a);
  border-radius: 8px;
  padding: 24px;
  max-width: 540px; width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.cookie-prefs-card h2 { margin: 0 0 4px 0; font-size: 18px; }
.cookie-prefs-card .cb-sub { margin: 0 0 16px 0; opacity: 0.75; font-size: 13px; }
.cookie-prefs-card .cat {
  border: 1px solid var(--border, #2a2f3a);
  border-radius: 6px; padding: 10px 12px;
  margin-bottom: 8px;
  display: flex; align-items: flex-start; gap: 12px;
}
.cookie-prefs-card .cat-info { flex: 1; }
.cookie-prefs-card .cat-info h4 {
  margin: 0 0 2px 0; font-size: 14px; font-weight: 600;
}
.cookie-prefs-card .cat-info p { margin: 0; font-size: 12.5px; opacity: 0.75; }
.cookie-prefs-card .cat input[type="checkbox"] { transform: scale(1.2); margin-top: 2px; }
.cookie-prefs-card .cat-locked input { pointer-events: none; opacity: 0.6; }
.cookie-prefs-card .cb-foot {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px;
}

/* Footer link (re-open) — host page adds .cookie-prefs-link wherever it wants */
.cookie-prefs-link {
  background: none; border: none; color: inherit; cursor: pointer;
  font: inherit; text-decoration: underline; opacity: 0.75;
}
.cookie-prefs-link:hover { opacity: 1; }

/* Light theme override */
[data-theme="light"] .cookie-banner,
[data-theme="light"] .cookie-prefs-card {
  background: #ffffff; color: #1a1f29; border-color: #d0d4dc;
}
[data-theme="light"] .cookie-banner .cb-actions .cb-secondary {
  background: #f4f6fa;
}
