/* Entel Chatbots - Message Styles */

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: #f8f9fa;
    scroll-behavior: smooth;
    color: #000000;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Inline Messages Area */
.chatbot-inline-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    min-height: 300px;
    max-height: 400px;
}

/* Messages */
.message {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.message-bubble:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.message.user .message-bubble {
    background-color: #2271b1;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background-color: #f6f7f7;
    color: #000000;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.message-content {
    font-size: 14px;
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: inherit;
}

/* Markdown styling */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 0.8em 0 0.5em 0;
    font-weight: 600;
    line-height: 1.2;
}

.message-content h1 { font-size: 1.5em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.1em; }
.message-content h4 { font-size: 1em; }
.message-content h5 { font-size: 0.9em; }
.message-content h6 { font-size: 0.8em; }

.message-content p {
    margin: 0.5em 0;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 0.8em 0;
    overflow-x: auto;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    line-height: 1.3;
}

.message-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.message-content blockquote {
    border-left: 3px solid rgba(0, 0, 0, 0.2);
    margin: 0.8em 0;
    padding-left: 12px;
    color: rgba(0, 0, 0, 0.7);
    font-style: italic;
}

.message-content ul,
.message-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.message-content li {
    margin: 0.2em 0;
    line-height: 1.4;
}

.message-content a {
    color: #2271b1;
    text-decoration: underline;
}

.message-content a:hover {
    color: #135e96;
    text-decoration: none;
}

.message-content hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    margin: 1em 0;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.8em 0;
    font-size: 0.9em;
}

.message-content th,
.message-content td {
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 6px 8px;
    text-align: left;
}

.message-content th {
    background: rgba(0, 0, 0, 0.1);
    font-weight: 600;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding: 0 4px;
    gap: 12px;
}

.message-timestamp {
    font-size: 10px;
    color: #666;
    opacity: 0.7;
    font-family: monospace;
}

.message.user .message-footer {
    justify-content: space-between;
}

.message.user .message-timestamp {
    order: 1;
}

.message.user .message-actions {
    order: 2;
}

.message.assistant .message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 20px;
    padding: 0;
    margin: 0;
}

.message.assistant .footer-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-height: 20px;
    width: 100%;
    margin: 0;
    padding: 0;
}

.message.assistant .footer-left .message-timestamp {
    margin: 0;
    line-height: 1.4;
    display: flex;
    align-items: center;
}

.message.assistant .footer-left .actions-left,
.message.assistant .footer-left .actions-horizontal {
    display: flex;
    gap: 6px;
    align-items: center;
    min-height: 20px;
}

.message-actions {
    opacity: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.actions-left,
.actions-right {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    min-height: 20px;
}

.actions-horizontal {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    min-height: 20px;
    margin-left: auto;
    margin-right: 0;
    padding: 0;
}

.action-button.rated {
    color: #46b450 !important;
    background: transparent !important;
}

.action-button:disabled,
.action-button.disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    background: transparent !important;
}

/* User Message Regenerate Button */
.user-message-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 6px;
    margin-bottom: 8px;
    padding-left: 0;
    margin-left: 0;
}

.user-regenerate-container {
    display: flex;
    align-items: center;
}

.user-regenerate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(34, 113, 177, 0.08) !important;
    border: 1px solid rgba(34, 113, 177, 0.15) !important;
    border-radius: 50%;
    color: #2271b1 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    outline: none !important;
    box-shadow: none !important;
}

.user-regenerate-btn:hover {
    background: #3f8d9b !important;
    border-color: #3f8d9b !important;
    box-shadow: 0 2px 4px rgba(63, 141, 155, 0.3) !important;
}

.user-regenerate-btn:active {
    transform: translateY(0);
    box-shadow: none !important;
}

.user-regenerate-btn .action-icon {
    flex-shrink: 0;
}

/* Unanswered Regenerate Button - Hide Text */
.regenerate-unanswered-btn .regenerate-label {
    display: none;
}

/* Profile Pictures */
.message.assistant .message-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 85%;
}

.message.assistant .profile-picture {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Bubble Alignment */
.bubble-alignment-left .message.user {
    align-items: flex-start;
}

.bubble-alignment-left .message.assistant {
    align-items: flex-end;
}

.bubble-alignment-left .message.user .message-bubble {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 18px;
}

.bubble-alignment-left .message.assistant .message-bubble {
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
}

.bubble-alignment-left .message.user .message-timestamp {
    text-align: left;
}

.bubble-alignment-left .message.assistant .message-timestamp {
    text-align: right;
}

.bubble-alignment-left .message.assistant {
    flex-direction: row-reverse;
}

.bubble-alignment-left .message.assistant .profile-picture {
    margin-right: 0;
    margin-left: 8px;
}

.bubble-alignment-left .message.assistant .message-wrapper {
    align-items: flex-end;
}
