/* =========================================================
   BLOXY AI CHATBOT
   Dark glass / purple design
========================================================= */

:root {
  --bloxy-ai-bg-start: #1b1b2a;
  --bloxy-ai-bg-end: #09090f;

  --bloxy-ai-purple: #7c3aed;
  --bloxy-ai-purple-dark: #4f46e5;
  --bloxy-ai-purple-light: #a78bfa;

  --bloxy-ai-text: #f8fafc;
  --bloxy-ai-text-muted: #a1a1aa;

  --bloxy-ai-border: rgba(255, 255, 255, 0.08);
  --bloxy-ai-glass: rgba(255, 255, 255, 0.05);
  --bloxy-ai-glass-hover: rgba(255, 255, 255, 0.08);

  --bloxy-ai-shadow:
    0 25px 70px rgba(0, 0, 0, 0.45);

  --bloxy-ai-radius: 24px;
}


/* =========================================================
   LAUNCHER
========================================================= */

.bloxy-ai-launcher {
  position: fixed;

  right: 24px;
  bottom: 24px;

  width: 58px;
  height: 58px;

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

  border: 1px solid rgba(255, 255, 255, 0.12);

  border-radius: 50%;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      var(--bloxy-ai-purple),
      var(--bloxy-ai-purple-dark)
    );

  box-shadow:
    0 12px 35px rgba(79, 70, 229, 0.35),
    0 0 0 1px rgba(124, 58, 237, 0.15);

  cursor: pointer;

  z-index: 99998;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}


.bloxy-ai-launcher:hover {
  transform: translateY(-3px) scale(1.04);

  box-shadow:
    0 16px 42px rgba(79, 70, 229, 0.45),
    0 0 25px rgba(124, 58, 237, 0.18);
}


.bloxy-ai-launcher:active {
  transform: scale(0.96);
}


.bloxy-ai-launcher svg {
  width: 28px;
  height: 28px;
}


/* =========================================================
   CHAT WINDOW
========================================================= */

.bloxy-ai-window {
  position: fixed;

  right: 24px;
  bottom: 94px;

  width: 390px;
  max-width: calc(100vw - 32px);

  height: 610px;
  max-height: calc(100vh - 120px);

  display: flex;
  flex-direction: column;

  overflow: hidden;

  border:
    1px solid var(--bloxy-ai-border);

  border-radius:
    var(--bloxy-ai-radius);

  background:
    radial-gradient(
      circle at top right,
      rgba(124, 58, 237, 0.12),
      transparent 35%
    ),
    radial-gradient(
      circle at bottom left,
      rgba(79, 70, 229, 0.08),
      transparent 40%
    ),
    linear-gradient(
      145deg,
      rgba(27, 27, 42, 0.96),
      rgba(9, 9, 15, 0.98)
    );

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  box-shadow:
    var(--bloxy-ai-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);

  opacity: 0;
  visibility: hidden;

  transform:
    translateY(15px)
    scale(0.97);

  transform-origin:
    bottom right;

  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;

  z-index: 99999;
}


.bloxy-ai-window.is-open {
  opacity: 1;
  visibility: visible;

  transform:
    translateY(0)
    scale(1);
}


/* =========================================================
   HEADER
========================================================= */

.bloxy-ai-header {
  min-height: 70px;

  display: flex;
  align-items: center;

  padding:
    14px 16px;

  border-bottom:
    1px solid rgba(255, 255, 255, 0.06);

  background:
    rgba(255, 255, 255, 0.025);

  flex-shrink: 0;
}


/* =========================================================
   AVATAR
========================================================= */

.bloxy-ai-avatar {
  width: 40px;
  height: 40px;

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

  margin-right: 11px;

  border-radius: 13px;

  color: #fff;

  font-size: 19px;

  background:
    linear-gradient(
      135deg,
      var(--bloxy-ai-purple),
      var(--bloxy-ai-purple-dark)
    );

  box-shadow:
    0 5px 18px rgba(124, 58, 237, 0.3);
}


