/* IQIT Cookie Law - front styles
 * Theme-aware: inherits Bootstrap/Warehouse button styles (no fallback override).
 */

#iqitcl-root {
  /* --- Design tokens (override via CSS custom properties) --- */
  --iqitcl-bg:         var(--bs-body-bg, #fff);
  --iqitcl-text:       var(--bs-body-color, #222);
  --iqitcl-muted:      var(--bs-secondary-color, #6c757d);
  --iqitcl-border:     var(--bs-border-color, #dee2e6);
  --iqitcl-surface:    var(--bs-tertiary-bg, #f8f9fa);
  --iqitcl-primary:    var(--bs-primary, #2b7a3e);
  --iqitcl-radius:     var(--bs-border-radius, .375rem);
  --iqitcl-shadow:     0 .5rem 1rem rgba(0, 0, 0, .15);
}

#iqitcl-root[aria-hidden="true"] { display: none; }
#iqitcl-root {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  color: var(--iqitcl-text);
  font-family: inherit;
}
#iqitcl-root.iqitcl-show .iqitcl-banner,
#iqitcl-root.iqitcl-show .iqitcl-overlay,
#iqitcl-root.iqitcl-show .iqitcl-prefs { pointer-events: auto; }

.iqitcl-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); }

/* ---------- banner ---------- */
.iqitcl-banner {
  position: fixed;
  z-index: 10000;
  background: var(--iqitcl-bg);
  color: var(--iqitcl-text);
  box-shadow: var(--iqitcl-shadow);
  padding: 1.25rem 1.5rem;
  max-width: 100%;
  font-size: .9375rem;
  line-height: 1.5;
}
.iqitcl-banner--bordered { border: 1px solid var(--iqitcl-border); }
.iqitcl-banner__inner { max-width: 1200px; margin: 0 auto; }
.iqitcl-banner__title {
  font-size: 1.125rem; font-weight: 600; margin: 0 0 .5rem;
  color: var(--iqitcl-text);
}
.iqitcl-banner__body { margin-bottom: 1rem; }
.iqitcl-banner__body p:last-child { margin-bottom: 0; }
.iqitcl-banner__actions {
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end;
  align-items: center;
}

/* Icon spacing inside Bootstrap buttons */
.iqitcl-banner__actions .btn i,
.iqitcl-prefs__actions .btn i { margin-right: .35rem; }

/* ---------- positions ---------- */
.iqitcl-pos-bottom       { left: 0; right: 0; bottom: 0; }
.iqitcl-pos-top          { left: 0; right: 0; top: 0; }
.iqitcl-pos-bottom-left  { left: 1rem; bottom: 1rem; max-width: 420px; border-radius: var(--iqitcl-radius); }
.iqitcl-pos-bottom-right { right: 1rem; bottom: 1rem; max-width: 420px; border-radius: var(--iqitcl-radius); }
.iqitcl-pos-center       {
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  max-width: 640px;
  border-radius: var(--iqitcl-radius);
}

/* ---------- preferences modal ---------- */
.iqitcl-prefs[hidden] { display: none; }
.iqitcl-prefs { position: fixed; inset: 0; z-index: 10001; }
.iqitcl-prefs__overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.iqitcl-prefs__dialog {
  position: relative;
  max-width: 680px;
  margin: 4vh auto;
  background: var(--iqitcl-bg);
  color: var(--iqitcl-text);
  border-radius: var(--iqitcl-radius);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .3);
  max-height: 92vh;
  overflow: auto;
}
.iqitcl-prefs__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--iqitcl-border);
}
.iqitcl-prefs__head h3 {
  margin: 0; font-size: 1.125rem; font-weight: 600;
  color: var(--iqitcl-text);
}
.iqitcl-prefs__close {
  background: none; border: 0;
  font-size: 1.6rem; line-height: 1;
  cursor: pointer; padding: 0 .25rem;
  color: var(--iqitcl-muted);
}
.iqitcl-prefs__close:hover { color: var(--iqitcl-text); }
.iqitcl-prefs__body { padding: 1rem 1.5rem; }
.iqitcl-prefs__actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--iqitcl-border);
  display: flex; flex-wrap: wrap; gap: .5rem;
  justify-content: flex-end; align-items: center;
}

