/* Inology IT — Cookie Consent UI
 * Slim bottom bar (first visit) + preferences modal.
 * Uses existing Inology design tokens from style.css.
 */

/* ---------- Shared button (scoped) ---------- */
.consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
}
.consent-btn:focus-visible {
  outline: 2px solid var(--purple, #5C3792);
  outline-offset: 2px;
}
.consent-btn--primary {
  background: var(--purple, #5C3792);
  color: #fff;
}
.consent-btn--primary:hover {
  background: var(--purple-deep, #432A6E);
  transform: translateY(-1px);
}
.consent-btn--ghost {
  background: transparent;
  color: var(--purple, #5C3792);
  border-color: rgba(92, 55, 146, 0.25);
}
.consent-btn--ghost:hover {
  background: rgba(92, 55, 146, 0.06);
  border-color: var(--purple, #5C3792);
}

/* ---------- Bottom bar ---------- */
.consent-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9998;
  background: var(--cream, #FAF7F1);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(20, 14, 35, 0.18);
  transform: translateY(140%);
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
  font-family: inherit;
}
.consent-bar.is-visible {
  transform: translateY(0);
  opacity: 1;
}
.consent-bar__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  max-width: 1280px;
  margin: 0 auto;
}
.consent-bar__text {
  flex: 1;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink, #1F1633);
}
.consent-bar__text a {
  color: var(--purple, #5C3792);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.consent-bar__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* Mobile — stack */
@media (max-width: 720px) {
  .consent-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    border-radius: 12px;
  }
  .consent-bar__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px 18px;
  }
  .consent-bar__text {
    font-size: 0.88rem;
  }
  .consent-bar__actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .consent-bar__actions .consent-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    padding: 12px 14px;
    font-size: 0.9rem;
  }
  .consent-bar__actions .consent-btn[data-consent-action="customise"] {
    flex-basis: 100%;
    order: 3;
  }
}

/* ---------- Modal ---------- */
.consent-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.consent-modal.is-visible {
  opacity: 1;
}
.consent-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 14, 35, 0.5);
  backdrop-filter: blur(2px);
}
.consent-modal__panel {
  position: relative;
  background: var(--paper, #fff);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px 32px 28px;
  box-shadow: 0 24px 64px rgba(20, 14, 35, 0.32);
  transform: scale(0.96);
  transition: transform 0.2s ease;
}
.consent-modal.is-visible .consent-modal__panel {
  transform: scale(1);
}
.consent-modal__x {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink, #1F1633);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.consent-modal__x:hover { background: rgba(0,0,0,0.05); }
.consent-modal__x:focus-visible {
  outline: 2px solid var(--purple, #5C3792);
  outline-offset: 2px;
}
.consent-modal__title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink, #1F1633);
}
.consent-modal__lede {
  margin: 0 0 20px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-2, #4A4159);
}
.consent-modal__lede a {
  color: var(--purple, #5C3792);
  text-decoration: underline;
}
.consent-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.consent-row {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--cream, #FAF7F1);
}
.consent-row__head {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}
.consent-row__desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-2, #4A4159);
}

/* Toggle switch */
.consent-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.consent-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.consent-toggle__track {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  transition: background 0.18s ease;
  flex-shrink: 0;
}
.consent-toggle__dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.consent-toggle input:checked + .consent-toggle__track {
  background: var(--green-deep, #7FA13B);
}
.consent-toggle input:checked + .consent-toggle__track .consent-toggle__dot {
  transform: translateX(18px);
}
.consent-toggle input:focus-visible + .consent-toggle__track {
  box-shadow: 0 0 0 3px rgba(92, 55, 146, 0.35);
}
.consent-toggle.is-locked {
  cursor: not-allowed;
}
.consent-toggle.is-locked .consent-toggle__track {
  opacity: 0.7;
  background: var(--green-deep, #7FA13B);
}
.consent-toggle.is-locked .consent-toggle__dot {
  transform: translateX(18px);
}
.consent-toggle__label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink, #1F1633);
}

.consent-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 540px) {
  .consent-modal__panel {
    padding: 24px 20px 20px;
    max-height: 92vh;
  }
  .consent-modal__title {
    font-size: 1.25rem;
  }
  .consent-modal__actions {
    flex-direction: column-reverse;
  }
  .consent-modal__actions .consent-btn {
    width: 100%;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .consent-bar,
  .consent-modal,
  .consent-modal__panel,
  .consent-toggle__track,
  .consent-toggle__dot {
    transition: none !important;
  }
}
