/* Main container - use WordPress admin variables for compatibility */
#autonomite-agent-chat-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e4e7;
    color: #3c434a;
}

.aa-header {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #1d2327;
}

/* Button styling - applies to all buttons in the container */
#autonomite-agent-chat-container button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    padding: 10px 20px;
    background-color: #fc7244;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    margin: 0 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

#autonomite-agent-chat-container button:hover {
    background-color: #e85a2c;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

#autonomite-agent-chat-container button:focus {
    outline: 2px solid #fc7244;
    outline-offset: 2px;
}

/* Specific styling for different buttons */
#aaStartVoiceButton {
    background-color: #2271b1; /* WordPress blue */
}

#aaStartVoiceButton:hover {
    background-color: #135e96;
}

#aaStartTextButton {
    background-color: #fc7244; /* Keep brand color */
}

#aaLeaveCallButton {
    background-color: #d63638; /* WordPress red */
}

#aaLeaveCallButton:hover {
    background-color: #b32d2e;
}

#aaTextChatSendButton {
    min-width: 80px;
    margin-left: 10px;
}

/* Configuration warning styles */
.aa-config-needed {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.aa-config-needed:hover {
    background-color: #f1bec7;
    color: #721c24;
}

.aa-config-indicator {
    margin-right: 8px;
    font-size: 14px;
}

.aa-warning {
    background-color: #fff3cd;
    color: #856404;
    padding: 10px 15px;
    border-radius: 4px;
    margin: 10px 0;
    border-left: 4px solid #ffeeba;
    font-size: 14px;
}

/* Audio Wave */
.aa-wave-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px auto;
    height: 200px;
    width: 100%;  /* Ensure wrapper takes full width */
}

#wave-container {
    display: none;  /* Hidden by default */
    width: 200px;
    height: 200px;
    opacity: 0;
    transition: all 0.3s ease-in-out;
    position: relative;  /* Ensure proper stacking */
    margin: 0 auto;  /* Center the container */
}

#wave-container.visible {
    opacity: 1;
    display: flex !important;  /* Force display when visible */
    align-items: center;
    justify-content: center;
}

#audioVisualizer {
    display: block;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: transparent;  /* Transparent background to only show orange visualizer */
    margin: 0 auto;  /* Center the canvas */
}

/* Transcript and Text Chat UI */
#aaTranscript, #aaTextChatMessages {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    height: 380px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    font-size: 15px;
    line-height: 1.5;
    scroll-behavior: smooth;
}

/* Chat message bubbles */
#aaTranscript p, .aa-text-chat-message {
    position: relative;
    max-width: 80%;
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    word-wrap: break-word;
    clear: both;
}

/* AI messages */
.aa-text-chat-ai {
    float: left;
    background: #edf6ff;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    margin-right: auto;
    border-left: 3px solid #2271b1;
}

/* User messages */
.aa-text-chat-user {
    float: right;
    background: #f0f7ee;
    color: #2c3e50;
    border-bottom-right-radius: 4px;
    margin-left: auto;
    border-right: 3px solid #4ab866;
}

/* System messages */
.aa-text-chat-system {
    clear: both;
    float: none;
    margin: 16px auto;
    max-width: 90%;
    background: #fff8e1;
    color: #827717;
    border-bottom: 3px solid #ffc107;
    font-size: 14px;
    font-style: italic;
}

/* Message styling with speaker indicated in the transcript */
#aaTranscript p {
    float: left;
    background: #edf6ff;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    margin-right: auto;
    border-left: 3px solid #2271b1;
}

#aaTranscript p[data-speaker="User"] {
    float: right;
    background: #f0f7ee;
    color: #2c3e50;
    border-bottom-right-radius: 4px;
    margin-left: auto;
    margin-right: 0;
    border-right: 3px solid #4ab866;
    border-left: none;
}

#aaTranscript p[data-speaker="System"] {
    clear: both;
    float: none;
    margin: 16px auto;
    max-width: 90%;
    background: #fff8e1;
    color: #827717;
    border-left: none;
    border-bottom: 3px solid #ffc107;
    font-size: 14px;
    font-style: italic;
}

/* Speaker name styling */
#aaTranscript p strong, .aa-text-chat-message strong {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #505050;
    opacity: 0.75;
}

