.chatbot-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 1049;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chatbot-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}
.chatbot-toggle-btn svg {
    width: 24px;
    height: 24px;
}

.chatbot-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: #1a1a2e;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.chatbot-panel.open {
    right: 0;
}

.chatbot-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #1e1e3a, #2a2a4a);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chatbot-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.chatbot-header-title .chatbot-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
}
.chatbot-header-title .chatbot-icon svg {
    width: 16px;
    height: 16px;
    color: #fff;
}
.chatbot-header-title h6 {
    margin: 0;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
}
.chatbot-header-title .form-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    margin-top: 2px;
}
.chatbot-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.chatbot-close-btn:hover {
    color: #fff;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.chat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 4px;
}
.chat-msg.assistant h1,
.chat-msg.assistant h2,
.chat-msg.assistant h3,
.chat-msg.assistant h4 {
    color: #a5b4fc;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 8px 0 4px;
}
.chat-msg.assistant h1:first-child,
.chat-msg.assistant h2:first-child,
.chat-msg.assistant h3:first-child {
    margin-top: 0;
}
.chat-msg.assistant ul,
.chat-msg.assistant ol {
    padding-left: 20px;
    margin: 4px 0;
}
.chat-msg.assistant li {
    margin-bottom: 2px;
}
.chat-msg.assistant code {
    background: rgba(0,0,0,0.3);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.82rem;
}
.chat-msg.assistant table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.82rem;
}
.chat-msg.assistant th,
.chat-msg.assistant td {
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.1);
    text-align: left;
}
.chat-msg.assistant th {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}
.chat-msg.assistant strong {
    color: #c4b5fd;
}
.chat-msg.system {
    align-self: center;
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    font-size: 0.8rem;
    text-align: center;
    border: 1px solid rgba(99, 102, 241, 0.2);
    max-width: 95%;
}

.chat-msg-time {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
    margin-top: 4px;
    text-align: right;
}

.chatbot-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: none;
}
.chatbot-typing.visible {
    display: flex;
    align-items: center;
    gap: 4px;
}
.chatbot-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6366f1;
    animation: typingBounce 1.4s ease-in-out infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.chatbot-quick-actions {
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
}
.chatbot-quick-btn {
    padding: 4px 10px;
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.chatbot-quick-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

.chatbot-automation-suggestions {
    padding: 6px 16px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}
.automation-suggestions-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 4px;
}
.automation-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.chatbot-automation-suggest-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 14px;
    border: 1px solid rgba(250, 204, 21, 0.25);
    background: rgba(250, 204, 21, 0.08);
    color: #fde68a;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.chatbot-automation-suggest-btn:hover {
    background: rgba(250, 204, 21, 0.18);
    border-color: rgba(250, 204, 21, 0.4);
}
.chatbot-automation-suggest-btn svg {
    flex-shrink: 0;
}

.chatbot-input-area {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}
.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.chatbot-input-wrapper textarea {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #e2e8f0;
    padding: 10px 14px;
    font-size: 0.875rem;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.chatbot-input-wrapper textarea:focus {
    border-color: rgba(99, 102, 241, 0.5);
}
.chatbot-input-wrapper textarea::placeholder {
    color: rgba(255, 255, 255, 0.3);
}
.chatbot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.chatbot-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.chatbot-send-btn svg {
    width: 18px;
    height: 18px;
}

.chatbot-action-confirm {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
}
.chatbot-action-confirm p {
    margin: 0 0 8px;
    font-size: 0.82rem;
    color: #a5b4fc;
}
.chatbot-action-confirm .btn-group {
    display: flex;
    gap: 8px;
}
.chatbot-action-confirm .btn-confirm {
    padding: 4px 14px;
    border-radius: 6px;
    border: none;
    background: #6366f1;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
}
.chatbot-action-confirm .btn-cancel {
    padding: 4px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: transparent;
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    cursor: pointer;
}

.chatbot-download-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    margin-top: 4px;
    transition: opacity 0.15s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}
.chatbot-download-btn:hover {
    opacity: 0.9;
    color: #fff;
    text-decoration: none;
}

.chatbot-escalation-notice {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    font-size: 0.8rem;
    color: #fbbf24;
}

.chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1048;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.chatbot-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.chatbot-new-conv-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
    margin-right: 4px;
}
.chatbot-new-conv-btn:hover {
    color: #fff;
}

@media (max-width: 480px) {
    .chatbot-panel {
        width: 100%;
        right: -100%;
    }
    .chatbot-toggle-btn {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
}