/* =========================================================
   TITLE
========================================================= */

.bloxy-ai-title {
  min-width: 0;

  display: flex;
  flex-direction: column;

  gap: 3px;
}


.bloxy-ai-title strong {
  color:
    var(--bloxy-ai-text);

  font-size: 15px;
  font-weight: 650;

  line-height: 1.2;
}


.bloxy-ai-status {
  color:
    var(--bloxy-ai-text-muted);

  font-size: 11px;

  line-height: 1.2;
}


/* =========================================================
   CLOSE BUTTON
========================================================= */

.bloxy-ai-close {
  width: 34px;
  height: 34px;

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

  margin-left: auto;

  border: 0;
  border-radius: 10px;

  color:
    var(--bloxy-ai-text-muted);

  background:
    transparent;

  font-size: 25px;
  font-weight: 300;

  line-height: 1;

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}


.bloxy-ai-close:hover {
  color:
    var(--bloxy-ai-text);

  background:
    rgba(255, 255, 255, 0.07);
}


/* =========================================================
   MESSAGES
========================================================= */

.bloxy-ai-messages {
  flex: 1;

  min-height: 0;

  overflow-y: auto;

  padding:
    18px 15px;

  scroll-behavior: smooth;

  scrollbar-width: thin;

  scrollbar-color:
    rgba(124, 58, 237, 0.45)
    transparent;
}


.bloxy-ai-messages::-webkit-scrollbar {
  width: 5px;
}


.bloxy-ai-messages::-webkit-scrollbar-track {
  background:
    transparent;
}


.bloxy-ai-messages::-webkit-scrollbar-thumb {
  border-radius: 10px;

  background:
    rgba(124, 58, 237, 0.45);
}


.bloxy-ai-messages::-webkit-scrollbar-thumb:hover {
  background:
    rgba(124, 58, 237, 0.7);
}


/* =========================================================
   MESSAGE
========================================================= */

.bloxy-ai-message {
  width: fit-content;
  max-width: 84%;

  margin-bottom: 11px;

  padding:
    10px 13px;

  border-radius: 16px;

  color:
    var(--bloxy-ai-text);

  font-size: 13px;

  line-height: 1.55;

  word-break: break-word;

  animation:
    bloxyAiMessageIn
    0.2s ease;
}


@keyframes bloxyAiMessageIn {

  from {
    opacity: 0;
    transform: translateY(5px);
  }

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

}


/* =========================================================
   ASSISTANT MESSAGE
========================================================= */

.bloxy-ai-message.assistant {
  margin-right: auto;

  border:
    1px solid rgba(255, 255, 255, 0.07);

  border-top-left-radius: 6px;

  background:
    rgba(255, 255, 255, 0.055);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}


/* =========================================================
   USER MESSAGE
========================================================= */

.bloxy-ai-message.user {
  margin-left: auto;

  border:
    1px solid rgba(124, 58, 237, 0.25);

  border-top-right-radius: 6px;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      rgba(124, 58, 237, 0.88),
      rgba(79, 70, 229, 0.88)
    );

  box-shadow:
    0 5px 18px rgba(79, 70, 229, 0.12);
}


/* =========================================================
   ACTIVATION PANEL
========================================================= */

.bloxy-ai-activation {
  margin:
    0 15px 15px;

  padding:
    24px 20px;

  text-align: center;

  border:
    1px solid rgba(124, 58, 237, 0.18);

  border-radius: 20px;

  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(124, 58, 237, 0.14),
      transparent 65%
    ),
    rgba(255, 255, 255, 0.035);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035);

  flex-shrink: 0;
}


.bloxy-ai-activation-icon {
  width: 48px;
  height: 48px;

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

  margin:
    0 auto 13px;

  border-radius: 15px;

  color: #fff;

  font-size: 21px;

  background:
    linear-gradient(
      135deg,
      var(--bloxy-ai-purple),
      var(--bloxy-ai-purple-dark)
    );

  box-shadow:
    0 8px 25px rgba(124, 58, 237, 0.25);
}


