/* ==========================================================================
   CHATBOT
   ========================================================================== */

*{
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chatbot-icon {
    width: 60px;
    height: 60px;
    background-color: #3a5e8c;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chatbot-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.chatbot-icon:active {
    transform: scale(0.95);
}

.chatbot-icon i {
    color: white;
    font-size: 28px;
}

.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--accent-red, #e74c3c);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 35px;
  width: 350px;
  height: 450px;
  background-color: #ffffff;
  border-radius: 15px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Start state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(40px) scale(0.8);
  transform-origin: bottom right; 
  transition:
    opacity 0.4s ease,
    transform 0.5s cubic-bezier(0.22, 1.61, 0.36, 1), /* spring-like pop */
    visibility 0.3s;
}


.chatbot-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chatbot-header {
    background-color: #3a5e8c;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.chatbot-header h3 {
    font-size: 18px;
    margin: 0;
}

.chatbot-header button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 20px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.chatbot-header button:hover {
    opacity: 1;
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 20px;
    max-width: 85%;
    line-height: 1.4;
    word-wrap: break-word;  /* prevent overflow for long text */
}

.message.bot {
    background-color: #e9e9eb;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.message.user {
    background-color: #3a5e8c;
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.chatbot-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eee;
    background-color: #ffffff;
}

.chatbot-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    margin-right: 10px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.chatbot-input input:focus {
    outline: none;
    border-color: #3a5e8c;
}

.chatbot-input button {
    background-color: #3a5e8c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chatbot-input button:hover {
    background-color: #2c486e;
}

.loaderz {
    display: flex;
    align-items: center;
    padding: 10px 0;
    opacity: 1;
}

.loaderz span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #aaa;
    margin: 0 3px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loaderz span:nth-child(1) {
    animation-delay: -0.32s;
}

.loaderz span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 10px;
        right: 10px;
    }

    .chatbot-window {
        width: calc(100vw - 20px);
        height: 70vh;
        bottom: 70px;
        right: -10px; /* Adjust to align with container */
        border-radius: 15px;
    }

    .chatbot-icon {
        width: 50px;
        height: 50px;
    }

    .chatbot-icon i {
        font-size: 24px;
    }

    .chatbot-header h3 {
        font-size: 16px;
    }

    .chatbot-messages {
        padding: 15px;
    }

    .chatbot-input {
        padding: 10px;
    }
}
