/* Professional Blue & White Chatbot Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary-blue: #4285f4;
    --secondary-blue: #6fa8f5;
    --light-blue: #f0f4ff;
    --accent-blue: #a8c5f7;
    --white: #ffffff;
    --light-gray: #f8fafc;
    --border-gray: #e2e8f0;
    --text-dark: #1a202c;
    --text-light: #718096;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-large: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.chatbot-icon {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(66, 133, 244, 0.3), 0 0 0 0 rgba(66, 133, 244, 0.4);
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid var(--white);
    overflow: hidden;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(66, 133, 244, 0.3), 0 0 0 0 rgba(66, 133, 244, 0.4); }
    50% { box-shadow: 0 8px 32px rgba(66, 133, 244, 0.4), 0 0 0 10px rgba(66, 133, 244, 0); }
}

.chatbot-icon:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 15px 40px rgba(66, 133, 244, 0.4), 0 0 0 0 rgba(66, 133, 244, 0.4);
    animation: none;
}

.chatbot-icon svg {
    width: 32px;
    height: 32px;
    display: block;
    fill: var(--white);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.chatbot-bubble {
    position: fixed;
    bottom: 100px;
    right: 24px;
    background: var(--white);
    color: var(--primary-blue);
    padding: 12px 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-medium);
    font-weight: 600;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    border: 1px solid var(--border-gray);
    z-index: 999;
    animation: fadeInUp 0.5s ease-out;
    max-width: 200px;
    text-align: center;
}

.chatbot-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--white);
}

.chatbot-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, rgba(255, 255, 255, 0.95) 100%);
    backdrop-filter: blur(20px);
    display: none;
    flex-direction: row;
    z-index: 999;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    animation: slideIn 0.5s ease-out;
}
@keyframes slideIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.chatbot-sidebar {
    width: 280px;
    background: var(--white);
    border-right: 1px solid var(--border-gray);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.chatbot-sidebar.collapsed {
    width: 0;
    border-right: none;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.new-chat-btn {
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-chat-btn:hover {
    background: var(--secondary-blue);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.chat-item {
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 8px;
    margin: 0 12px 4px;
    transition: all 0.2s ease;
    font-size: 14px;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    group: hover;
}

.chat-item:hover {
    background: var(--light-gray);
}

.chat-item.active {
    background: var(--light-blue);
    color: var(--primary-blue);
}

.chat-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-date {
    font-size: 12px;
    color: var(--text-light);
    margin-left: 8px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--white);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.chatbot-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--white);
    padding: 12px 32px;
    font-weight: 600;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(66, 133, 244, 0.2);
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23dots)"/></svg>') repeat;
    pointer-events: none;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23ffffff" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    pointer-events: none;
}

.chatbot-close {
    cursor: pointer;
    font-size: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chatbot-close:hover {
    transform: rotate(90deg) scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-messages {
    flex: 1;
    padding: 32px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--white);
    position: relative;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--light-gray);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border-gray);
    border-radius: 3px;
    transition: background 0.2s;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.message {
    max-width: 75%;
    padding: 16px 20px;
    border-radius: 20px;
    line-height: 1.6;
    word-break: break-word;
    font-size: 15px;
    font-weight: 500;
    position: relative;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
}

.user-message {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--white);
    align-self: flex-end;
    border-bottom-right-radius: 6px;
    margin-left: auto;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
}

.user-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid var(--primary-blue);
    border-bottom: 8px solid transparent;
}

.assistant-message {
    background: rgba(240, 244, 255, 0.8);
    backdrop-filter: blur(10px);
    color: var(--text-dark);
    align-self: flex-start;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(66, 133, 244, 0.15);
}

.assistant-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid var(--light-blue);
    border-bottom: 8px solid transparent;
}

.chatbot-input {
    display: flex;
    padding: 24px 32px;
    background: var(--white);
    border-top: 1px solid var(--border-gray);
    position: sticky;
    bottom: 0;
    z-index: 1;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
    gap: 16px;
    align-items: flex-end;
}

.chatbot-input input {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid var(--border-gray);
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--light-gray);
    color: var(--text-dark);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    line-height: 1.5;
}

.chatbot-input input:focus {
    border-color: var(--secondary-blue);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.chatbot-input input::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

.chatbot-input button {
    padding: 16px 24px;
    background: var(--primary-blue);
    color: var(--white);
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 80px;
    justify-content: center;
}

.chatbot-input button:hover {
    background: var(--secondary-blue);
    transform: translateY(-1px);
}

.chatbot-input button:active {
    transform: translateY(0);
}

.chatbot-input button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: flex;
    padding: 16px 20px;
    align-self: flex-start;
    background: var(--light-blue);
    border-radius: 20px;
    border-bottom-left-radius: 6px;
    box-shadow: var(--shadow-light);
    border: 1px solid rgba(30, 64, 175, 0.1);
    animation: messageSlideIn 0.3s ease-out;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 3px;
    background: var(--primary-blue);
    border-radius: 50%;
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

#messages-end {
    height: 1px;
    margin: 0;
    padding: 0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-container {
        flex-direction: column;
    }
    
    .chatbot-sidebar {
        width: 100%;
        height: 60px;
        border-right: none;
        border-bottom: 1px solid var(--border-gray);
    }
    
    .sidebar-header {
        padding: 12px 16px;
    }
    
    .chat-history {
        display: none;
    }
    
    .chatbot-icon {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .chatbot-bubble {
        bottom: 88px;
        right: 20px;
        max-width: 160px;
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .chatbot-header {
        padding: 20px 24px;
        font-size: 18px;
    }
    
    .chatbot-messages {
        padding: 24px 16px;
        gap: 12px;
    }
    
    .message {
        max-width: 85%;
        padding: 14px 18px;
        font-size: 14px;
    }
    
    .chatbot-input {
        padding: 20px 16px;
        gap: 12px;
    }
    
    .chatbot-input input {
        padding: 14px 20px;
        font-size: 14px;
    }
    
    .chatbot-input button {
        padding: 14px 20px;
        font-size: 14px;
        min-width: 70px;
    }
}

