/* Assistant Yovo — widget bas gauche */
.yovo-chat-root {
  --yovo-chat-blue: #1d4ed8;
  --yovo-chat-blue-deep: #0f2d99;
  --yovo-chat-gap: 12px;
  position: fixed;
  left: max(12px, env(safe-area-inset-left, 0px));
  bottom: max(12px, env(safe-area-inset-bottom, 0px));
  z-index: 99990;
  font-family: Montserrat, system-ui, -apple-system, sans-serif;
  box-sizing: border-box;
  pointer-events: none;
}

.yovo-chat-root *,
.yovo-chat-root *::before,
.yovo-chat-root *::after {
  box-sizing: border-box;
}

.yovo-chat-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(15, 23, 42, 0.35);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.yovo-chat-root.is-open .yovo-chat-backdrop {
  display: block;
  opacity: 1;
}

.yovo-chat-toggle {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  padding: 0;
  background: linear-gradient(135deg, var(--yovo-chat-blue), var(--yovo-chat-blue-deep));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(29, 78, 216, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.yovo-chat-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(29, 78, 216, 0.4);
}

.yovo-chat-root.is-open .yovo-chat-toggle {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.85);
}

.yovo-chat-toggle-emoji {
  font-size: 26px;
  line-height: 1;
}

.yovo-chat-panel {
  --yovo-chat-vv-offset: 0px;
  --yovo-chat-vv-height: 100dvh;
  position: absolute;
  left: 0;
  bottom: calc(56px + var(--yovo-chat-gap));
  z-index: 3;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100dvh - 100px));
  max-height: calc(100dvh - 88px);
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 20px 56px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transform-origin: bottom left;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease;
}

.yovo-chat-root.is-open .yovo-chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.yovo-chat-panel[aria-hidden="true"] {
  pointer-events: none;
}

.yovo-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--yovo-chat-blue), var(--yovo-chat-blue-deep));
  color: #fff;
}

.yovo-chat-header-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0;
  color: #fff;
}

.yovo-chat-header-sub {
  font-size: 11px;
  opacity: 0.9;
  margin: 2px 0 0;
  color: #fff;
}

.yovo-chat-close {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.yovo-chat-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.yovo-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
}

.yovo-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 8px;
  flex: 0 0 auto;
}

.yovo-chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.yovo-chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e8eef5;
  color: #1a1a1a;
}

.yovo-chat-msg--user {
  align-self: flex-end;
  background: #1d4ed8;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.yovo-chat-msg--typing {
  opacity: 0.7;
  font-style: italic;
}

.yovo-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 14px 14px;
  background: #f8fafc;
}

.yovo-chat-suggestion {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: var(--yovo-chat-blue-deep);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.yovo-chat-suggestion:hover {
  background: #dbeafe;
}

.yovo-chat-composer {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #eee;
  padding-bottom: max(0px, var(--yovo-chat-vv-offset, 0px));
}

.yovo-chat-form {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px;
  margin: 0;
  background: #fff;
  align-items: flex-end;
}

.yovo-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px; /* évite le zoom iOS */
  font-family: inherit;
  resize: none;
  min-height: 42px;
  max-height: 100px;
  color: #1a1a1a;
  background: #fff;
  outline: none;
  line-height: 1.35;
}

.yovo-chat-input:focus {
  border-color: var(--yovo-chat-blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.yovo-chat-send {
  border: none;
  border-radius: 10px;
  background: var(--yovo-chat-blue);
  color: #fff;
  font-weight: 700;
  padding: 0 14px;
  min-height: 42px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.yovo-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.yovo-chat-footer-note {
  flex-shrink: 0;
  padding: 0 12px 10px;
  margin: 0;
  font-size: 10px;
  color: #888;
  text-align: center;
  background: #fff;
}

/* Mobile : feuille plein écran + clavier */
@media (max-width: 640px) {
  .yovo-chat-root {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    padding: 0 max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  }

  .yovo-chat-toggle {
    margin-left: 0;
  }

  .yovo-chat-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--yovo-chat-vv-offset, 0px);
    width: 100%;
    height: min(88dvh, var(--yovo-chat-vv-height, 88dvh));
    max-height: min(
      calc(100dvh - env(safe-area-inset-top, 0px) - 12px),
      var(--yovo-chat-vv-height, 100dvh)
    );
    border-radius: 20px 20px 0 0;
    border: none;
    border-top: 1px solid #e8e8e8;
    transform: translateY(100%);
    transform-origin: bottom center;
    padding-bottom: 0;
  }

  .yovo-chat-root.is-open .yovo-chat-panel {
    transform: translateY(0);
  }

  .yovo-chat-header {
    padding-top: max(14px, env(safe-area-inset-top, 0px));
  }

  .yovo-chat-composer {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .yovo-chat-panel,
  .yovo-chat-backdrop,
  .yovo-chat-toggle {
    transition: none;
  }
}

html.yovo-chat-lock,
body.yovo-chat-lock {
  overflow: hidden;
  overscroll-behavior: none;
}
