/**
 * vlconsent — styles auto-portants (n'utilise pas Tailwind du thème pour
 * rester indépendant de la config tailwind.config.js du thème).
 *
 * Couleurs alignées sur la palette Veloland (--veloland-*).
 */

:root {
  --vlc-primary: #16a34a;
  --vlc-primary-dark: #15803d;
  --vlc-text: #1f2937;
  --vlc-muted: #6b7280;
  --vlc-bg: #ffffff;
  --vlc-bg-soft: #f9fafb;
  --vlc-border: #e5e7eb;
  --vlc-overlay: rgba(0, 0, 0, 0.55);
}

/* Hide pendant l'init JS — déjà via [hidden], rien à faire ici */
[data-vlconsent][hidden],
[data-vlconsent-banner][hidden],
[data-vlconsent-modal][hidden] {
  display: none !important;
}

/* Empêche le scroll du body quand la modal est ouverte */
body.vl-consent-locked {
  overflow: hidden;
}

/* === BANNIÈRE === */
.vl-consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  background: var(--vlc-bg);
  color: var(--vlc-text);
  border-top: 1px solid var(--vlc-border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
  padding: 1.25rem 1rem;
  font-family: inherit;
}

.vl-consent-banner__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .vl-consent-banner__inner {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }
}

.vl-consent-banner__text {
  flex: 1;
}

.vl-consent-banner__title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--vlc-text);
}

.vl-consent-banner__desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--vlc-muted);
}

.vl-consent-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .vl-consent-banner__actions {
    flex-wrap: nowrap;
  }
}

/* === MODAL === */
.vl-consent-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.vl-consent-modal__overlay {
  position: absolute;
  inset: 0;
  background: var(--vlc-overlay);
}

.vl-consent-modal__content {
  position: relative;
  background: var(--vlc-bg);
  color: var(--vlc-text);
  border-radius: 0.75rem;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.vl-consent-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--vlc-border);
  flex-shrink: 0;
}

.vl-consent-modal__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.vl-consent-modal__close {
  background: transparent;
  border: 0;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--vlc-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.vl-consent-modal__close:hover {
  color: var(--vlc-text);
  background: var(--vlc-bg-soft);
}

.vl-consent-modal__body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.vl-consent-modal__intro {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--vlc-muted);
  line-height: 1.5;
}

.vl-consent-modal__legal {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--vlc-border);
  font-size: 0.8125rem;
  color: var(--vlc-muted);
}

.vl-consent-modal__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  background: var(--vlc-bg-soft);
  border-top: 1px solid var(--vlc-border);
  flex-shrink: 0;
}

/* === CATÉGORIES === */
.vl-consent-cat {
  padding: 1rem;
  border: 1px solid var(--vlc-border);
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  background: var(--vlc-bg);
}

.vl-consent-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.vl-consent-cat__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--vlc-text);
}

.vl-consent-cat__badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: var(--vlc-bg-soft);
  color: var(--vlc-muted);
}

.vl-consent-cat__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--vlc-muted);
  line-height: 1.5;
}

/* === BOUTONS === */
.vl-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.25;
}

.vl-consent-btn:focus-visible {
  outline: 2px solid var(--vlc-primary);
  outline-offset: 2px;
}

.vl-consent-btn--primary {
  background: var(--vlc-primary);
  color: #fff;
  border-color: var(--vlc-primary);
}

.vl-consent-btn--primary:hover {
  background: var(--vlc-primary-dark);
  border-color: var(--vlc-primary-dark);
}

.vl-consent-btn--ghost {
  background: transparent;
  color: var(--vlc-text);
  border-color: var(--vlc-border);
}

.vl-consent-btn--ghost:hover {
  background: var(--vlc-bg-soft);
  border-color: var(--vlc-muted);
}

/* === TOGGLE === */
.vl-consent-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.vl-consent-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.vl-consent-toggle__slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background 0.2s;
  cursor: pointer;
}

.vl-consent-toggle__slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.vl-consent-toggle input:checked + .vl-consent-toggle__slider {
  background: var(--vlc-primary);
}

.vl-consent-toggle input:checked + .vl-consent-toggle__slider::before {
  transform: translateX(20px);
}

.vl-consent-toggle input:focus-visible + .vl-consent-toggle__slider {
  outline: 2px solid var(--vlc-primary);
  outline-offset: 2px;
}

/* === LIENS === */
.vl-consent-link {
  color: var(--vlc-primary);
  text-decoration: underline;
}

.vl-consent-link:hover {
  color: var(--vlc-primary-dark);
}

/* === A11Y helper === */
.vl-consent-modal .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