/* Custom scrollbar */
.aa-transcript::-webkit-scrollbar {
    width: 8px;
}

.aa-transcript::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.aa-transcript::-webkit-scrollbar-thumb {
    background: #fc7244;
    border-radius: 4px;
}

.aa-transcript::-webkit-scrollbar-thumb:hover {
    background: #e85a2c;
}

/* Text input area styling */
.aa-text-input-area {
    display: flex;
    margin-top: 16px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#aaTextChatInput {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    color: #333;
    outline: none;
    transition: border-color 0.2s ease;
}

#aaTextChatInput:focus {
    border-color: #fc7244;
    box-shadow: 0 0 0 1px rgba(252, 114, 68, 0.2);
}

/* Status indicator */
#aaStatus {
    text-align: center;
    font-size: 16px;
    color: #555;
    margin: 16px 0;
    padding: 8px;
    font-weight: 500;
    background: #f5f5f5;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

/* Status states */
#aaStatus.active {
    background-color: #e6f6e6;
    color: #2e7d32;
}

#aaStatus.thinking {
    background-color: #e3f2fd;
    color: #0277bd;
}

#aaStatus.error {
    background-color: #ffebee;
    color: #c62828;
}

.aa-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin: 16px 0;
    width: 100%;
    gap: 8px;
}

/* Responsive design for smaller screens */
@media screen and (max-width: 600px) {
    #autonomite-agent-chat-container {
        padding: 16px;
        margin: 10px;
    }
    
    .aa-controls {
        flex-direction: column;
    }
    
    #autonomite-agent-chat-container button {
        width: 100%;
        margin: 6px 0;
    }
    
    #aaTranscript, #aaTextChatMessages {
        height: 300px;
    }
    
    .aa-text-input-area {
        flex-direction: column;
    }
    
    #aaTextChatInput {
        margin-bottom: 8px;
    }
    
    #aaTextChatSendButton {
        width: 100%;
        margin-left: 0;
    }
}

/* Conversation History Styles */
.conversation-history {
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
    padding-bottom: 20px;
}

.conversation-group {
    margin-bottom: 30px;
    position: relative;
}

.conversation-separator {
    text-align: center;
    margin: 20px 0 15px 0;
    position: relative;
}

.conversation-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #d0d0d0, transparent);
    z-index: 1;
}

.conversation-date {
    background: #f9f9f9;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: #666;
    border: 1px solid #e0e0e0;
    position: relative;
    z-index: 2;
    display: inline-block;
}

/* History message styling - slightly muted */
.history-message {
    opacity: 0.85;
    font-size: 14px;
}

.history-message .message-header {
    margin-bottom: 6px;
}

.history-message .message-content {
    color: #555;
}

.history-message.user-message {
    background: #f5fdf4;
    border-right-color: #91d49a;
}

.history-message.ai-message {
    background: #f7fbfe;
    border-left-color: #7bb3e0;
}

/* Load more conversations link */
.load-more-conversations {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #d0d0d0;
}

.load-more-link {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-block;
}

.load-more-link:hover {
    color: #135e96;
    background: #e7f3ff;
    text-decoration: none;
}

.load-more-link:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Jump to new messages button */
.jump-to-new-messages {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    animation: slideInUp 0.3s ease-out;
}

.jump-button {
    background: #2271b1 !important;
    color: white !important;
    border: none !important;
    border-radius: 25px !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3) !important;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: auto !important;
    margin: 0 !important;
}

.jump-button:hover {
    background: #135e96 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 113, 177, 0.4) !important;
}

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

/* Enhanced chat message styling for better consistency */
.chat-message {
    position: relative;
    max-width: 80%;
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    word-wrap: break-word;
    clear: both;
}

.chat-message.user-message {
    float: right;
    background: #f0f7ee;
    color: #2c3e50;
    border-bottom-right-radius: 4px;
    margin-left: auto;
    border-right: 3px solid #4ab866;
}

.chat-message.ai-message {
    float: left;
    background: #edf6ff;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    margin-right: auto;
    border-left: 3px solid #2271b1;
}

.message-header {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.message-content {
    font-size: 15px;
    line-height: 1.4;
}

