/* ============================================
   PetsHouse — Bannière cookies (mobile-first)
   ============================================ */

/* ---- Overlay ---- */
#cookie-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  /* visibility passe à hidden après la fin de la transition opacity (0.3s) */
  transition: opacity .3s ease, visibility 0s linear .3s;
}
#cookie-overlay.visible {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  /* visibility passe à visible immédiatement (pas de délai) */
  transition: opacity .3s ease, visibility 0s linear 0s;
}

/* ---- Bottom sheet ---- */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,.14);
  z-index: 1001;
  transform: translateY(100%);
  transition: transform .4s cubic-bezier(.16,1,.3,1);
  max-height: 90vh;
  overflow-y: auto;
}
#cookie-banner.visible {
  transform: translateY(0);
}

/* ---- Inner wrapper ---- */
.cookie-banner__inner {
  padding: 1.75rem 1.25rem 2rem;
  max-width: 520px;
  margin-inline: auto;
}

/* ---- Cookie icon ---- */
.cookie-banner__icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

/* ---- Text ---- */
.cookie-banner__text {
  font-size: .875rem;
  color: var(--color-text, #1A1A2E);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  text-align: left; /* Figma : texte aligné à gauche, pas centré */
}
.cookie-banner__text strong {
  color: var(--color-text, #1A1A2E);
}
.cookie-banner__text a {
  color: var(--color-primary, #C25700);
  text-decoration: underline;
}

/* ---- Action buttons row ---- */
.cookie-banner__actions {
  display: flex;
  gap: .75rem;
  margin-bottom: .875rem;
}
.cookie-btn {
  flex: 1;
  padding: .75rem 1rem;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s ease, color .2s ease;
  text-align: center;
  border: 2px solid #1A1A2E;
}
.cookie-btn--accept {
  background: #1A1A2E;
  color: #fff;
}
.cookie-btn--accept:hover { background: #000; }
.cookie-btn--refuse {
  background: #fff;
  color: #1A1A2E;
}
.cookie-btn--refuse:hover { background: #F1F5F9; }

/* ---- Manage link ---- */
.cookie-banner__manage-link {
  display: block;
  text-align: center;
  font-size: .875rem;
  font-weight: 700;
  color: var(--color-text, #1A1A2E);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  width: 100%;
  padding: .25rem 0;
}
.cookie-banner__manage-link:hover { color: var(--color-primary, #C25700); }

/* ---- Management view ---- */
.cookie-mgmt__back {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: .875rem;
  color: var(--color-text-muted, #64748B);
  cursor: pointer;
  padding: 0;
  margin-bottom: 1rem;
  transition: color .2s;
}
.cookie-mgmt__back:hover { color: var(--color-text, #1A1A2E); }

.cookie-mgmt__toggles {
  display: flex;
  flex-direction: column;
  gap: .625rem;
  margin-bottom: 1.25rem;
}
.cookie-mgmt__toggle-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.cookie-mgmt__toggle-label {
  flex: 1;
  background: #F1F5F9;
  border-radius: 999px;
  padding: .625rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  color: var(--color-text, #1A1A2E);
}

/* Toggle switch */
.cookie-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.cookie-toggle__slider {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s ease;
}
.cookie-toggle__slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform .2s ease;
}
.cookie-toggle input:checked + .cookie-toggle__slider {
  background: var(--color-primary, #C25700);
}
.cookie-toggle input:checked + .cookie-toggle__slider::before {
  transform: translateX(22px);
}
.cookie-toggle input:disabled + .cookie-toggle__slider {
  opacity: .7;
  cursor: not-allowed;
}

/* ---- Toggle verrouillé (cookies nécessaires — toujours actif) ---- */
/*
 * Surcharge input:disabled qui ajoute opacity:.7 — on force orange plein + opaque.
 * .cookie-toggle--locked est ajouté dynamiquement par buildManagementView().
 */
.cookie-toggle--locked .cookie-toggle__slider {
  background: var(--color-primary, #C25700) !important;
  opacity: 1 !important;
  cursor: not-allowed;
}
.cookie-toggle--locked input {
  pointer-events: none;
}

/* ---- Tag "(obligatoire)" — affiché en orange dans le label nécessaire ---- */
.cookie-mgmt__required-tag {
  display: inline-block;
  margin-left: .35rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--color-primary, #C25700);
  opacity: .85;
}

/* ---- Consequences text ---- */
.cookie-mgmt__consequences {
  font-size: .78rem;
  color: var(--color-text-muted, #64748B);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

/* ---- Management action buttons ---- */
.cookie-mgmt__actions-row {
  display: flex;
  gap: .75rem;
  margin-bottom: .75rem;
}
.cookie-mgmt__actions-row .cookie-btn { flex: 1; }
.cookie-btn--essential {
  display: block;
  width: 100%;
  padding: .7rem 1rem;
  border-radius: 999px;
  border: 2px solid #1A1A2E;
  background: #fff;
  color: #1A1A2E;
  font-size: .875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background .2s ease;
}
.cookie-btn--essential:hover { background: #F1F5F9; }

/* ---- Reopen button ---- */
#cookie-reopen-btn {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  background: var(--color-secondary, #0972C8);
  color: white;
  border-radius: 8px;
  padding: .5rem .875rem;
  font-size: .8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .375rem;
  z-index: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease, background .2s ease;
  border: none;
  font-family: inherit;
}
#cookie-reopen-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#cookie-reopen-btn:hover { background: var(--color-primary, #C25700); }
#cookie-reopen-btn svg { width: 14px; height: 14px; }

/* Desktop adjustments */
@media (min-width: 769px) {
  .cookie-banner__inner {
    padding: 2rem 2rem 2.25rem;
  }
}

/* Sur mobile, le bouton "Gérer les cookies" doit être AU-DESSUS de la bottom nav (64px) */
@media (max-width: 768px) {
  #cookie-reopen-btn {
    bottom: calc(64px + 0.75rem);
    left: 1rem;
  }
}
