
/* =========================================
   CYBRIX 3D — ASSISTANT CYB
   Interface cyberpunk
   Version avec formatage Markdown
========================================= */

#cyb-assistant,
#cyb-assistant * {
  box-sizing: border-box;
}

#cyb-assistant {
  --cyb-cyan: #27d7ff;
  --cyb-pink: #ff3dba;
  --cyb-green: #42ffb0;
  --cyb-bg: #080d18;
  --cyb-panel: #101a2b;

  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 99999;
  font-family: Arial, Helvetica, sans-serif;
  color: #f4f7ff;
}

/* =========================================
   BULLE D'OUVERTURE
========================================= */

.cyb-launcher {
  width: 66px;
  height: 66px;
  border: 2px solid var(--cyb-cyan);
  border-radius: 50%;
  background: linear-gradient(145deg, #101d32, #080d18);
  color: var(--cyb-cyan);
  font-size: 29px;
  cursor: pointer;

  box-shadow:
    0 0 12px rgba(39, 215, 255, .5),
    0 0 30px rgba(39, 215, 255, .2);

  transition: .25s ease;

  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cyb-launcher:hover {
  transform: translateY(-5px) scale(1.05);

  box-shadow:
    0 0 20px rgba(39, 215, 255, .8),
    0 0 45px rgba(39, 215, 255, .35);
}

.cyb-launcher::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(39, 215, 255, .35);
  border-radius: 50%;
  animation: cybPulse 2.2s infinite;
}

@keyframes cybPulse {
  0% {
    transform: scale(.9);
    opacity: .8;
  }

  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

/* =========================================
   FENÊTRE DE DISCUSSION
========================================= */

.cyb-window {
  position: absolute;
  right: 0;
  bottom: 82px;

  width: 370px;
  height: 520px;
  max-height: calc(100vh - 125px);

  background: var(--cyb-bg);
  border: 1px solid rgba(39, 215, 255, .55);
  border-radius: 17px;
  overflow: hidden;

  display: flex;
  flex-direction: column;

  box-shadow:
    0 0 25px rgba(39, 215, 255, .15),
    0 15px 55px rgba(0, 0, 0, .65);

  opacity: 0;
  visibility: hidden;

  transform: translateY(15px) scale(.97);
  transition: .25s ease;

  pointer-events: none;
}

.cyb-window.cyb-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* =========================================
   EN-TÊTE
========================================= */

.cyb-header {
  min-height: 76px;
  padding: 15px 17px;

  background: linear-gradient(110deg, #101e34, #171027);
  border-bottom: 1px solid rgba(39, 215, 255, .3);

  display: flex;
  align-items: center;
  gap: 12px;
}

.cyb-avatar {
  width: 43px;
  height: 43px;
  flex-shrink: 0;

  border-radius: 12px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 23px;
  color: var(--cyb-cyan);

  background: rgba(39, 215, 255, .1);
  border: 1px solid var(--cyb-cyan);

  box-shadow: 0 0 12px rgba(39, 215, 255, .2);
}

.cyb-heading {
  flex: 1;
  min-width: 0;
}

.cyb-heading strong {
  display: block;
  font-size: 15px;
  letter-spacing: 1.5px;
  color: white;
}

.cyb-heading span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--cyb-green);
}

.cyb-close {
  width: 32px;
  height: 32px;

  border: 0;
  background: transparent;

  color: #a8bad0;
  font-size: 23px;
  cursor: pointer;
}

.cyb-close:hover {
  color: var(--cyb-pink);
}

/* =========================================
   ZONE DES MESSAGES
========================================= */

.cyb-messages {
  flex: 1;
  min-height: 0;

  padding: 17px 13px;

  overflow-y: auto;

  display: flex;
  flex-direction: column;
  gap: 13px;

  scrollbar-width: thin;
  scrollbar-color: #294a68 transparent;

  overflow-wrap: anywhere;
}

/* Bulles générales */

.cyb-message {
  max-width: 88%;
  padding: 12px 14px;

  border-radius: 12px;

  font-size: 13px;
  line-height: 1.55;

  overflow-wrap: anywhere;
}

/* Messages de CYB */

.cyb-message-bot {
  align-self: flex-start;

  background: #121e30;
  border: 1px solid rgba(39, 215, 255, .22);
  border-bottom-left-radius: 3px;

  color: #e5f2ff;
}

/* Messages du client */

.cyb-message-user {
  align-self: flex-end;

  background: linear-gradient(110deg, #164b67, #35204d);
  border: 1px solid rgba(255, 61, 186, .35);
  border-bottom-right-radius: 3px;

  color: white;

  white-space: pre-wrap;
}

/* =========================================
   FORMATAGE DES RÉPONSES MARKDOWN
========================================= */

/* Paragraphes */

.cyb-message-bot p {
  margin: 0 0 13px;
  line-height: 1.65;
}

.cyb-message-bot p:last-child {
  margin-bottom: 0;
}

/* Texte en gras */

.cyb-message-bot strong {
  color: #ffffff;
  font-weight: 700;
}

/* Texte en italique */

.cyb-message-bot em {
  color: #bcefff;
}

/* Titres */

.cyb-message-bot h1,
.cyb-message-bot h2,
.cyb-message-bot h3 {
  color: var(--cyb-cyan);
  margin: 15px 0 10px;
  line-height: 1.4;
}

.cyb-message-bot h1 {
  font-size: 20px;
}

.cyb-message-bot h2 {
  font-size: 18px;
}

.cyb-message-bot h3 {
  font-size: 16px;
}

/* Listes */

.cyb-message-bot .cyb-markdown-list {
  padding-left: 23px;
  margin: 9px 0 14px;
  line-height: 1.7;
}

.cyb-message-bot .cyb-markdown-list li {
  margin-bottom: 5px;
}

.cyb-message-bot .cyb-markdown-list li::marker {
  color: var(--cyb-cyan);
}

/* Liens cliquables */

.cyb-message-bot a {
  color: var(--cyb-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  transition: color .2s ease;
}

.cyb-message-bot a:hover {
  color: var(--cyb-pink);
}

/* Code */

.cyb-message-bot code {
  color: #ff75dd;

  background: rgba(255, 255, 255, .08);

  padding: 2px 5px;
  border-radius: 4px;

  font-size: .9em;
}

/* Séparateurs */

.cyb-message-bot hr {
  border: 0;
  border-top: 1px solid rgba(54, 229, 255, .25);
  margin: 13px 0;
}

/* =========================================
   INDICATEUR DE RÉPONSE
========================================= */

.cyb-typing {
  align-self: flex-start;

  color: var(--cyb-cyan);
  font-size: 12px;

  padding: 8px 12px;
}

/* =========================================
   ZONE DE SAISIE
========================================= */

.cyb-input-area {
  padding: 12px;

  border-top: 1px solid rgba(39, 215, 255, .2);
  background: #0c1422;

  flex-shrink: 0;
}

.cyb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cyb-input {
  flex: 1;
  min-width: 0;
  height: 43px;

  padding: 0 13px;

  background: #101d30;
  border: 1px solid #29415d;
  border-radius: 9px;

  outline: none;

  color: white;
  font-size: 13px;
}

.cyb-input:focus {
  border-color: var(--cyb-cyan);
  box-shadow: 0 0 10px rgba(39, 215, 255, .15);
}

.cyb-input::placeholder {
  color: #8292a9;
}

.cyb-input:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* Bouton envoyer */

.cyb-send {
  width: 44px;
  height: 43px;
  flex-shrink: 0;

  border: 0;
  border-radius: 9px;

  background: linear-gradient(120deg, var(--cyb-cyan), #6685ff);
  color: #06101d;

  font-size: 19px;
  font-weight: bold;

  cursor: pointer;
  transition: .2s;
}

.cyb-send:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
}

.cyb-send:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

/* Signature */

.cyb-disclaimer {
  margin: 9px 0 0;

  color: #71839b;
  text-align: center;
  font-size: 10px;
}

/* =========================================
   ACCESSIBILITÉ
========================================= */

.cyb-launcher:focus-visible,
.cyb-close:focus-visible,
.cyb-send:focus-visible,
.cyb-input:focus-visible,
.cyb-message-bot a:focus-visible {
  outline: 2px solid var(--cyb-cyan);
  outline-offset: 3px;
}

/* =========================================
   MOBILE
========================================= */

@media (max-width: 480px) {
  #cyb-assistant {
    right: 14px;
    bottom: 14px;
  }

  .cyb-window {
    position: fixed;

    right: 10px;
    bottom: 90px;

    width: calc(100vw - 20px);

    height: min(520px, calc(100vh - 115px));
    max-height: calc(100vh - 115px);
  }

  @supports (height: 100dvh) {
    .cyb-window {
      height: min(520px, calc(100dvh - 115px));
      max-height: calc(100dvh - 115px);
    }
  }

  .cyb-launcher {
    width: 60px;
    height: 60px;
  }

  .cyb-message {
    max-width: 92%;
  }
}
