/* ─────────────────────────────────────────────────────────────────
   FloodIA — Design variant UI
   Popup d'invitation + overlay de transition (circular reveal)
   ───────────────────────────────────────────────────────────────── */

/* ── Popup ──────────────────────────────────────────────────────── */
#dv-popup {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%) translateX(420px);
  width: 340px;
  padding: 22px 22px 20px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 12px 28px rgba(15, 23, 42, 0.18),
    0 32px 64px rgba(15, 23, 42, 0.12);
  border: 1px solid rgba(15, 23, 42, 0.06);
  z-index: 9000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  color: #0B1320;
  opacity: 0;
  transition:
    opacity 320ms cubic-bezier(.2, .8, .2, 1),
    transform 420ms cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}

#dv-popup.dv-popup-in {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

#dv-popup.dv-popup-out {
  opacity: 0;
  transform: translateY(-50%) translateX(60px);
}

#dv-popup::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(58, 138, 255, 0.10), transparent 60%);
  pointer-events: none;
  border-radius: 18px;
}

.dv-popup-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #5C6A7E;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms;
}

.dv-popup-close:hover {
  background: #EEF1F6;
  color: #0B1320;
}

.dv-popup-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #EEF4FF 0%, #E1ECFF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(58, 138, 255, 0.12);
}

.dv-popup-mark svg { width: 26px; height: 26px; }

.dv-popup-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1F66E0;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
}

.dv-popup-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #29B6F6;
  box-shadow: 0 0 0 3px rgba(41, 182, 246, 0.18);
  animation: dv-pulse 1.6s ease-in-out infinite;
}

@keyframes dv-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(41, 182, 246, 0.18); }
  50%      { box-shadow: 0 0 0 6px rgba(41, 182, 246, 0.05); }
}

.dv-popup-title {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: #0B1320;
}

.dv-popup-lede {
  font-size: 13px;
  line-height: 1.5;
  color: #5C6A7E;
  margin: 0 0 18px;
}

.dv-popup-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dv-popup-cta {
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #1F66E0 0%, #1248AC 100%);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 160ms, box-shadow 160ms, filter 160ms;
  box-shadow: 0 1px 2px rgba(31, 102, 224, 0.25), 0 6px 14px rgba(31, 102, 224, 0.20);
  font-family: inherit;
}

.dv-popup-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 2px 4px rgba(31, 102, 224, 0.30), 0 10px 22px rgba(31, 102, 224, 0.28);
}

.dv-popup-cta:active { transform: translateY(0); }

.dv-popup-later {
  width: 100%;
  padding: 9px 16px;
  border: 1px solid #E4E8EE;
  border-radius: 10px;
  background: #ffffff;
  color: #5C6A7E;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  font-family: inherit;
}

.dv-popup-later:hover {
  background: #F6F7F9;
  color: #0B1320;
}

@media (max-width: 720px) {
  #dv-popup {
    right: 16px;
    left: 16px;
    width: auto;
    transform: translateY(-50%) translateY(40px);
  }
  #dv-popup.dv-popup-in {
    transform: translateY(-50%) translateY(0);
  }
}

/* ── Transition overlay (circular reveal) ───────────────────────── */
#dv-overlay,
#dv-overlay-pre {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(41, 182, 246, 0.30) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(160, 192, 255, 0.18) 0%, transparent 60%),
    linear-gradient(135deg, #0E2340 0%, #1A3A6E 35%, #1F66E0 70%, #29B6F6 110%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  will-change: clip-path;
}

.dv-overlay-inner {
  text-align: center;
  color: #F2F5FA;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: dv-overlay-pop 700ms cubic-bezier(.2, .8, .2, 1);
}

@keyframes dv-overlay-pop {
  0%   { opacity: 0; transform: scale(0.92); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}

.dv-overlay-mark {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.30);
}

.dv-overlay-mark svg { width: 56px; height: 56px; }

