/* Chatbot Styles */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Space Grotesk', sans-serif;
}

#chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    font-size: 24px;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 99, 235, 0.6);
}

#chatbot-toggle.active {
    transform: rotate(90deg);
}

#chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #1e293b;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #334155;
}

#chatbot-window.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

#chatbot-header {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#chatbot-header .status {
    display: flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

#chatbot-header .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#chatbot-close,
#chatbot-clear {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

#chatbot-close {
    font-size: 24px;
}

#chatbot-close:hover,
#chatbot-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

#chatbot-clear:hover {
    color: #ef4444;
}

#chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

#chatbot-messages::-webkit-scrollbar-track {
    background: #1e293b;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
}

.message.user .message-avatar {
    background: #475569;
    color: white;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.assistant .message-content {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}

.message.user .message-content {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
}

.message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    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%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

#chatbot-input-container {
    padding: 16px;
    background: #1e293b;
    border-top: 1px solid #334155;
}

#chatbot-input-form {
    display: flex;
    gap: 10px;
}

#chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
}

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

#chatbot-input::placeholder {
    color: #64748b;
}

#chatbot-send {
    padding: 12px 16px;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

#chatbot-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

#chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error-message {
    background: #dc2626;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px;
    text-align: center;
    font-size: 14px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    #chatbot-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    #chatbot-container {
        bottom: 20px;
        right: 20px;
    }

    #chatbot-toggle {
        width: 56px;
        height: 56px;
        font-size: 22px;
        box-shadow: 0 4px 20px rgba(37, 99, 235, 0.5);
    }

    #chatbot-header {
        padding: 20px;
    }

    #chatbot-header h3 {
        font-size: 20px;
    }

    #chatbot-messages {
        padding: 16px;
    }

    .message-content {
        max-width: 85%;
        font-size: 15px;
    }

    #chatbot-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 16px;
    }

    #chatbot-input-container {
        padding: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom)); /* iOS notch support */
    }

    .quick-action-btn {
        font-size: 13px;
        padding: 8px 14px;
    }
}

/* Small mobile phones */
@media (max-width: 380px) {
    #chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    #chatbot-container {
        bottom: 16px;
        right: 16px;
    }

    .message-content {
        max-width: 90%;
        font-size: 14px;
    }
}

/* Quick action buttons */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-action-btn {
    padding: 6px 12px;
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background: #475569;
    border-color: #2563eb;
}
