/* ════════════════════════════════════════════════════════════
   Invoice Finder — Cookie Consent (shared, all pages)
   Theme-matched, accessible (SI 5568 / WCAG 2.1 AA), RTL + LTR.
   ════════════════════════════════════════════════════════════ */
:root {
  --cc-blue: #1976D2;
  --cc-blue-hover: #1565C0;
  --cc-blue-soft: #E3F2FD;
  --cc-text: #0f172a;
  --cc-text-secondary: #475569;
  --cc-text-muted: #64748b;
  --cc-border: #e2e8f0;
  --cc-border-hover: #cbd5e1;
  --cc-white: #ffffff;
  --cc-bg: #f8fafd;
  --cc-radius: 16px;
  --cc-radius-sm: 10px;
  --cc-font: 'Heebo', 'Rubik', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}

.cc-root, .cc-root * { box-sizing: border-box; }
.cc-root button { font-family: var(--cc-font); }

/* ── Banner ── */
.cc-banner {
  position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 100000;
  width: min(420px, calc(100% - 32px));
  background: var(--cc-white); color: var(--cc-text);
  border: 1px solid var(--cc-border); border-radius: var(--cc-radius);
  box-shadow: 0 16px 48px rgba(15,23,42,0.16), 0 0 0 1px rgba(15,23,42,0.02);
  padding: 24px; font-family: var(--cc-font); line-height: 1.6;
}
.cc-banner h2 {
  font-family: 'Rubik', var(--cc-font); font-size: 1.05rem; font-weight: 700;
  margin: 0 0 8px; color: var(--cc-text); display: flex; align-items: center; gap: 10px;
}
.cc-banner h2 svg { flex: 0 0 auto; }
.cc-banner p { margin: 0 0 18px; font-size: 0.9rem; color: var(--cc-text-secondary); }
.cc-banner a.cc-link { color: var(--cc-blue-hover); text-decoration: underline; font-weight: 600; }

.cc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
/* Accept and Reject get EQUAL visual weight (no dark patterns). */
.cc-btn {
  flex: 1 1 auto; min-width: 130px; min-height: 44px;
  padding: 11px 18px; border-radius: 100px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: background 0.2s, border-color 0.2s, color 0.2s;
  text-align: center; border: 2px solid transparent;
}
.cc-btn-primary { background: var(--cc-blue); color: #fff; border-color: var(--cc-blue); }
.cc-btn-primary:hover { background: var(--cc-blue-hover); border-color: var(--cc-blue-hover); }
.cc-btn-secondary { background: var(--cc-white); color: var(--cc-blue-hover); border-color: var(--cc-blue); }
.cc-btn-secondary:hover { background: var(--cc-blue-soft); }
.cc-btn-tertiary {
  flex: 1 1 100%; min-height: 40px; background: none; border: none; padding: 8px;
  color: var(--cc-text-secondary); font-weight: 600; text-decoration: underline; cursor: pointer;
}
.cc-btn-tertiary:hover { color: var(--cc-text); }

/* ── Floating re-open button (only used as a fallback; footer link is primary) ── */
.cc-fab {
  position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 99998;
  width: 44px; height: 44px; border-radius: 50%; background: var(--cc-white);
  border: 1px solid var(--cc-border); box-shadow: 0 4px 16px rgba(15,23,42,0.12);
  cursor: pointer; display: none; align-items: center; justify-content: center;
}
.cc-fab:hover { box-shadow: 0 8px 24px rgba(15,23,42,0.18); }

/* ── Settings dialog ── */
.cc-overlay {
  position: fixed; inset: 0; z-index: 100001; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(15,23,42,0.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.cc-overlay.cc-open { display: flex; }
.cc-modal {
  background: var(--cc-white); color: var(--cc-text); font-family: var(--cc-font);
  width: 100%; max-width: 600px; max-height: 88vh; overflow-y: auto;
  border-radius: var(--cc-radius); padding: clamp(24px, 4vw, 40px); position: relative;
  box-shadow: 0 24px 64px rgba(15,23,42,0.28); line-height: 1.6;
}
.cc-modal h2 { font-family: 'Rubik', var(--cc-font); font-size: 1.35rem; font-weight: 800; margin: 0 0 8px; }
.cc-modal > p.cc-intro { font-size: 0.92rem; color: var(--cc-text-secondary); margin: 0 0 8px; }
.cc-modal > p.cc-intro a { color: var(--cc-blue-hover); text-decoration: underline; font-weight: 600; }
.cc-close {
  position: absolute; top: 12px; inset-inline-start: 12px;
  width: 44px; height: 44px; border-radius: 50%; background: var(--cc-bg);
  border: 1px solid var(--cc-border); color: var(--cc-text-secondary);
  font-size: 1.3rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.cc-close:hover { background: var(--cc-border); color: var(--cc-text); }

.cc-cat {
  border: 1px solid var(--cc-border); border-radius: var(--cc-radius-sm);
  padding: 18px 20px; margin-top: 16px;
}
.cc-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.cc-cat-head h3 { font-family: 'Rubik', var(--cc-font); font-size: 1rem; font-weight: 700; margin: 0; }
.cc-cat p { font-size: 0.86rem; color: var(--cc-text-secondary); margin: 8px 0 0; }

.cc-always { font-size: 0.8rem; font-weight: 700; color: #166534; background: #dcfce7; padding: 6px 14px; border-radius: 100px; }

/* Accessible toggle switch built on a real checkbox */
.cc-switch { position: relative; flex: 0 0 auto; display: inline-flex; }
.cc-switch input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}
.cc-track {
  width: 52px; height: 30px; border-radius: 100px; background: #cbd5e1;
  position: relative; transition: background 0.2s; pointer-events: none;
}
.cc-track::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s;
}
.cc-switch input:checked + .cc-track { background: var(--cc-blue); }
.cc-switch input:checked + .cc-track::after { transform: translateX(22px); }
[dir="rtl"] .cc-switch input:checked + .cc-track::after { transform: translateX(-22px); }
.cc-switch input:focus-visible + .cc-track { outline: 3px solid var(--cc-blue); outline-offset: 3px; }

.cc-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.cc-modal-actions .cc-btn { flex: 1 1 160px; }

/* Visible focus for keyboard users everywhere in the consent UI */
.cc-root :focus-visible, .cc-overlay :focus-visible {
  outline: 3px solid var(--cc-blue); outline-offset: 3px; border-radius: 6px;
}

@media (max-width: 480px) {
  .cc-banner { inset-inline-end: 12px; bottom: 12px; padding: 20px; }
  .cc-actions .cc-btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cc-root *, .cc-overlay * { transition-duration: 0.01ms !important; }
}
