/* =====================================================================
   PLG Julie - styles du script hote WordPress (corporate.groupeplg.com)
   v1.0.0. Reprend la feuille de style du site B2B (bloc Drupal), avec :
     - z-index au-dessus de l'en-tete fixe Divi, sous le bandeau OneTrust
     - position de la bulle sur mobile pilotee par --plg-julie-mobile-bottom
     - fenetre limitee a la hauteur de l'ecran sur ordinateur
     - neutralisation des styles du theme sur les boutons et liens
     - focus clavier visible, animations coupees si l'utilisateur le demande
   ===================================================================== */

/* ---------- Protection anti-flash (dimensions max, sans couper le halo) ---------- */
#plg-widget-bubble {
  max-width: 76px !important;
  max-height: 76px !important;
  width: 76px !important;
  height: 76px !important;
}

#plg-bubble-avatar {
  max-width: 76px !important;
  max-height: 76px !important;
  width: 100% !important;
  height: auto !important;
  display: block !important;
}

/* ---------- Neutralisation des styles du theme ---------- */
#plg-widget-bubble,
#plg-widget-bubble *,
#plg-widget-choice,
#plg-widget-choice *,
#plg-widget-label,
#plg-widget-close {
  box-sizing: border-box;
}

#plg-widget-choice button,
#plg-widget-close,
#plg-bubble-dismiss {
  text-transform: none !important;
  min-height: 0 !important;
  min-width: 0 !important;
}

#plg-widget-close,
#plg-widget-choice .plg-choice-close {
  padding: 0 !important;
  line-height: 1 !important;
}

#plg-widget-close {
  font-family: Arial, Helvetica, sans-serif !important;
}

#plg-widget-choice a.plg-choice-item,
#plg-widget-choice a.plg-choice-item:hover,
#plg-widget-choice a.plg-choice-item:focus {
  text-decoration: none !important;
}

#plg-widget-choice svg,
#plg-widget-bubble svg {
  display: inline-block;
  vertical-align: middle;
}

/* ---------- Bulle fermee : cercle blanc et halo bleu ---------- */
#plg-bubble-btn {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06),
              0 8px 24px rgba(0, 62, 231, 0.12);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: plg-pulse 5s ease-in-out infinite;
  z-index: 2;
}

@keyframes plg-pulse {
  0%, 90%, 100% { transform: scale(1); }
  94%, 97%      { transform: scale(1.05); }
}

#plg-bubble-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08),
              0 12px 32px rgba(0, 62, 231, 0.22);
  animation: none;
}

#plg-bubble-avatar {
  object-fit: contain;
  object-position: bottom center;
  margin-bottom: -2px;
}

#plg-bubble-glow {
  position: absolute;
  top: -28px;
  left: -28px;
  right: -28px;
  bottom: -28px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 62, 231, 0.22) 0%, rgba(0, 62, 231, 0.08) 40%, rgba(0, 62, 231, 0) 70%);
  pointer-events: none;
  z-index: 1;
}

#plg-bubble-btn.plg-bubble-fallback {
  align-items: center !important;
  background: linear-gradient(135deg, #003ee7 0%, #1e40af 100%);
}
#plg-bubble-btn.plg-bubble-fallback::before {
  content: "";
  display: block;
  width: 32px;
  height: 32px;
  background-color: white;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cpath%20d='M20%202H4c-1.1%200-2%20.9-2%202v18l4-4h14c1.1%200%202-.9%202-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E") no-repeat center;
          mask: url("data:image/svg+xml,%3Csvg%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3E%3Cpath%20d='M20%202H4c-1.1%200-2%20.9-2%202v18l4-4h14c1.1%200%202-.9%202-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E") no-repeat center;
}

/* ---------- Croix de fermeture de la bulle (mobile uniquement) ---------- */
#plg-bubble-dismiss {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 5;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #e0e7ff;
  padding: 0;
  margin: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.18);
}

#plg-bubble-dismiss svg {
  width: 11px;
  height: 11px;
  fill: #6b7280;
}

/* ---------- Infobulle : a gauche de la bulle, une ligne, en gras ---------- */
#plg-widget-label {
  position: fixed;
  bottom: 48px;
  right: 130px;
  z-index: 1000004;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04),
              0 12px 32px rgba(0, 62, 231, 0.10);
  opacity: 0;
  transform: translateX(8px);
  animation: plg-label-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) 1.5s forwards,
             plg-label-out 0.4s ease-in 9.5s forwards;
  pointer-events: none;
}

#plg-widget-label::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -7px;
  margin-top: -7px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  transform: rotate(45deg);
  box-shadow: 2px -2px 4px rgba(0, 62, 231, 0.04);
}

.plg-label-text {
  font-family: 'Helvetica Now', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.3;
  letter-spacing: -0.005em;
  text-align: left;
  white-space: nowrap;
}

@keyframes plg-label-in {
  to { opacity: 1; transform: translateX(0); }
}
@keyframes plg-label-out {
  to { opacity: 0; transform: translateX(4px); }
}

/* ---------- Ecran de choix ---------- */
#plg-widget-choice {
  flex-direction: column;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 360px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04),
              0 20px 60px rgba(0, 62, 231, 0.18);
  z-index: 1000002;
  overflow: hidden;
  animation: plg-choice-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Helvetica Now', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  line-height: 1.4;
  text-align: left;
}

