/* Chatbot Styles */
:root {
    --chat-primary: #0A2540; /* A deep, professional blue */
    --chat-primary-dark: #061728;
    --chat-secondary: #F6F9FC; /* A light, clean grey for bot messages */
    --chat-accent: #6772E5; /* A vibrant accent for buttons and focus states */
    --chat-text: #32325D;
    --chat-text-light: #525F7F;
    --chat-border: #E6E6E6;
    --chat-shadow: rgba(50, 50, 93, 0.1), rgba(0, 0, 0, 0.07);
    --chat-radius: 12px;
    --chat-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Chat Button */
.chat-button {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--chat-accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    transition: var(--chat-transition);
    transform-origin: center;
}

.chat-button:hover {
    transform: scale(1.1) rotate(10deg);
    background: var(--chat-primary);
    box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
}

.chat-button:active {
    transform: scale(0.95);
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 370px;
    max-width: calc(100% - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #FFFFFF;
    border-radius: var(--chat-radius);
    box-shadow: 0 13px 27px -5px rgba(50, 50, 93, 0.25), 0 8px 16px -8px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.chat-window.open {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Chat Header */
.chat-header {
    padding: 16px 20px;
    background: var(--chat-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-chat {
    background: transparent;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: var(--chat-transition);
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #FFFFFF;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--chat-border);
    border-radius: 3px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    animation: messageSlide 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes messageSlide {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    background: var(--chat-accent);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.bot {
    background: var(--chat-secondary);
    color: var(--chat-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.error {
    background: #FFF6F6;
    color: #9F3A38;
    border: 1px solid #E0B4B4;
}

.message-content {
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding-left: 42px; /* Align with bot message */
}

.quick-action-btn {
    background: white;
    color: var(--chat-accent);
    border: 1px solid var(--chat-accent);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--chat-transition);
}

.quick-action-btn:hover {
    background: var(--chat-accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    padding: 12px 16px;
    background: var(--chat-secondary);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    margin: 4px 0;
}

.typing-indicator.show {
    display: flex;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #B8C2CC;
    border-radius: 50%;
    margin: 0 2px;
    opacity: 0.6;
    animation: typing 1.4s 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); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* Chat Input */
.chat-input-container {
    padding: 12px 20px;
    background: #FFFFFF;
    border-top: 1px solid var(--chat-border);
    flex-shrink: 0;
}
.chat-input {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--chat-secondary);
    border-radius: 24px;
    padding: 4px;
}

.chat-input input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 24px;
    outline: none;
    font-size: 15px;
    color: var(--chat-text);
}

.chat-input input:focus {
    box-shadow: 0 0 0 2px var(--chat-accent);
}

.chat-input button {
    background: var(--chat-accent);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
    flex-shrink: 0;
}

.chat-input button:hover {
    transform: scale(1.1);
}

.chat-input button:disabled {
    background: #B8C2CC;
    cursor: not-allowed;
    transform: scale(1);
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-window {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-width: 100%;
    }

    .chat-button {
        bottom: 16px;
        right: 16px;
    }

    .quick-actions {
        padding-left: 0;
        justify-content: flex-start;
    }
}