.bloxy-ai-activation h3 {
  margin:
    0 0 8px;

  color:
    var(--bloxy-ai-text);

  font-size: 17px;
  font-weight: 650;
}


.bloxy-ai-activation p {
  margin:
    0 auto 17px;

  max-width: 300px;

  color:
    var(--bloxy-ai-text-muted);

  font-size: 12px;

  line-height: 1.6;
}


/* =========================================================
   ACTIVATE BUTTON
========================================================= */

.bloxy-ai-activate {
  width: 100%;

  min-height: 42px;

  border: 0;

  border-radius: 12px;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      var(--bloxy-ai-purple),
      var(--bloxy-ai-purple-dark)
    );

  font-size: 13px;
  font-weight: 600;

  cursor: pointer;

  box-shadow:
    0 8px 24px rgba(124, 58, 237, 0.22);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}


.bloxy-ai-activate:hover {
  transform: translateY(-1px);

  box-shadow:
    0 11px 28px rgba(124, 58, 237, 0.32);
}


.bloxy-ai-activate:active {
  transform: translateY(0);
}


.bloxy-ai-activate:disabled {
  opacity: 0.55;

  cursor: not-allowed;

  transform: none;
}


/* =========================================================
   DOWNLOAD PANEL
========================================================= */

.bloxy-ai-download {
  margin:
    0 15px 15px;

  padding:
    15px;

  border:
    1px solid rgba(255, 255, 255, 0.07);

  border-radius: 17px;

  background:
    rgba(255, 255, 255, 0.035);

  flex-shrink: 0;
}


/* =========================================================
   DOWNLOAD TEXT
========================================================= */

.bloxy-ai-download-text {
  margin-bottom: 9px;

  color:
    var(--bloxy-ai-text-muted);

  font-size: 11px;

  line-height: 1.45;

  text-align: center;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}


/* =========================================================
   PROGRESS BAR
========================================================= */

.bloxy-ai-progress {
  width: 100%;
  height: 7px;

  overflow: hidden;

  border-radius: 99px;

  background:
    rgba(255, 255, 255, 0.08);
}


.bloxy-ai-progress-bar {
  width: 0%;
  height: 100%;

  border-radius: inherit;

  background:
    linear-gradient(
      90deg,
      var(--bloxy-ai-purple-dark),
      var(--bloxy-ai-purple),
      var(--bloxy-ai-purple-light)
    );

  box-shadow:
    0 0 12px rgba(124, 58, 237, 0.5);

  transition:
    width 0.25s ease;
}


/* =========================================================
   PROGRESS PERCENTAGE
========================================================= */

.bloxy-ai-progress-percent {
  margin-top: 7px;

  color:
    var(--bloxy-ai-purple-light);

  font-size: 11px;
  font-weight: 600;

  text-align: right;
}


/* =========================================================
   DISCLAIMER
========================================================= */

.bloxy-ai-disclaimer {
  padding:
    0 15px 8px;

  color:
    rgba(161, 161, 170, 0.7);

  font-size: 9px;

  line-height: 1.4;

  text-align: center;

  flex-shrink: 0;
}


/* =========================================================
   COMPOSER
========================================================= */

.bloxy-ai-composer {
  display: flex;
  align-items: flex-end;

  gap: 8px;

  padding:
    11px 12px;

  border-top:
    1px solid rgba(255, 255, 255, 0.06);

  background:
    rgba(0, 0, 0, 0.12);

  flex-shrink: 0;
}


/* =========================================================
   INPUT
========================================================= */

.bloxy-ai-input {
  flex: 1;

  min-width: 0;

  min-height: 40px;
  max-height: 110px;

  padding:
    10px 12px;

  resize: none;

  border:
    1px solid rgba(255, 255, 255, 0.08);

  border-radius: 13px;

  outline: none;

  color:
    var(--bloxy-ai-text);

  background:
    rgba(255, 255, 255, 0.045);

  font-family:
    inherit;

  font-size: 13px;

  line-height: 1.45;

  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}


