/* Mode auto — toggle Réglages + modale de validation + historique */

/* ── Card Réglages ─────────────────────────────────────────── */
.av-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}
.av-toggle-row + .av-toggle-row {
  border-top: 1px solid var(--separator);
}
.av-toggle-label {
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
}
.av-toggle-sub {
  font-size: 12px;
  color: var(--secondary);
  margin-top: 2px;
}
.av-pending-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #FF9500;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
}
.av-sticker-wrap {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px dashed var(--separator);
  border-radius: 10px;
  font-size: 12px;
  color: var(--secondary);
}
/* Cible UNIQUEMENT le <strong> titre (enfant direct) — sinon les <strong>
   en ligne dans le paragraphe ("QR Code", etc.) deviennent eux aussi des
   blocs et cassent la phrase en 3 lignes. */
.av-sticker-wrap > strong {
  display: block;
  color: var(--primary);
  margin-bottom: 4px;
}
.av-sticker-wrap p strong {
  color: var(--primary);
}
/* Si on remet une URL longue dans ce bloc plus tard, lui appliquer
   .av-sticker-url pour autoriser la coupure n'importe où. */
.av-sticker-url {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--blue, #007AFF);
  word-break: break-all;
}

/* iOS-style switch */
.av-switch {
  position: relative;
  width: 50px;
  height: 30px;
  flex-shrink: 0;
}
.av-switch input {
  /* Sticky-positioned absolute pour rester focusable + cliquable
     sans qu'il soit intercepté par le span slider qui le couvre.
     opacity:0 le rend invisible, mais l'input garde sa hit area
     via le label[for=...] (cf. fix bug toggle 2026-05-04). */
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.av-switch-slider { pointer-events: none; }
.av-switch-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 999px;
  transition: background .2s;
  cursor: pointer;
}
.av-switch-slider::before {
  content: '';
  position: absolute;
  width: 26px;
  height: 26px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.av-switch input:checked + .av-switch-slider { background: #34C759; }
.av-switch input:checked + .av-switch-slider::before { transform: translateX(20px); }

/* Input number max pts */
.av-max-pts {
  width: 70px;
  padding: 8px 10px;
  border: 1.5px solid var(--separator);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--primary);
  text-align: center;
}

/* Input texte étiquette plurielle ("kebabs", "tacos", "burgers"…) */
.av-item-label {
  width: 130px;
  padding: 8px 10px;
  border: 1.5px solid var(--separator);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--primary);
  text-align: center;
}

/* ── Modale (validation + historique) ──────────────────────── */
.av-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.av-modal.open { opacity: 1; pointer-events: auto; }

.av-modal-card {
  background: var(--surface, #fff);
  border-radius: 18px;
  width: min(420px, 92vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,.32);
  transform: scale(.94);
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.av-modal.open .av-modal-card { transform: scale(1); }
.av-modal-card--wide { width: min(560px, 94vw); }

.av-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--separator);
}
.av-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}
.av-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--secondary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* Pulse à côté du titre = signal "demande arrivée à l'instant" */
.av-modal-pulse {
  width: 10px;
  height: 10px;
  background: #FF9500;
  border-radius: 50%;
  margin-right: 8px;
  animation: av-pulse 1.4s infinite;
}
@keyframes av-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,149,0,.5); }
  50%      { box-shadow: 0 0 0 8px rgba(255,149,0,0); }
}

.av-modal-body {
  padding: 24px 20px;
  text-align: center;
  overflow-y: auto;
}
.av-pts-big {
  font-size: 72px;
  font-weight: 800;
  color: #007AFF;
  line-height: 1;
  margin-bottom: 4px;
}
.av-pts-label {
  font-size: 14px;
  color: var(--secondary);
  margin-bottom: 16px;
}
.av-client {
  font-size: 14px;
  color: var(--primary);
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
}

/* ── Encart "récompense débloquée" (visible si reward_to_unlock_id présent) ──
   Affiché entre .av-client et .av-modal-footer. CTA orange propre pour pousser
   "Valider + offrir le cadeau" sans concurrencer le bouton "Valider" classique
   (qui est dégradé en variante secondaire dans ce cas). */
.av-reward-unlock {
  margin-top: 16px;
  padding: 14px;
  background: linear-gradient(135deg, #FFF8E1, #FFEFC1);
  border: 1.5px solid #FFD968;
  border-radius: 14px;
  text-align: left;
}
.av-reward-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.av-reward-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}
.av-reward-info { flex: 1; min-width: 0; }
.av-reward-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: #B8860B;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}
.av-reward-title {
  font-size: 16px;
  font-weight: 700;
  color: #4A2C00;
  line-height: 1.2;
  word-wrap: break-word;
}
.av-reward-hint {
  font-size: 12px;
  color: #8D6E40;
  text-align: center;
  margin-top: 8px;
}
.av-btn-validate-redeem {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #FF9500, #FF7A00);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,122,0,.35);
  transition: transform .1s, box-shadow .15s, opacity .15s;
}
.av-btn-validate-redeem:hover { box-shadow: 0 6px 16px rgba(255,122,0,.45); }
.av-btn-validate-redeem:active { transform: scale(.98); }
.av-btn-validate-redeem:disabled { opacity: .55; cursor: wait; box-shadow: none; }

.av-modal-footer {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--separator);
}
.av-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.av-btn:active { transform: scale(.98); }
.av-btn:disabled { opacity: .55; cursor: wait; }
.av-btn-refuse {
  background: var(--bg);
  color: #FF3B30;
  border: 1.5px solid var(--separator);
}
.av-btn-validate {
  background: #34C759;
  color: #fff;
}
/* Variante secondaire : appliquée quand un cadeau est dispo, pour ne pas que
   "Valider sans cadeau" concurrence le CTA principal "+ cadeau" en intensité. */
.av-btn-validate--secondary {
  background: var(--bg);
  color: var(--primary);
  border: 1.5px solid var(--separator);
}

/* ── Historique ────────────────────────────────────────────── */
.av-history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--separator);
  text-align: left;
}
.av-history-row:last-child { border-bottom: none; }
.av-history-status {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}
.av-history-row--validated .av-history-status { background: #34C759; color: #fff; }
.av-history-row--refused   .av-history-status { background: #FF3B30; color: #fff; }
.av-history-info { flex: 1; min-width: 0; }
.av-history-name { font-size: 14px; font-weight: 500; color: var(--primary); }
.av-history-meta { font-size: 12px; color: var(--secondary); margin-top: 2px; }
.av-history-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
