/* Chatbot Variables */
:root {
    --chat-width: 380px;
    --chat-height: 500px;
    --chat-bg: #1e293b;
    --chat-header-bg: linear-gradient(135deg, #2563eb, #7c3aed);
    --chat-user-msg: #2563eb;
    --chat-bot-msg: #334155;
    --chat-text: #f8fafc;
    --chat-radius: 20px;
}

[data-theme="light"] {
    --chat-bg: #ffffff;
    --chat-bot-msg: #f1f5f9;
    --chat-text: #0f172a;
}

/* Chat Toggle Button (FAB) */
.chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--chat-header-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

.chat-toggle i {
    transition: transform 0.3s ease;
}

.chat-toggle.active i {
    transform: rotate(90deg);
}

/* Chat Main Container */
.chat-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: var(--chat-width);
    height: var(--chat-height);
    background: var(--chat-bg);
    border-radius: var(--chat-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-container.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

/* Chat Header */
.chat-header {
    background: var(--chat-header-bg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.chat-close:hover {
    color: white;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.message {
    max-width: 80%;
    padding: 0.8rem 1rem;
    border-radius: 15px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.bot-message {
    background: var(--chat-bot-msg);
    color: var(--chat-text);
    border-bottom-left-radius: 2px;
    align-self: flex-start;
}

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 15px;
    background: var(--chat-bot-msg);
    border-radius: 15px;
    border-bottom-left-radius: 2px;
    width: fit-content;
    margin-bottom: 1rem;
    display: none;
    /* Hidden by default */
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: rgba(128, 128, 128, 0.5);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

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

    40% {
        transform: scale(1);
    }
}

/* Chat Input Area */
.chat-input-area {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 0.8rem 1rem;
    border-radius: 25px;
    border: 1px solid rgba(128, 128, 128, 0.3);
    background: var(--chat-bg);
    color: var(--chat-text);
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #2563eb;
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--user-msg);
    /* Will use the blue color */
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-send:click:not(:disabled) {
    transform: scale(0.95);
}

.chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-container {
        width: calc(100% - 40px);
        bottom: 100px;
        right: 20px;
        left: 20px;
        height: 60vh;
    }
}

/* Chat Suggestions */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    margin-bottom: 10px;
    padding: 0 5px;
}

.suggestion-chip {
    background: rgba(37, 99, 235, 0.15);
    color: var(--chat-user-msg);
    border: 1px solid rgba(37, 99, 235, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: var(--chat-user-msg);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .suggestion-chip {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #cbd5e1;
}

[data-theme="light"] .suggestion-chip:hover {
    background: var(--chat-user-msg);
    color: white;
}