/* myflask/static/css/consent.css
 * Cookie-consent banner + preference centre. Self-contained: no Bootstrap,
 * works on standalone landing pages. Light by default; dark under body.theme-dark
 * (the app's theme class); RTL-aware. Sits above app chrome. */

.oui-consent-banner,
.oui-consent-modal,
.oui-consent-reopen {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.oui-consent-banner *,
.oui-consent-modal * { box-sizing: border-box; }

/* ---------- First-layer banner ---------- */
.oui-consent-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 2147483000;
  background: #0f172a;
  color: #e5e7eb;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  animation: ouiConsentSlideUp 0.28s ease-out;
}
@keyframes ouiConsentSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.oui-consent-banner__inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.oui-consent-banner__text { flex: 1 1 420px; min-width: 260px; font-size: 0.9rem; line-height: 1.5; }
.oui-consent-banner__text strong { display: block; font-size: 0.98rem; margin-bottom: 2px; }
.oui-consent-banner__text p { margin: 0; color: rgba(226, 232, 240, 0.92); }
.oui-consent-banner__actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; justify-content: flex-end;
  flex: 0 0 auto;
}

.oui-consent-link,
.oui-consent-banner__text a { color: #7dd3fc; text-decoration: underline; }

/* ---------- Buttons (equal prominence for accept/reject) ---------- */
.oui-consent-btn {
  appearance: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
  transition: transform 0.12s ease, filter 0.12s ease, background-color 0.12s ease;
  white-space: nowrap;
}
.oui-consent-btn:active { transform: translateY(1px); }
.oui-consent-btn--primary { background: linear-gradient(135deg, #22c55e, #0ea5e9); color: #0b1120; }
.oui-consent-btn--primary:hover { filter: brightness(1.04); }
.oui-consent-btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.5);
}
.oui-consent-btn--ghost:hover { background: rgba(255, 255, 255, 0.16); }
.oui-consent-btn:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 2px; }

/* ---------- Preference centre (modal) ---------- */
.oui-consent-modal {
  position: fixed; inset: 0;
  z-index: 2147483001;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.oui-consent-modal__backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, 0.6); }
.oui-consent-modal__panel {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  color: #0f172a;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(2, 6, 23, 0.55);
  padding: 22px 22px 18px;
  animation: ouiConsentPop 0.2s ease-out;
}
@keyframes ouiConsentPop { from { transform: translateY(8px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }

.oui-consent-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.oui-consent-modal__head h2 { margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; }
.oui-consent-modal__close {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-size: 1.6rem; line-height: 1; color: #6b7280; padding: 0 4px;
}
.oui-consent-modal__close:hover { color: #111827; }
.oui-consent-modal__intro { margin: 8px 0 16px; font-size: 0.92rem; line-height: 1.55; color: #4b5563; }
.oui-consent-modal__policy { margin: 4px 0 0; font-size: 0.88rem; }
.oui-consent-modal__policy a { color: #0f766e; text-decoration: underline; }

.oui-consent-modal__actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: flex-end; margin-top: 18px;
  padding-top: 14px; border-top: 1px solid #e5e7eb;
}
.oui-consent-modal__actions .oui-consent-btn--ghost { color: #0f172a; background: #f1f5f9; border-color: #e2e8f0; }
.oui-consent-modal__actions .oui-consent-btn--ghost:hover { background: #e2e8f0; }

/* ---------- Category rows ---------- */
.oui-consent-cat { padding: 12px 0; border-top: 1px solid #eef2f7; }
.oui-consent-cat:first-of-type { border-top: 0; }
.oui-consent-cat__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.oui-consent-cat__label { display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.oui-consent-cat__badge {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  color: #065f46; background: #d1fae5; border: 1px solid #a7f3d0;
  padding: 2px 8px; border-radius: 999px;
}
.oui-consent-cat__desc { margin: 6px 0 0; font-size: 0.86rem; line-height: 1.5; color: #6b7280; }

/* ---------- Toggle switch ---------- */
.oui-consent-switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: 0 0 auto; }
.oui-consent-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.oui-consent-switch__ui {
  position: absolute; inset: 0; border-radius: 999px;
  background: #cbd5e1; transition: background-color 0.15s ease;
}
.oui-consent-switch__ui::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}
.oui-consent-switch input:checked + .oui-consent-switch__ui { background: #16a34a; }
.oui-consent-switch input:checked + .oui-consent-switch__ui::after { transform: translateX(18px); }
.oui-consent-switch input:focus-visible + .oui-consent-switch__ui { outline: 2px solid #0ea5e9; outline-offset: 2px; }
.oui-consent-switch--locked .oui-consent-switch__ui { background: #16a34a; opacity: 0.55; }
.oui-consent-switch--locked input { cursor: not-allowed; }

/* === SEARCH: consent_hidden_attr_authoritative_2026_07_18 START ===
   Fix (2026-07-18): make the HTML `hidden` attribute win. The banner/modal/
   reopen elements set their own `display`, which overrides the user-agent
   `[hidden]{display:none}` rule. On Bootstrap-free standalone pages (e.g.
   ouisnap.me/h — dot.css has no GLOBAL [hidden] reset) that meant the floating
   "Cookie preferences" pill showed from page load, before any choice, looking
   like the consent wasn't saved. consent.js drives visibility via the `hidden`
   attribute (show/hide), so this makes the attribute authoritative. */
.oui-consent-banner[hidden],
.oui-consent-modal[hidden],
.oui-consent-reopen[hidden] { display: none !important; }
/* === SEARCH: consent_hidden_attr_authoritative_2026_07_18 END === */

/* ---------- Persistent reopen affordance ---------- */
.oui-consent-reopen {
  position: fixed; left: 14px; bottom: 14px;
  z-index: 2147482999;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.8rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}
.oui-consent-reopen:hover { background: rgba(15, 23, 42, 1); }
.oui-consent-reopen__label { white-space: nowrap; }
@media (max-width: 480px) { .oui-consent-reopen__label { display: none; } }

/* ---------- Dark theme (app sets body.theme-dark) ---------- */
body.theme-dark .oui-consent-modal__panel { background: #111827; color: #e5e7eb; }
body.theme-dark .oui-consent-modal__intro { color: #9ca3af; }
body.theme-dark .oui-consent-modal__head h2 { color: #f9fafb; }
body.theme-dark .oui-consent-modal__close { color: #9ca3af; }
body.theme-dark .oui-consent-modal__close:hover { color: #f9fafb; }
body.theme-dark .oui-consent-cat { border-top-color: rgba(148, 163, 184, 0.18); }
body.theme-dark .oui-consent-cat__desc { color: #9ca3af; }
body.theme-dark .oui-consent-modal__actions { border-top-color: rgba(148, 163, 184, 0.18); }
body.theme-dark .oui-consent-modal__actions .oui-consent-btn--ghost { background: rgba(255,255,255,0.08); color: #e5e7eb; border-color: rgba(148,163,184,0.4); }
body.theme-dark .oui-consent-switch__ui { background: #374151; }

/* ---------- RTL ---------- */
[dir="rtl"] .oui-consent-banner__actions { justify-content: flex-start; }
[dir="rtl"] .oui-consent-reopen { left: auto; right: 14px; }
[dir="rtl"] .oui-consent-switch input:checked + .oui-consent-switch__ui::after { transform: translateX(-18px); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .oui-consent-banner, .oui-consent-modal__panel { animation: none; }
  .oui-consent-btn, .oui-consent-switch__ui, .oui-consent-switch__ui::after { transition: none; }
}
