.chatbot-widget-container {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 1050;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.chatbot-toggle-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: transparent;
    color: #0f172a; /* Dark Navy Blue for outer SVG */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    box-shadow: none;
}

.chatbot-toggle-btn svg {
    width: 100% !important;
    height: 100% !important;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    animation: premiumPulse 2.5s infinite;
}

@keyframes premiumPulse {
    0% { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)) drop-shadow(0 0 0 rgba(15, 23, 42, 0.5)); }
    70% { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)) drop-shadow(0 0 15px rgba(15, 23, 42, 0)); }
    100% { filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)) drop-shadow(0 0 0 rgba(15, 23, 42, 0)); }
}

@keyframes botBlink {
    0%, 92%, 100% { transform: scaleY(1); }
    96% { transform: scaleY(0.1); }
}

.bot-eye {
    transform-origin: center 47px;
    animation: botBlink 4s infinite;
}

.bot-face-bg {
    fill: #eab308; /* Gold inner face */
}

.chatbot-toggle-btn:hover {
    transform: translateY(-5px) scale(1.08);
}

.chatbot-toggle-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}


.chatbot-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 400px;
    height: 65vh;
    max-height: 700px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    box-shadow: 0 15px 45px rgba(0,0,0,0.15), 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

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

.chatbot-header {
    background: #0f172a;
    color: #eab308;
    padding: 16px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.chatbot-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header-title i {
    font-size: 20px;
}

.chatbot-header-title span {
    font-weight: 600;
    font-size: 16px;
}

.chatbot-header-actions button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: color 0.2s;
}

.chatbot-header-actions button:hover {
    color: white;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #f8f9fa;
}

.chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-break: break-word;
}

.chatbot-message p {
    margin-bottom: 0.5rem;
}

.chatbot-message p:last-child {
    margin-bottom: 0;
}

.chatbot-message.user {
    align-self: flex-end;
    background: #0f172a;
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.chatbot-message.assistant {
    align-self: flex-start;
    background: white;
    color: #333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0,0,0,0.03);
}

.chatbot-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #f8f9fa;
}

.chatbot-input:focus {
    border-color: #0f172a;
    background: white;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

.chatbot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #0f172a;
    color: #eab308;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
    background: #1e293b;
}

.chatbot-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chatbot-loading {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    align-self: flex-start;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-bottom-left-radius: 4px;
}

.chatbot-loading .dot {
    width: 8px;
    height: 8px;
    background: #eab308;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.chatbot-loading .dot:nth-child(1) { animation-delay: -0.32s; }
.chatbot-loading .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* History Sidebar */
.chatbot-history-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.chatbot-history-panel.active {
    transform: translateX(0);
}

.chatbot-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

.chatbot-history-item {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.chatbot-history-item:hover {
    background: #f8f9fa;
}

.chatbot-history-title {
    font-weight: 500;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.chatbot-history-date {
    font-size: 12px;
    color: #888;
}

/* Markdown styling inside messages */
.chatbot-message pre {
    background: #f1f3f5;
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 12px;
}

.chatbot-message code {
    font-family: monospace;
    background: #f1f3f5;
    padding: 2px 4px;
    border-radius: 4px;
}

.chatbot-message table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.chatbot-message th, .chatbot-message td {
    border: 1px solid #ddd;
    padding: 8px;
    font-size: 12px;
}

.chatbot-message th {
    background: #f8f9fa;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .chatbot-widget-container {
        bottom: 95px; /* Ensure it stays above bottom mobile nav */
        right: 15px;
    }
    
    .chatbot-window {
        position: fixed;
        bottom: 165px; /* Open above the toggle button */
        right: 15px;
        left: 15px;
        width: auto; /* Take up available width with 15px padding */
        height: 60vh;
        max-height: calc(100vh - 180px);
        transform-origin: bottom right;
    }
}

/* Dark Mode for Chatbot Icon */
body[data-theme='dark'] .chatbot-toggle-btn {
    color: #ffffff;
}

