/* Chat Widget Styling */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-toggle-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    background-color: #2980b9;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background-color: var(--card-bg-color);
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid #eee;
}

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

.chat-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--accent-color);
}

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

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close-btn:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95em;
    line-height: 1.4;
    word-wrap: break-word;
}

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

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

.chat-input-area {
    padding: 15px;
    background-color: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input-area input:focus {
    border-color: var(--accent-color);
}

.chat-send-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.chat-send-btn:hover {
    background-color: var(--accent-color);
}

.typing-indicator {
    display: none;
    align-self: flex-start;
    background-color: #e0e0e0;
    padding: 8px 12px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1s infinite;
}

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

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

@keyframes typing {

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

    50% {
        transform: translateY(-4px);
    }
}

@media screen and (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        bottom: 90px;
        right: 20px;
        height: 60vh;
    }
}

/* Dark Mode Overrides for Chat */
body.dark-mode .chat-window {
    background-color: var(--card-bg-color);
    border-color: #333;
}

body.dark-mode .chat-messages {
    background-color: #1a1a1a;
}

body.dark-mode .message.bot {
    background-color: #333;
    color: var(--text-light);
}

body.dark-mode .chat-input-area {
    background-color: var(--card-bg-color);
    border-top-color: #333;
}

body.dark-mode .chat-input-area input {
    background-color: #2c2c2c;
    border-color: #444;
    color: var(--text-light);
}

body.dark-mode .chat-input-area input:focus {
    border-color: var(--accent-color);
}

body.dark-mode .typing-indicator {
    background-color: #333;
}