/* ===================================================
   1% Better — consent.css
   Swiss Medical Precision Cookie & Privacy Banner / Modal
   Full Dark & Light Theme Support, Zero CSP Inline Violations
   =================================================== */

:root {
  --opb-consent-bg: rgba(20, 27, 65, 0.95);
  --opb-consent-surface: rgba(30, 41, 59, 0.75);
  --opb-consent-border: rgba(32, 164, 179, 0.35);
  --opb-consent-text: #f8fafc;
  --opb-consent-muted: #94a3b8;
  --opb-consent-teal: #20a4b3;
  --opb-consent-teal-hover: #26b9c9;
  --opb-consent-shadow:
    0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(32, 164, 179, 0.2);
}

/* Light Theme Overrides */
[data-theme="light"] {
  --opb-consent-bg: rgba(255, 255, 255, 0.97);
  --opb-consent-surface: rgba(241, 245, 249, 0.9);
  --opb-consent-border: rgba(20, 27, 65, 0.15);
  --opb-consent-text: #141b41;
  --opb-consent-muted: #64748b;
  --opb-consent-teal: #167e8a;
  --opb-consent-teal-hover: #20a4b3;
  --opb-consent-shadow:
    0 20px 40px -10px rgba(20, 27, 65, 0.15), 0 0 0 1px rgba(32, 164, 179, 0.25);
}

/* System Light Theme when no data-theme attribute set */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --opb-consent-bg: rgba(255, 255, 255, 0.97);
    --opb-consent-surface: rgba(241, 245, 249, 0.9);
    --opb-consent-border: rgba(20, 27, 65, 0.15);
    --opb-consent-text: #141b41;
    --opb-consent-muted: #64748b;
    --opb-consent-teal: #167e8a;
    --opb-consent-teal-hover: #20a4b3;
    --opb-consent-shadow:
      0 20px 40px -10px rgba(20, 27, 65, 0.15),
      0 0 0 1px rgba(32, 164, 179, 0.25);
  }
}

/* ── Banner ── */
.opb-consent-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 580px;
  margin: 0 auto;
  background: var(--opb-consent-bg);
  border: 1px solid var(--opb-consent-border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: var(--opb-consent-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 9999999;
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--opb-consent-text);
  animation: opbSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes opbSlideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.opb-consent-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

/* Proportional shield icon */
.opb-consent-shield {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  aspect-ratio: 1 / 1;
  display: block;
  color: var(--opb-consent-teal);
  flex-shrink: 0;
}

.opb-consent-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--opb-consent-text);
}

.opb-consent-desc {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--opb-consent-muted);
  margin: 0 0 16px 0;
}

.opb-consent-desc a {
  color: var(--opb-consent-teal);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s;
}

.opb-consent-desc a:hover {
  opacity: 0.85;
}

.opb-consent-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.opb-consent-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  line-height: 1.4;
  outline: none;
}

.opb-consent-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--opb-consent-teal);
}

.opb-consent-btn-primary {
  background: var(--opb-consent-teal);
  color: #ffffff;
  border-color: var(--opb-consent-teal);
}

.opb-consent-btn-primary:hover {
  background: var(--opb-consent-teal-hover);
  box-shadow: 0 2px 8px rgba(32, 164, 179, 0.35);
}

.opb-consent-btn-secondary {
  background: var(--opb-consent-surface);
  color: var(--opb-consent-text);
  border-color: var(--opb-consent-border);
}

.opb-consent-btn-secondary:hover {
  background: rgba(32, 164, 179, 0.12);
  border-color: var(--opb-consent-teal);
}

.opb-consent-btn-link {
  background: transparent;
  color: var(--opb-consent-muted);
  padding: 8px 10px;
  text-decoration: underline;
  margin-left: auto;
}

.opb-consent-btn-link:hover {
  color: var(--opb-consent-text);
}

/* ── Modal Overlay ── */
.opb-consent-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 40, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: opbFadeIn 0.2s ease;
}

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

.opb-consent-modal {
  background: var(--opb-consent-bg);
  border: 1px solid var(--opb-consent-border);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  padding: 26px;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(32, 164, 179, 0.2);
  color: var(--opb-consent-text);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  animation: opbScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes opbScaleIn {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.opb-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 6px 0;
  color: var(--opb-consent-text);
}

.opb-modal-desc {
  font-size: 0.84rem;
  color: var(--opb-consent-muted);
  line-height: 1.5;
  margin: 0 0 20px 0;
}

.opb-cookie-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--opb-consent-surface);
  border: 1px solid var(--opb-consent-border);
  border-radius: 8px;
  margin-bottom: 12px;
  gap: 16px;
}

.opb-cookie-info h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--opb-consent-text);
}

.opb-cookie-info p {
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 0;
  color: var(--opb-consent-muted);
}

.opb-cookie-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(32, 164, 179, 0.15);
  color: var(--opb-consent-teal);
  white-space: nowrap;
}

/* ── Toggle Switch ── */
.opb-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.opb-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.opb-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(148, 163, 184, 0.35);
  transition: 0.25s;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.opb-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.25s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.opb-switch input:checked + .opb-slider {
  background-color: var(--opb-consent-teal);
  border-color: var(--opb-consent-teal);
}

.opb-switch input:checked + .opb-slider:before {
  transform: translateX(18px);
}

.opb-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

@media (max-width: 600px) {
  .opb-consent-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 16px;
  }
  .opb-consent-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .opb-consent-btn-link {
    margin-left: 0;
    text-align: center;
  }
}

/* ── Floating Preferences Button ── */
.opb-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--opb-consent-surface);
  border: 1px solid var(--opb-consent-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999998; /* Just below banner/modal */
  color: var(--opb-consent-text);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.opb-floating-btn svg {
  width: 24px;
  height: 24px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Design Spell: The "Bite" & Rotation Interaction */
.opb-floating-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow:
    0 12px 24px rgba(32, 164, 179, 0.25),
    0 0 0 1px var(--opb-consent-teal);
  background: var(--opb-consent-teal);
  color: #ffffff;
  border-color: var(--opb-consent-teal);
}

.opb-floating-btn:hover svg {
  /* Rotate slightly and bounce to simulate taking a bite out of a cookie */
  transform: rotate(15deg) scale(1.1);
}

.opb-floating-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--opb-consent-teal);
}

@media (max-width: 600px) {
  .opb-floating-btn {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
}