.bloxy-ai-input::placeholder {
  color:
    rgba(161, 161, 170, 0.65);
}


.bloxy-ai-input:focus {
  border-color:
    rgba(124, 58, 237, 0.55);

  background:
    rgba(255, 255, 255, 0.06);

  box-shadow:
    0 0 0 3px rgba(124, 58, 237, 0.08);
}


.bloxy-ai-input:disabled {
  opacity: 0.5;

  cursor: not-allowed;
}


/* =========================================================
   SEND BUTTON
========================================================= */

.bloxy-ai-send {
  width: 40px;
  height: 40px;

  flex: 0 0 40px;

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

  border: 0;

  border-radius: 12px;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      var(--bloxy-ai-purple),
      var(--bloxy-ai-purple-dark)
    );

  font-size: 18px;
  font-weight: 500;

  cursor: pointer;

  box-shadow:
    0 6px 18px rgba(124, 58, 237, 0.2);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}


.bloxy-ai-send:hover:not(:disabled) {
  transform:
    translateY(-1px);

  box-shadow:
    0 9px 23px rgba(124, 58, 237, 0.32);
}


.bloxy-ai-send:active:not(:disabled) {
  transform:
    translateY(0);
}


.bloxy-ai-send:disabled {
  opacity: 0.35;

  cursor: not-allowed;

  box-shadow: none;
}


/* =========================================================
   LOADING / GENERATION EFFECT
========================================================= */

.bloxy-ai-message.assistant:last-child:empty::after {
  content: "";

  display: inline-block;

  width: 6px;
  height: 6px;

  margin-left: 2px;

  border-radius: 50%;

  background:
    var(--bloxy-ai-purple-light);

  box-shadow:
    10px 0 0 rgba(167, 139, 250, 0.65),
    20px 0 0 rgba(167, 139, 250, 0.35);

  animation:
    bloxyAiDots
    1.1s infinite ease-in-out;
}


@keyframes bloxyAiDots {

  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px);
  }

}


/* =========================================================
   FOCUS ACCESSIBILITY
========================================================= */

.bloxy-ai-launcher:focus-visible,
.bloxy-ai-close:focus-visible,
.bloxy-ai-activate:focus-visible,
.bloxy-ai-send:focus-visible,
.bloxy-ai-input:focus-visible {
  outline:
    2px solid
    var(--bloxy-ai-purple-light);

  outline-offset: 2px;
}


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

@media (max-width: 600px) {

  .bloxy-ai-launcher {
    right: 16px;
    bottom: 16px;

    width: 54px;
    height: 54px;
  }


  .bloxy-ai-window {
    right: 8px;
    left: 8px;

    bottom: 78px;

    width: auto;
    max-width: none;

    height:
      calc(100vh - 94px);

    max-height: none;

    border-radius: 20px;
  }


  .bloxy-ai-header {
    min-height: 62px;
  }


  .bloxy-ai-messages {
    padding:
      15px 12px;
  }


  .bloxy-ai-message {
    max-width: 88%;

    font-size: 13px;
  }


  .bloxy-ai-activation {
    margin:
      0 12px 12px;

    padding:
      20px 16px;
  }


  .bloxy-ai-download {
    margin:
      0 12px 12px;
  }


  .bloxy-ai-composer {
    padding:
      9px;
  }

}


/* =========================================================
   VERY SMALL SCREENS
========================================================= */

@media (max-width: 360px) {

  .bloxy-ai-window {
    right: 4px;
    left: 4px;

    bottom: 70px;

    border-radius: 17px;
  }


  .bloxy-ai-activation h3 {
    font-size: 16px;
  }


  .bloxy-ai-activation p {
    font-size: 11px;
  }

}