/* ==========================================================================
   static/css/cookie_consent.css — Cookie consent banner + preferences dialog
   Uses the SwiftPOS v4 tokens from swift.css (with fallbacks).
   ========================================================================== */

.sx-cc-banner[hidden],
.sx-cc-overlay[hidden] { display: none !important; }

html.sx-cc-lock { overflow: hidden; }

/* ── Buttons ── */
.sx-cc-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font: 600 14px/1.2 var(--sx-body, system-ui, sans-serif);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.sx-cc-btn:focus-visible,
.sx-cc-close:focus-visible,
.sx-cc-switch input:focus-visible + .sx-cc-switch__track {
  outline: 2px solid var(--sx-brand-300, #B99BE0);
  outline-offset: 2px;
}
.sx-cc-btn--primary {
  background: var(--sx-brand, #5D2D97);
  color: #fff;
}
.sx-cc-btn--primary:hover { background: var(--sx-brand-700, #431E73); }

/* "Reject all" is styled with equal weight to "Accept all" on purpose:
   rejecting must be as easy as accepting. */
.sx-cc-btn--secondary {
  background: var(--sx-white, #fff);
  color: var(--sx-brand, #5D2D97);
  border-color: var(--sx-brand, #5D2D97);
}
.sx-cc-btn--secondary:hover { background: var(--sx-brand-50, #F7F3FC); }

.sx-cc-btn--ghost {
  background: transparent;
  color: var(--sx-ink, #17131F);
  border-color: var(--sx-line, #E8E4EF);
}
.sx-cc-btn--ghost:hover { background: var(--sx-canvas, #F6F5FA); }

/* ── Banner ── */
.sx-cc-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  max-width: 1100px;
  margin: 0 auto;
  background: var(--sx-white, #fff);
  color: var(--sx-text, #4E4862);
  border: 1px solid var(--sx-line, #E8E4EF);
  border-radius: var(--sx-r-lg, 22px);
  box-shadow: var(--sx-shadow-lg, 0 30px 60px -24px rgba(46, 20, 82, .35));
  animation: sx-cc-up .35s var(--sx-ease, ease-out);
}
.sx-cc-banner__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
}
.sx-cc-banner__copy { flex: 1 1 auto; min-width: 0; }
.sx-cc-banner__title {
  margin: 0 0 4px;
  font: 600 16px/1.3 var(--sx-display, system-ui, sans-serif);
  color: var(--sx-ink, #17131F);
}
.sx-cc-banner__text {
  margin: 0;
  font: 400 14px/1.55 var(--sx-body, system-ui, sans-serif);
}
.sx-cc-banner a,
.sx-cc-dialog a {
  color: var(--sx-brand, #5D2D97);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sx-cc-banner__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

@keyframes sx-cc-up {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Preferences dialog ── */
.sx-cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 2010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(22, 10, 44, .55);
}
.sx-cc-dialog {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--sx-white, #fff);
  color: var(--sx-text, #4E4862);
  border-radius: var(--sx-r-lg, 22px);
  box-shadow: var(--sx-shadow-lg, 0 30px 60px -24px rgba(46, 20, 82, .35));
  outline: none;
  overflow: hidden;
}
.sx-cc-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
}
.sx-cc-dialog__title {
  margin: 0;
  font: 600 20px/1.3 var(--sx-display, system-ui, sans-serif);
  color: var(--sx-ink, #17131F);
}
.sx-cc-close {
  appearance: none;
  border: 0;
  background: var(--sx-canvas, #F6F5FA);
  color: var(--sx-ink, #17131F);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.sx-cc-dialog__body {
  padding: 0 24px 8px;
  overflow-y: auto;
}
.sx-cc-dialog__intro {
  margin: 0 0 12px;
  font: 400 14px/1.55 var(--sx-body, system-ui, sans-serif);
}
.sx-cc-cat {
  border-top: 1px solid var(--sx-line-soft, #F1EEF6);
  padding: 14px 0;
}
.sx-cc-cat__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.sx-cc-cat__name {
  display: block;
  margin: 0 0 2px;
  font: 600 15px/1.4 var(--sx-body, system-ui, sans-serif);
  color: var(--sx-ink, #17131F);
}
.sx-cc-cat__desc {
  margin: 0;
  font: 400 13px/1.5 var(--sx-body, system-ui, sans-serif);
  color: var(--sx-muted, #7A748C);
}
.sx-cc-always {
  flex: 0 0 auto;
  font: 600 12px/1 var(--sx-body, system-ui, sans-serif);
  color: var(--sx-ok, #0F9B63);
  background: var(--sx-ok-bg, #E6F6EE);
  padding: 6px 10px;
  border-radius: 999px;
}
.sx-cc-dialog__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--sx-line, #E8E4EF);
}

/* ── Toggle switch (a real checkbox underneath, so it is accessible) ── */
.sx-cc-switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  margin-top: 2px;
  cursor: pointer;
}
.sx-cc-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.sx-cc-switch__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #CFCAD9;
  transition: background-color .15s ease;
  pointer-events: none;
}
.sx-cc-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .15s ease;
}
.sx-cc-switch input:checked + .sx-cc-switch__track { background: var(--sx-brand, #5D2D97); }
.sx-cc-switch input:checked + .sx-cc-switch__track::after { transform: translateX(18px); }

/* ── Footer "Cookie settings" link rendered as a button ── */
.sx-cc-footer-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.sx-cc-footer-link:hover { text-decoration: underline; }

/* ── Small screens ── */
@media (max-width: 820px) {
  .sx-cc-banner__inner { flex-direction: column; align-items: stretch; gap: 14px; padding: 18px; }
  .sx-cc-banner__actions { flex-wrap: wrap; }
  .sx-cc-banner__actions .sx-cc-btn { flex: 1 1 0; }
}
@media (max-width: 480px) {
  .sx-cc-banner { left: 8px; right: 8px; bottom: 8px; }
  .sx-cc-banner__actions .sx-cc-btn--ghost { flex-basis: 100%; order: 3; }
  .sx-cc-dialog__foot .sx-cc-btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sx-cc-banner { animation: none; }
  .sx-cc-btn, .sx-cc-switch__track, .sx-cc-switch__track::after { transition: none; }
}
