.sitesense-chat-widget {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
}

.sitesense-chat-widget[data-position="bottom-right"] { right: 20px; }
.sitesense-chat-widget[data-position="bottom-left"] { left: 20px; }

.sitesense-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sitesense-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.sitesense-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: 90vw;
    height: 500px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
}

.sitesense-chat-widget[data-position="bottom-right"] .sitesense-chat-window { right: 0; }
.sitesense-chat-widget[data-position="bottom-left"] .sitesense-chat-window { left: 0; }

.sitesense-chat-header {
    padding: 15px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.sitesense-chat-header .chat-title { font-weight: 600; font-size: 16px; }

.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    opacity: 0.8;
}

.chat-close:hover { opacity: 1; }

.sitesense-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.message { margin-bottom: 12px; display: flex; flex-direction: column; }
.message.user { align-items: flex-end; }
.message.bot { align-items: flex-start; }

.message .message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.user .message-content {
    background: #0073aa;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message .message-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
}

.message .message-sources {
    margin-top: 5px;
    font-size: 11px;
    color: #666;
}

.message .message-sources a {
    color: #0073aa;
    text-decoration: none;
    margin-right: 10px;
}

.message .message-sources a:hover { text-decoration: underline; }

.message .message-feedback {
    margin-top: 5px;
    display: flex;
    gap: 8px;
}

.message .message-feedback button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.message .message-feedback button:hover {
    background: #f1f1f1;
    border-color: #999;
}

.message .message-feedback button.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.typing-indicator {
    display: flex;
    padding: 10px 14px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    max-width: 60px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background: #999;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite both;
}

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

@keyframes typing {
    0% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 0.6; }
}

.sitesense-chat-input-container {
    padding: 10px;
    background: white;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.sitesense-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    max-height: 100px;
    overflow-y: auto;
}

.sitesense-suggestions .suggestion-chip {
    padding: 6px 12px;
    background: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    color: #555;
    white-space: nowrap;
    transition: all 0.2s;
}

.sitesense-suggestions .suggestion-chip:hover {
    background: #e1e1e1;
    border-color: #bbb;
}

.sitesense-input-group {
    display: flex;
    gap: 8px;
}

.sitesense-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.sitesense-chat-input:focus { border-color: #0073aa; }

.sitesense-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #0073aa;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sitesense-chat-send:hover {
    background: #005a87;
    transform: scale(1.05);
}

.sitesense-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sitesense-chat-footer {
    text-align: center;
    font-size: 10px;
    color: #999;
    padding: 5px 0 2px;
}

.message.error .message-content {
    background: #f8d7da !important;
    color: #721c24 !important;
}

@media screen and (max-width: 480px) {
    .sitesense-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 70px;
        right: 0 !important;
        left: 0 !important;
        margin: 0 auto;
    }
    
    .sitesense-chat-toggle {
        width: 50px;
        height: 50px;
    }
}