/* DynoBot — Petit robot animé qui se déplace sur le site */

.dyno-bot {
  position: fixed;
  z-index: 9999;
  width: 56px;
  height: 56px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, filter 0.3s ease;
  will-change: left, top;
}

.dyno-bot:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 0 16px rgba(124, 58, 237, 0.5));
}

.dyno-bot:active {
  transform: scale(0.95);
}

.dyno-bot-body {
  width: 48px;
  height: 48px;
  background: linear-gradient(160deg, #6d28d9 0%, #7c3aed 40%, #8b5cf6 100%);
  border-radius: 14px;
  box-shadow:
    inset 0 2px 8px rgba(255, 255, 255, 0.3),
    inset 0 -2px 6px rgba(0, 0, 0, 0.2),
    0 6px 24px rgba(91, 33, 182, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dyno-bot-wiggle 2s ease-in-out infinite;
}

@keyframes dyno-bot-wiggle {

  0%,
  100% {
    transform: rotate(-2deg);
  }

  50% {
    transform: rotate(2deg);
  }
}

.dyno-bot-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dyno-bot-antenna {
  width: 2px;
  height: 8px;
  background: linear-gradient(to top, #a78bfa, #c4b5fd);
  border-radius: 1px;
  margin-bottom: 2px;
  animation: dyno-bot-blink 1.5s ease-in-out infinite;
}

@keyframes dyno-bot-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.dyno-bot-eyes {
  display: flex;
  gap: 6px;
}

.dyno-bot-eyes .eye {
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  animation: dyno-bot-eyes 3s ease-in-out infinite;
}

@keyframes dyno-bot-eyes {

  0%,
  90%,
  100% {
    transform: scaleY(1);
  }

  95% {
    transform: scaleY(0.15);
  }
}

/* Panneau chat */
.dyno-panel {
  position: fixed;
  bottom: 0;
  right: 24px;
  width: 800px;
  max-width: calc(100vw - 48px);
  max-height: 0;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.dyno-panel.open {
  max-height: 85vh;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.dyno-panel-inner {
  background: #fcfbfe;
  border-radius: 24px 24px 0 0;
  box-shadow:
    0 25px 50px rgba(91, 33, 182, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  font-family: 'Montserrat', sans-serif;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dyno-panel.open .dyno-panel-inner {
  transform: translateY(0);
}

.dyno-panel-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(91, 33, 182, 0.85) 0%, rgba(124, 58, 237, 0.9) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 16px;
  font-family: 'Montserrat Alternates', sans-serif;
}

#dyno-chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, transform 0.25s;
}

#dyno-chat-close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(90deg);
}

.dyno-panel-messages {
  height: 550px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dyno-panel-messages .dyno-msg {
  max-width: 88%;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  animation: dyno-msg-appear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dyno-msg-appear {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dyno-panel-messages .dyno-msg.bot {
  align-self: flex-start;
  background: linear-gradient(145deg, #f5f3ff 0%, #ede9fe 100%);
  color: #1e1b2e;
  border-radius: 20px 20px 20px 6px;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.06);
}

.dyno-panel-messages .dyno-msg.user {
  align-self: flex-end;
  background: linear-gradient(145deg, #6d28d9 0%, #7c3aed 50%, #8b5cf6 100%);
  color: white;
  border-radius: 20px 20px 6px 20px;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}

.dyno-panel-messages .dyno-msg p {
  margin: 0;
  word-wrap: break-word;
  line-height: 1.65;
}

.dyno-panel-messages .dyno-msg strong {
  font-weight: 700;
}

.dyno-panel-messages .dyno-msg em {
  font-style: italic;
}

.dyno-panel-messages .dyno-msg code {
  background: rgba(124, 58, 237, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.dyno-panel-messages .dyno-msg a {
  color: #7c3aed;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dyno-panel-messages .dyno-msg a:hover {
  color: #5b21b6;
}

.dyno-panel-messages .dyno-msg.user a {
  color: rgba(255, 255, 255, 0.95);
}

.dyno-panel-messages .dyno-msg.user code {
  background: rgba(255, 255, 255, 0.25);
}

.dyno-panel-messages .dyno-msg.typing {
  align-self: flex-start;
  padding: 14px 24px;
  background: linear-gradient(145deg, #f5f3ff 0%, #ede9fe 100%);
  border-radius: 20px 20px 20px 6px;
}

.dyno-panel-messages .dyno-msg.typing .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #7c3aed;
  border-radius: 50%;
  margin: 0 2px;
  animation: dyno-dot 1.4s ease-in-out infinite both;
}

.dyno-panel-messages .dyno-msg.typing .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.dyno-panel-messages .dyno-msg.typing .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dyno-dot {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.dyno-panel-input {
  padding: 16px 20px 24px;
  position: relative;
  display: block;
}

.dyno-panel-input input {
  width: 100%;
  padding: 16px 60px 16px 24px;
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 30px;
  font-size: 14px;
  font-family: 'Montserrat', sans-serif;
  outline: none;
  background: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  transition: border-color 0.25s, box-shadow 0.25s;
  box-sizing: border-box;
}

.dyno-panel-input input:focus {
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.08);
}

.dyno-panel-input button {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6d28d9 0%, #7c3aed 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s, box-shadow 0.25s, background 0.25s;
}

.dyno-panel-input button:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.dyno-panel-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.dyno-bot.dyno-bot-above {
  pointer-events: auto;
}

@media (max-width: 480px) {
  .dyno-bot {
    width: 48px;
    height: 48px;
  }

  .dyno-bot-body {
    width: 42px;
    height: 42px;
  }

  .dyno-panel {
    right: 0;
    width: 100%;
    max-width: none;
  }

  .dyno-panel-inner {
    border-radius: 24px 24px 0 0;
  }

  .dyno-panel-messages {
    height: 450px;
  }
}