@keyframes plg-choice-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.plg-choice-header {
  position: relative;
  background: linear-gradient(135deg, #003ee7 0%, #1e40af 100%);
  padding: 20px 56px 20px 20px;
  overflow: hidden;
}

.plg-choice-header::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.plg-choice-header-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.plg-choice-avatar-wrap {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.plg-choice-avatar {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: bottom center;
  margin-bottom: -2px;
}

.plg-choice-header-text {
  flex: 1;
  min-width: 0;
}

.plg-choice-greeting {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
  display: flex;
  align-items: center;
}

.plg-choice-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-left: 10px;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.30);
  animation: plg-dot-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes plg-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.30); }
  50%      { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.10); }
}

.plg-choice-role {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.90);
  margin-top: 4px;
  font-weight: 500;
}

.plg-choice-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, opacity 0.2s ease;
  opacity: 0.85;
}
.plg-choice-close:hover {
  background: rgba(255, 255, 255, 0.30);
  opacity: 1;
}
.plg-choice-close svg {
  width: 14px;
  height: 14px;
  fill: #ffffff;
}

.plg-choice-body {
  padding: 18px 20px 18px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.plg-choice-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  line-height: 1.4;
  letter-spacing: -0.005em;
  margin: 2px 0 12px;
  padding: 0 2px;
}

.plg-choice-btn-main {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  background: linear-gradient(180deg, rgba(0, 62, 231, 0.04) 0%, rgba(0, 62, 231, 0.08) 100%);
  border: 1.5px solid #003ee7;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #003ee7;
  text-decoration: none;
  text-align: left;
  letter-spacing: -0.005em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0;
}

.plg-choice-btn-main:hover {
  background: linear-gradient(135deg, #003ee7 0%, #0036cc 100%);
  border-color: #003ee7;
  color: white;
  box-shadow: 0 6px 16px rgba(0, 62, 231, 0.30);
  transform: translateY(-1px);
}

.plg-choice-btn-main .plg-choice-icon {
  width: 20px;
  height: 20px;
  fill: #003ee7;
  flex-shrink: 0;
  transition: fill 0.2s;
}
.plg-choice-btn-main:hover .plg-choice-icon {
  fill: white;
}

.plg-choice-btn-text {
  flex: 1;
  line-height: 1.3;
  white-space: normal;
}

.plg-choice-btn-main .plg-choice-arrow {
  width: 16px;
  height: 16px;
  fill: #003ee7;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), fill 0.2s;
}
.plg-choice-btn-main:hover .plg-choice-arrow {
  transform: translateX(4px);
  fill: white;
}

.plg-choice-list {
  display: flex;
  flex-direction: column;
}

.plg-choice-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-top: 1px solid #f0f2f5;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: #003ee7;
  text-decoration: none;
  text-align: left;
  letter-spacing: -0.005em;
  transition: background 0.15s, color 0.15s;
  border-radius: 8px;
}

.plg-choice-item:hover {
  background: rgba(0, 62, 231, 0.05);
  color: #0036cc;
}

.plg-choice-item .plg-choice-icon {
  width: 20px;
  height: 20px;
  fill: #003ee7;
  flex-shrink: 0;
  transition: fill 0.15s;
}

.plg-choice-item-text {
  flex: 1;
  line-height: 1.3;
}

.plg-choice-item .plg-choice-arrow {
  width: 16px;
  height: 16px;
  fill: #003ee7;
  flex-shrink: 0;
  opacity: 0.5;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s;
}

.plg-choice-item:hover .plg-choice-arrow {
  transform: translateX(3px);
  opacity: 1;
}

/* ---------- Focus clavier visible ---------- */
#plg-bubble-btn:focus-visible,
#plg-bubble-dismiss:focus-visible,
#plg-widget-close:focus-visible,
#plg-widget-choice button:focus-visible,
#plg-widget-choice a:focus-visible {
  outline: 3px solid #003ee7 !important;
  outline-offset: 3px !important;
}
#plg-widget-choice .plg-choice-close:focus-visible {
  outline-color: #ffffff !important;
}

/* ---------- Ordinateur : la fenetre ne depasse jamais l'ecran ---------- */
@media (min-width: 769px) {
  #plg-widget-frame {
    max-height: calc(100vh - 24px) !important;
  }
}

/* ---------- Mobile (768 px et moins) ---------- */
@media (max-width: 768px) {
  #plg-widget-label { display: none !important; }

  #plg-widget-bubble {
    bottom: var(--plg-julie-mobile-bottom, 24px) !important;
    right: 16px !important;
    overflow: visible !important;
  }

  #plg-bubble-dismiss {
    display: flex !important;
  }

  #plg-widget-close {
    bottom: var(--plg-julie-mobile-bottom, 24px) !important;
    right: 16px !important;
    top: auto !important;
  }

  #plg-widget-choice {
    width: calc(100% - 32px) !important;
    max-width: 400px !important;
    bottom: 24px !important;
    right: 16px !important;
    left: 16px !important;
    margin: 0 auto !important;
  }

  #plg-widget-frame {
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 0 !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
  }

  #plg-widget-close[style*="display: flex"],
  #plg-widget-close[style*="display:flex"] {
    bottom: auto !important;
    top: 16px !important;
    right: 16px !important;
    z-index: 1000003 !important;
  }
}

/* ---------- Animations coupees si l'utilisateur le demande ---------- */
@media (prefers-reduced-motion: reduce) {
  #plg-bubble-btn,
  .plg-choice-dot,
  #plg-widget-choice {
    animation: none !important;
  }
  #plg-widget-label {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}
