/* Chatbot Button */
.ai-help-btn {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 3000;
    background: #7e8f6a;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 1rem 1.2rem;
    font-size: 0.95rem;
    font-weight: bold;
    box-shadow: 0 4px 16px rgba(52,152,219,0.18);
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.ai-help-btn:hover {
    background: #2176b6;
    box-shadow: 0 6px 24px rgba(52,152,219,0.25);
    transform: translateY(-2px) scale(1.03);
}
@media (max-width: 600px) {
    .ai-help-btn {
        right: 1rem;
        bottom: 1rem;
        padding: 0.7rem 0.9rem;
        font-size: 0.85rem;
    }
    .ai-help-box {
        right: 1rem;
        bottom: 4.5rem;
    }
}

/* Chatbot Box */
.ai-help-box {
    position: fixed;
    right: 2rem;
    bottom: 5.5rem;
    width: 350px;
    max-width: 95vw;
    background: #f7f8fa;
    box-shadow: 0 8px 32px 0 rgba(31,38,135,0.13), 0 1.5px 8px 0 rgba(59,60,74,0.08);
    border-radius: 18px;
    z-index: 4000;
    padding: 0;
    overflow: hidden;
    animation: fadeInAIBox 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 480px;
    border: 1.5px solid #e3e6ed;
}

/* Chatbot Header */
.ai-help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--secondary-color);
    color: #fff;
    padding: 1rem 1.3rem;
    font-weight: 700;
    font-size: 1.15rem;
    border-bottom: 1px solid #e3e6ed;
    letter-spacing: 0.01em;
}
.ai-help-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 2.2rem;
    cursor: pointer;
    padding: 0 0.3em;
    line-height: 1;
    transition: color 0.2s;
    opacity: 0.8;
}
.ai-help-close:hover {
    color: #ffd7b2;
    opacity: 1;
}

/* Chatbot Body */
.ai-help-body {
    padding: 1.1rem 1.2rem 0.6rem 1.2rem;
    color: var(--text-color);
    font-size: 1.04rem;
    background: transparent;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 60px;
    box-sizing: border-box;
    max-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 0.7em;
}

/* Chatbot Messages as Bubbles */
.chat-message {
    display: flex;
    align-items: flex-end;
    margin-bottom: 0.7em;
    max-width: 95%;
}

.chat-message.bot {
    justify-content: flex-start;
    align-items: flex-end;
}

.chat-message.user {
    justify-content: flex-end;
    align-self: flex-end;
    align-items: flex-end;
}

/* Bubble wrapper for each message */
.chat-message > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: #f7f8fa;
    color: var(--secondary-color);
    border-radius: 20px;
    padding: 0.7em 1.2em;
    box-shadow: 0 2px 8px rgba(31,38,135,0.10);
    position: relative;
    min-width: 44px;
    min-height: 36px;
    max-width: 100%;
    word-break: break-word;
    border-bottom-left-radius: 8px;
    border: 1.5px solid #e3e6ed;
}

.chat-message.user > div {
    background: #7e8f6a;         /* Use a solid theme color, not a gradient */
    color: #fff;
    align-items: flex-end;
    border-bottom-right-radius: 8px;
    border-bottom-left-radius: 20px;
    border: none;
    box-shadow: 0 2px 12px rgba(218,160,109,0.10);
}

/* Name styling */
.bot-name, .user-name {
    font-weight: 600;
    font-size: 0.97em;
    margin-bottom: 0.1em;
    display: block;
    opacity: 0.7;
    padding-left: 0.2em;
    position: static;
}

.bot-name {
    color: var(--secondary-color);
    text-align: left;
}

.user-name {
    color: #fff;
    text-align: right;
}

/* Optional: Add a "tail" for chat bubbles */
.chat-message.bot > div::after {
    content: "";
    position: absolute;
    left: -12px;
    bottom: 10px;
    width: 18px;
    height: 24px;
    background: transparent;
    background-repeat: no-repeat;
    background-image: radial-gradient(circle at 0 100%, #f7f8fa 70%, transparent 71%);
    z-index: 1;
    pointer-events: none;
}

/* Chatbot Input */
.ai-help-input {
    display: flex;
    border-top: 1px solid #e3e6ed;
    padding: 0.8rem 1.2rem;
    background: #f3f4f7;
    gap: 0.7rem;
    box-sizing: border-box;
    justify-content: flex-start;
    position: relative;
}
.ai-help-input input[type="text"] {
    flex: 1 1 auto;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    font-size: 1.08rem;
    outline: none;
    background: #fff;
    margin-right: 0;
    min-width: 0;
    transition: border 0.2s;
}
.ai-help-input input[type="text"]:focus {
    border: 1.5px solid var(--highlight-color);
    background: #fffbe9;
}
.ai-help-input button[type="submit"] {
    background: #7e8f6a;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.4rem;
    font-size: 1.08rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    margin-left: 0;
    min-width: 90px;
    box-shadow: 0 1px 4px rgba(59,60,74,0.07);
}
.ai-help-input button[type="submit"]:hover {
    background: var(--highlight-color);
}

/* Chatbot Tooltip */
.ai-help-tooltip {
    position: absolute;
    left: 1.2rem;
    top: -2.5rem;
    background: #222;
    color: #fff;
    padding: 0.5rem 1.1rem;
    border-radius: 10px;
    font-size: 0.98rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    pointer-events: none;
    opacity: 0.97;
    transition: opacity 0.2s;
}
.ai-help-tooltip::after {
    content: "";
    position: absolute;
    left: 1.5rem;
    top: 100%;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #222;
}