.dv-overlay-brand {
  font-family: 'Fraunces', 'Inter Tight', Georgia, serif;
  font-size: 38px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.dv-overlay-msg {
  font-family: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(242, 245, 250, 0.72);
}

/* ── New design — toggle button styling ─────────────────────────── */
.dv-toggle-classic {
  background: linear-gradient(180deg, #ffffff 0%, #F6F7F9 100%) !important;
  border: 1px solid #E4E8EE !important;
  border-radius: 8px;
  padding: 6px 10px !important;
  font-weight: 500 !important;
  font-size: 12px !important;
  color: #1F2A3A !important;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

.dv-toggle-classic:hover {
  background: #FFFFFF !important;
  border-color: #C7CFDB !important;
}

/* Attention pulse — appliqué pendant 5s à l'arrivée depuis l'ancien design */
@keyframes dv-toggle-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(31, 102, 224, 0.45),
      0 1px 2px rgba(15, 23, 42, 0.08);
    transform: translateY(0);
  }
  50% {
    box-shadow:
      0 0 0 10px rgba(31, 102, 224, 0),
      0 4px 12px rgba(31, 102, 224, 0.30);
    transform: translateY(-1.5px);
  }
}

.dv-toggle-classic.dv-toggle-attention {
  animation: dv-toggle-pulse 1.4s cubic-bezier(.4, 0, .2, 1) infinite;
  border-color: #1F66E0 !important;
  background: linear-gradient(180deg, #FFFFFF 0%, #EEF4FF 100%) !important;
  color: #1248AC !important;
}

/* Tooltip "↩ Tu peux revenir ici à tout moment" — sous le bouton, fade in/out */
@keyframes dv-tooltip-pop {
  0%   { opacity: 0; transform: translateY(-6px) translateX(-50%) scale(.92); }
  20%  { opacity: 1; transform: translateY(0)    translateX(-50%) scale(1); }
  85%  { opacity: 1; transform: translateY(0)    translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateY(2px)  translateX(-50%) scale(.96); }
}

.dv-toggle-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 10px;
  background: #0E2340;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.005em;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.10),
    0 8px 20px rgba(15, 23, 42, 0.18);
  pointer-events: none;
  z-index: 1000;
  animation: dv-tooltip-pop 5.6s cubic-bezier(.4, 0, .2, 1) forwards;
}

.dv-toggle-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: #0E2340;
}

@media (prefers-reduced-motion: reduce) {
  .dv-toggle-classic.dv-toggle-attention { animation: none; }
  .dv-toggle-tooltip { animation: none; opacity: 1; }
}

/* ── Bouton "Nouveau design" dans l'ancien header ───────────────── */
.dv-switch-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  margin-right: 8px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #1F66E0 0%, #1248AC 100%);
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 160ms cubic-bezier(.2,.8,.2,1),
              box-shadow 160ms,
              filter 160ms;
  box-shadow:
    0 1px 2px rgba(31, 102, 224, 0.30),
    0 6px 16px rgba(31, 102, 224, 0.25);
  position: relative;
  overflow: hidden;
  font-family: inherit;
  white-space: nowrap;
}

.dv-switch-new-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  transition: transform 700ms cubic-bezier(.4, 0, .2, 1);
}

.dv-switch-new-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 2px 4px rgba(31, 102, 224, 0.35),
    0 12px 24px rgba(31, 102, 224, 0.32);
}

.dv-switch-new-btn:hover::before {
  transform: translateX(100%);
}

.dv-switch-new-btn:active { transform: translateY(0); }

/* Sur mobile, le nouveau design n'est pas optimisé — on cache l'invitation */
@media (max-width: 819px) {
  .dv-switch-new-btn { display: none !important; }
  #dv-popup { display: none !important; }
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #dv-popup,
  #dv-popup.dv-popup-in,
  #dv-popup.dv-popup-out {
    transition: opacity 200ms;
  }
  .dv-popup-dot { animation: none; }
  .dv-overlay-inner { animation: none; }
}
