/* =========================================================
Chatbot Floating Button
========================================================= */

.chat-fab {
    position: fixed;
    bottom: 50px;
    right: 50px;

    width: 64px;
    height: 64px;

    border-radius: 50%;
    border: none;

    background: #302a26;
    color: #fff;

    cursor: pointer;

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

    z-index: 9999;

    box-shadow:
        0 8px 20px rgba(48, 42, 38, 0.25),
        0 0 0 0 rgba(101, 67, 33, 0.35);

    animation:
        chatbot-bounce 3.5s ease-in-out infinite,
        chatbot-glow 2.5s ease-in-out infinite;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.chat-fab:hover {
    animation-play-state: paused;

    transform: scale(1.08);

    box-shadow:
        0 10px 25px rgba(48, 42, 38, 0.30),
        0 0 20px rgba(101, 67, 33, 0.35);
}

.chat-fab:active {
    transform: scale(0.95);
}

.chat-fab svg {
    width: 28px;
    height: 28px;

    animation: chatbot-icon 1.5s ease-in-out infinite;
}

/* =========================================================
Floating Button Animations
========================================================= */

@keyframes chatbot-bounce {
    0%,
    70%,
    100% {
        transform: translateY(0);
    }

    74% {
        transform: translateY(-15px);
    }

    78% {
        transform: translateY(0);
    }

    82% {
        transform: translateY(-7px);
    }

    86% {
        transform: translateY(0);
    }
}

@keyframes chatbot-glow {
    0%,
    100% {
        box-shadow:
            0 8px 20px rgba(48, 42, 38, 0.25),
            0 0 0 0 rgba(101, 67, 33, 0.25);
    }

    50% {
        box-shadow:
            0 8px 22px rgba(48, 42, 38, 0.30),
            0 0 0 10px rgba(101, 67, 33, 0.08);
    }
}

@keyframes chatbot-icon {
    0%,
    70%,
    100% {
        transform: rotate(0deg);
    }

    74% {
        transform: rotate(-8deg);
    }

    78% {
        transform: rotate(8deg);
    }

    82% {
        transform: rotate(-4deg);
    }

    86% {
        transform: rotate(0deg);
    }
}

/* =========================================================
Chat Window
========================================================= */

.chat-window {
  position: fixed;

  right: 25px;
  bottom: 50px;

  width: 500px;
  height: 650px;
  max-height: 90vh !important;

  background: #fff;

  border: 1px solid rgba(65, 47, 37, 0.08);
  border-radius: 18px;

  overflow: hidden;

  display: flex;
  flex-direction: column;

  box-shadow: 0 20px 45px rgba(65, 47, 37, 0.18);

  z-index: 9999;

  opacity: 0;
  visibility: hidden;

  transform: translateY(25px) scale(0.95);

  transform-origin: bottom right;

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

}

.chat-window.open {
  opacity: 1;
  visibility: visible;

  transform: translateY(0) scale(1);

}

/* =========================================================
Header
========================================================= */

.chat-header {
  min-height: 68px;

  background: #fff;

  color: #302a26;

  border-bottom: 1px solid rgba(65, 47, 37, 0.08);

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

  padding: 0 20px;

  flex-shrink: 0;

}

.title {
  display: flex;
  align-items: center;

  gap: 12px;

  font-weight: 700;
  font-size: 16px;

  color: #302a26;

}

.title svg {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f5efeb;
  color: #211e1c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  padding: 8px;
}

.assistant-title {
  font-size: 15px;

  font-weight: 700;

  color: #302a26;

  line-height: 1.2;

}

/* =========================================================
Close Button
========================================================= */

.close-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #211e1c;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;

  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;

}

.close-btn:hover {
  background: #f5efeb;
  color: #302a26;
  transform: rotate(90deg);
}

/* =========================================================
Chat Body
========================================================= */

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  background: #fcfaf8;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #d8cec6 transparent;

}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
  background: #d8cec6;
  border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb {
  background: #8b6f47;
}

/* =========================================================
Messages
========================================================= */

