/* AI Chatbot Premium Design */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --ws-primary: #2563eb;
    --ws-primary-dark: #1d4ed8;
    --ws-secondary: #0ea5e9;
    --ws-bg-glass: rgba(255, 255, 255, 0.85);
    --ws-border: rgba(255, 255, 255, 0.3);
    --ws-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] {
    --ws-bg-glass: rgba(15, 23, 42, 0.9);
    --ws-border: rgba(255, 255, 255, 0.1);
    --ws-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1050;
    font-family: 'Outfit', sans-serif;
}

.chatbot-toggle {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ws-secondary) 0%, var(--ws-primary) 100%);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.chatbot-toggle:hover {
    transform: scale(1.1) rotate(10deg);
}

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

.chatbot-toggle .close-icon {
    display: none;
}

.chatbot-toggle.active .chat-icon {
    display: none;
}

.chatbot-toggle.active .close-icon {
    display: block;
}

.chatbot-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 60px);
    height: 600px;
    max-height: calc(100vh - 150px);
    background: var(--ws-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--ws-border);
    border-radius: 24px;
    box-shadow: var(--ws-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(30px) scale(0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.chatbot-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.chatbot-header {
    padding: 24px;
    background: linear-gradient(135deg, var(--ws-secondary) 0%, var(--ws-primary) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header .avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chatbot-header p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chatbot-header p::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
}

.chatbot-header-actions {
    display: flex;
    gap: 10px;
}

.chatbot-header-actions button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.6;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.message.user {
    align-self: flex-end;
    background: var(--ws-primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
}

.message.ai {
    align-self: flex-start;
    background: rgba(37, 99, 235, 0.08);
    color: inherit;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] .message.ai {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.05);
}

.sources-list {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .sources-list {
    border-top-color: rgba(255, 255, 255, 0.05);
}

.sources-list p {
    margin: 0 0 10px 0;
    font-weight: 600;
    font-size: 13px;
    color: var(--ws-primary);
}

.sources-list .source-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sources-list a {
    background: rgba(37, 99, 235, 0.1);
    color: var(--ws-primary);
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid rgba(37, 99, 235, 0.05);
}

.sources-list a:hover {
    background: var(--ws-primary);
    color: white;
}

.chatbot-input-area {
    padding: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .chatbot-input-area {
    border-top-color: rgba(255, 255, 255, 0.05);
}

.chatbot-input-wrapper {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    display: flex;
    align-items: center;
    padding: 6px;
    transition: all 0.3s;
}

[data-theme="dark"] .chatbot-input-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.chatbot-input-wrapper:focus-within {
    background: white;
    border-color: var(--ws-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] .chatbot-input-wrapper:focus-within {
    background: rgba(30, 41, 59, 1);
}

.chatbot-input {
    flex: 1;
    border: none;
    padding: 10px 15px;
    font-size: 15px;
    outline: none;
    background: transparent;
    color: inherit;
}

.chatbot-send {
    background: var(--ws-primary);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chatbot-send:hover {
    background: var(--ws-primary-dark);
    transform: scale(1.05);
}

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

.typing {
    display: flex;
    gap: 5px;
    padding: 10px 0;
}

.typing span {
    width: 8px;
    height: 8px;
    background: var(--ws-primary);
    border-radius: 50%;
    opacity: 0.4;
    animation: wave 1.3s linear infinite;
}

.typing span:nth-child(2) { animation-delay: -1.1s; }
.typing span:nth-child(3) { animation-delay: -0.9s; }

@keyframes wave {
    0%, 60%, 100% { transform: initial; }
    30% { transform: translateY(-7px); opacity: 0.8; }
}

@media (max-width: 576px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: min(600px, calc(100vh - 120px));
        right: -10px;
    }
}