/* ---------- category rows ---------- */
.iqitcl-cat {
  border: 1px solid var(--iqitcl-border);
  border-radius: var(--iqitcl-radius);
  margin-bottom: .5rem;
  padding: .5rem .875rem;
  background: var(--iqitcl-bg);
}
.iqitcl-cat[open] { background: var(--iqitcl-surface); }
.iqitcl-cat__summary {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; list-style: none;
  padding: .375rem 0;
  gap: 1rem;
}
.iqitcl-cat__summary::-webkit-details-marker { display: none; }
.iqitcl-cat__summary::marker { content: ''; }
.iqitcl-cat__name { font-weight: 600; color: var(--iqitcl-text); }
.iqitcl-cat__desc {
  padding: .5rem 0;
  color: var(--iqitcl-muted);
  font-size: .9375rem;
}

/* ---------- toggle switch ---------- */
.iqitcl-switch {
  position: relative; display: inline-block;
  width: 42px; height: 24px; flex-shrink: 0;
}
.iqitcl-switch input { opacity: 0; width: 0; height: 0; }
.iqitcl-switch__slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bs-secondary-bg, #ccc);
  border-radius: 24px;
  transition: background-color .2s;
}
.iqitcl-switch__slider::before {
  content: ""; position: absolute;
  height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
  transition: transform .2s;
}
.iqitcl-switch input:checked + .iqitcl-switch__slider { background: var(--iqitcl-primary); }
.iqitcl-switch input:checked + .iqitcl-switch__slider::before { transform: translateX(18px); }
.iqitcl-switch input:disabled + .iqitcl-switch__slider {
  opacity: .55; cursor: not-allowed;
}
.iqitcl-switch input:focus-visible + .iqitcl-switch__slider {
  outline: 2px solid var(--iqitcl-primary);
  outline-offset: 2px;
}

/* ---------- cookies table ---------- */
.iqitcl-cookies {
  width: 100%; font-size: .8125rem;
  border-collapse: collapse;
  margin-top: .5rem;
}
.iqitcl-cookies th, .iqitcl-cookies td {
  text-align: left; padding: .5rem .75rem;
  border-bottom: 1px solid var(--iqitcl-border);
  vertical-align: top;
}
.iqitcl-cookies thead th {
  background: var(--iqitcl-surface);
  font-weight: 600; font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--iqitcl-muted);
}
.iqitcl-cookies tbody tr:last-child td { border-bottom: 0; }
.iqitcl-cookies a { color: var(--iqitcl-primary); text-decoration: none; }
.iqitcl-cookies a:hover { text-decoration: underline; }

/* ---------- footer link ---------- */
.iqitcl-footer-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.iqitcl-footer-link:hover { color: var(--iqitcl-primary); }

/* ---------- small screens ---------- */
@media (max-width: 576px) {
  .iqitcl-pos-bottom-left,
  .iqitcl-pos-bottom-right { left: .5rem; right: .5rem; max-width: none; }

  .iqitcl-banner__actions { justify-content: stretch; }
  .iqitcl-banner__actions .btn { flex: 1 1 100%; }

  .iqitcl-prefs__dialog { margin: 2vh auto; max-height: 96vh; }
  .iqitcl-prefs__actions .btn { flex: 1 1 100%; }

  .iqitcl-cookies { font-size: .75rem; }
  .iqitcl-cookies th, .iqitcl-cookies td { padding: .4rem .5rem; }
}

/* ---------- dark mode ---------- */
@media (prefers-color-scheme: dark) {
  #iqitcl-root:not([data-theme="light"]) {
    --iqitcl-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .5);
  }
  .iqitcl-overlay,
  .iqitcl-prefs__overlay { background: rgba(0, 0, 0, .7); }
}