:root {
  --loom-chat-primary: #004a99;
  --loom-chat-darker: #414141;
  --loom-chat-dark: #707175;
  --loom-chat-grey: #E0E0E0;
  --loom-chat-bg: rgba(255, 255, 255, 1);
  --loom-chat-text: #fff;
  --loom-chat-assistant-bg: #f0f4f8;
  --loom-chat-user-bg: #004a99;
  --loom-chat-user-text: #fff;
  --loom-chat-border: #E0E0E0;
  --loom-chat-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);
}

.loom-ai-chatblock-wrapper {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

/* Chat launcher button */
.loom-ai-chat-launcher {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--loom-chat-shadow);
  transition: transform 0.2s, background 0.2s;
}

.loom-ai-chat-launcher:hover {
  transform: translateY(-2px);
  background: #003d7a;
}

/* Chat dialog */
.loom-ai-chat-dialog {
  margin: auto 40px 20px auto;
  padding: 0;
  border: none;
  border-radius: 16px;
  box-shadow: var(--loom-chat-shadow);
  width: 556px;
  max-width: 90vw;
  height: 664px;
  max-height: 664px;
  overflow: hidden;
  background: var(--loom-chat-bg);
  backdrop-filter: blur(10px);
}

.loom-ai-chat-dialog::backdrop {
  background: rgba(0, 0, 0, 0.05);
}

.loom-ai-chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.loom-ai-chat-header {
  padding: 10px 24px 0 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--loom-chat-border);
}

.loom-ai-chat-title {
  margin: 0 16px 0;
  font-size: 16px;
  font-weight: 500;
  flex: 1;
}

.loom-ai-chat-actions button {
  border: none;
  background: none;
  color: var(--loom-chat-dark);
  cursor: pointer;
  font-size: 16px;
  transition: color 0.2s;
  margin: 0;
  padding: 0;
}

.loom-ai-chat-actions button svg {
  width: 22px;
  height: 22px;
}

/* Chat inner - messages */
.loom-ai-chat-messages {
  flex: 1;
  padding: 20px 28px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loom-ai-intro {
  gap: 8px;
  margin-top: 8px;
}

.loom-ai-intro-text {

  color: var(--loom-chat-darker);
  margin-bottom: 8px;

  & h3 {
    font-size: 24px;
    font-weight: 400;
    margin: 0 0 10px;
  }

  & h4 {
    font-size: 18px;
    font-weight: 400;
    margin: 0 0 20px;
  }
}

.loom-ai-suggestion-btn {
  display: block;
  background: var(--loom-chat-grey);
  border: none;
  color: var(--loom-chat-darker);
  padding: 10px 12px;
  border-radius: 2px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 70%;

  &+.loom-ai-suggestion-btn {
    margin-top: 12px;
  }
}

.loom-ai-suggestion-btn:hover {
  background: var(--loom-chat-primary);
  color: #fff;
}

/* Message styles */

.loom-ai-message {
  max-width: 85%;
  padding: 14px 15px;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.4;
}

.loom-ai-message .loom-ai-message-content p:first-child {
  margin-top: 0;
}

.loom-ai-message .loom-ai-message-content p:last-child {
  margin-bottom: 0;
}

.loom-ai-message.assistant {
  align-self: flex-start;
  background: var(--loom-chat-bg);
  color: var(--loom-chat-dark);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--loom-chat-border);
}

.loom-ai-message.user {
  align-self: flex-end;
  background: var(--loom-chat-grey);
  color: var(--loom-chat-darker);
  border-bottom-right-radius: 2px;
}

/* FOOOTER STYLES*/

.loom-ai-chat-footer {
  padding: 26px 26px 10px;
  border-top: 1px solid var(--loom-chat-border);
}

.loom-ai-chat-input-wrapper {
  display: flex;
  background: #fff;
  border: 1px solid var(--loom-chat-border);
  border-radius: 6px;
  padding: 10px 12px;
  align-items: flex-end;
}

.loom-ai-chat-input {
  flex: 1;
  border: none;
  resize: none;
  font-family: inherit;
  font-size: 0.95rem;
  max-height: 120px;
  height: 23px;
}

.loom-ai-chat-input:focus {
  outline: none;
}

.loom-ai-chat-send {
  background: none;
  border: none;
  color: var(--loom-chat-primary);
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  padding: 0;
  margin-right: -5px;
}

.loom-ai-chat-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.loom-ai-chat-send svg {
  width: 14px;
  height: 14px;
}

.loom-ai-chat-footer .loom-ai-chat-actions {
  text-align: right;
  padding: 5px 0;
}

.loom-ai-chat-footer .loom-ai-chat-actions button {
  text-decoration: underline;
  font-size: 14px;
  color: var(--loom-chat-dark);
  font-weight: 500;

  &:hover {
    text-decoration: none;
  }
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 20px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--loom-chat-dark);
  border-radius: 50%;
  opacity: 0.4;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {

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

  40% {
    transform: translateY(-6px);
  }
}

/* Large / fullscreen (≥ 1440px) */
@media (min-width: 1440px) {
  .loom-ai-chat-dialog {
    width: 620px;
    height: 760px;
    max-height: 760px;
    margin: auto 48px 24px auto;
  }
}

/* Tablet (601px – 1024px) */
@media (max-width: 1024px) {
  .loom-ai-chat-dialog {
    width: 460px;
    height: 580px;
    max-height: 80vh;
    margin: auto 16px 80px auto;
  }
}

/* Phone (≤ 600px) — full-screen dialog */
@media (max-width: 600px) {
  .loom-ai-chatblock-wrapper {
    bottom: 12px;
    right: 12px;
  }

  .loom-ai-chat-dialog {
    position: fixed;
    inset: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .loom-ai-chat-header {
    padding: 10px 16px 0;
  }

  .loom-ai-chat-messages {
    padding: 16px 16px 20px;
  }

  .loom-ai-chat-footer {
    padding: 16px 16px 10px;
  }
}