.message-row {
  display: flex;
  width: 100%;
  margin-bottom: 14px;
  animation: messageAppear 0.25s ease-out;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.bot {
  justify-content: flex-start;
}

.message {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-line;
}

.message-row.user .message {
  background: #302a26;
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 8px rgba(65, 47, 37, 0.12);
}

.message-row.bot .message {
  background: #f7f3f0;
  color: #4a3b32;
  border: 1px solid rgba(65, 47, 37, 0.06);
  border-bottom-left-radius: 4px;
}

@keyframes messageAppear {
  from {
    opacity: 0;

    transform: translateY(6px);
  }

  to {
    opacity: 1;

    transform: translateY(0);
  }

}

/* =========================================================
Typing Indicator
========================================================= */

.typing {
    display: flex;
    align-items: center;
    gap: 5px;

    min-width: 48px;
    min-height: 20px;
}

.typing span {
    width: 6px;
    height: 6px;

    background: #8b6f47;

    border-radius: 50%;

    animation: typing-wave 1.2s infinite ease-in-out;
}

.typing span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typing-wave {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* =========================================================
Suggested Questions
========================================================= */

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0px;
  animation: messageAppear 0.3s ease-out;
}

.suggestion-btn {
  border: 1px solid rgba(65, 47, 37, 0.10);
  background: #f7f3f0;
  color: #302a26;
  padding: 9px 15px;
  border-radius: 22px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;

  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;

}

.suggestion-btn {
  background: #302a26;

  color: #fff;

  border-color: #302a26;

  transform: translateY(-1px);

}

.suggestion-btn {
  transform: scale(0.97);
}

/* =========================================================
Sources
========================================================= */

.sources {
  margin-top: 10px;

  padding-top: 8px;

  border-top: 1px solid rgba(65, 47, 37, 0.08);

}

.sources-title {
  margin-bottom: 6px;

  font-size: 11px;

  font-weight: 700;

  color: #8b6f47;

}

.source-item {
  margin-top: 5px;

  font-size: 11px;

  line-height: 1.4;

  color: #75685e;

  word-break: break-word;

}

.source-item i {
  margin-right: 5px;

  color: #302a26;

  font-size: 11px;

}

/* =========================================================
Footer
========================================================= */

.chat-footer {
  min-height: 78px;

  padding: 15px 18px;

  border-top: 1px solid rgba(65, 47, 37, 0.08);

  background: #fff;

  display: flex;

  align-items: center;

  gap: 10px;

  flex-shrink: 0;

}

/* =========================================================
Input
========================================================= */

.chat-input {
  flex: 1;

  min-width: 0;

  height: 46px;

  border-radius: 30px;

  border: 1px solid #e7ded7;

  background: #fff;

  color: #4a3b32;

  padding: 0 17px;

  outline: none;

  font-size: 14px;

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

}

.chat-input::placeholder {
  color: #9a8e85;
}

.chat-input {
  border-color: #8b6f47;
  box-shadow: 0 0 0 3px rgba(139, 111, 71, 0.10);
}

.chat-input {
  background: #f8f6f4;
  /* cursor: not-allowed; */
}

/* =========================================================
Send Button
========================================================= */

.send-btn {
    width: 46px;
    height: 46px;
    flex-shrink: 0;

    border: none;
    border-radius: 50%;

    background: #302a26;
    color: #fff;

    cursor: pointer;

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

    font-size: 15px;

    opacity: 1;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease,
        opacity 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    background: #4a321f;
    transform: scale(1.05);
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* =========================================================
Contact Support
========================================================= */

.error-message {
  border: 1px solid rgba(139, 111, 71, 0.25);
}

.contact-support-btn {
  margin-top: 12px;

  display: flex;

  align-items: center;

  gap: 7px;

  border: none;

  border-radius: 8px;

  padding: 8px 12px;

  background: #302a26;

  color: #fff;

  font-size: 13px;

  font-weight: 600;

  cursor: pointer;

  transition: all 0.2s ease;

}

.contact-support-btn {
  background: #302a26;

  transform: translateY(-1px);

}

.contact-support-btn i {
  font-size: 13px;
}

/* =========================================================
Responsive - Tablet
========================================================= */

@media (max-width: 600px) {

  .chat-window {
    right: 15px;

    bottom: 90px;

    width: calc(100vw - 30px);

    height: min(560px, calc(100vh - 120px));
  }


  .chat-fab {
    right: 18px;

    bottom: 18px;
  }

}

/* =========================================================
Responsive - Small Mobile
========================================================= */

@media (max-width: 480px) {

  .chat-window {
    right: 10px;

    bottom: 85px;

    width: calc(100vw - 20px);

    height: calc(100vh - 105px);

    border-radius: 16px;
  }


  .chat-header {
    min-height: 62px;

    padding: 0 15px;
  }


  .chat-body {
    padding: 17px;
  }


  .chat-footer {
    padding: 12px;
  }


  .message {
    max-width: 88%;

    font-size: 13px;
  }


  .suggestion-btn {
    font-size: 12px;

    padding: 8px 13px;
  }


  .chat-fab {
    width: 58px;

    height: 58px;

    right: 15px;

    bottom: 15px;

    font-size: 21px;
  }

}