/* Button Container */
#spayo-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Floating Trigger Button */
#spayo-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: transform 0.3s ease;
}

#spayo-chat-trigger:hover {
    transform: scale(1.05);
}

#spayo-chat-trigger img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Chat Modal */
#spayo-chat-modal {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 550px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
}

#spayo-chat-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.spayo-header {
    padding: 15px 20px;
    background: #f7f7f9;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.spayo-header-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #333;
}

.spayo-header-title img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    border-radius: 50%;
}

#spayo-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: #666;
}

/* Chat History */
#spayo-chat-history {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fff;
}

.spayo-message {
    margin-bottom: 15px;
    line-height: 1.5;
    font-size: 15px;
    max-width: 85%;
}

.spayo-message.system-message, 
.spayo-message.ai-message {
    background: #f1f3f5;
    padding: 10px 15px;
    border-radius: 12px 12px 12px 2px;
    color: #333;
    align-self: flex-start;
    margin-right: auto;
}

.spayo-message.user-message {
    background: #0073aa;
    color: #fff;
    padding: 10px 15px;
    border-radius: 12px 12px 2px 12px;
    margin-left: auto;
    text-align: right;
}

/* Input Area */
.spayo-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
}

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

#spayo-user-input:focus {
    border-color: #0073aa;
}

.spayo-input-area button {
    background: none;
    border: none;
    cursor: pointer;
    color: #0073aa;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.spayo-input-area button:hover {
    color: #005177;
}

#spayo-mic-btn.recording {
    color: #dc3545;
    animation: pulse 1.5s infinite;
}

#spayo-voice-status {
    font-size: 12px;
    color: #dc3545;
    text-align: center;
    padding-bottom: 5px;
    font-weight: bold;
}

/* Typing Indicator CSS logic (cursor) */
.typing-cursor::after {
    content: '|';
    animation: blink 1s infinite;
}

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

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

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #spayo-chat-trigger {
        width: 50px;
        height: 50px;
    }
    
    #spayo-chat-modal {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        z-index: 10000;
    }
    
    .spayo-header {
        padding-top: 20px; /* Safe area for mobile status bars */
    }
}