/* Shared conversation styles for both live chat and HTML export */

.conversation {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
    overflow-y: auto;
    flex-grow: 1;
    word-wrap: break-word;
    white-space: normal;
}

.message {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease-in;
    margin: 10px 0;
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 15px;
    border-radius: 10px;
    position: relative;
    word-wrap: break-word;
}

.user .message-content {
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 3px;
}

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

.message-header {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 14px;
    opacity: 0.9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user .message-header {
    text-align: right;
    justify-content: flex-end;
}

.bot .message-header {
    color: #666;
}

.copy-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    color: #666;
    transition: all 0.2s ease;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.copy-button:hover {
    background-color: #e0e0e0;
    opacity: 1;
    color: #333;
}

.copy-button:active {
    background-color: #d0d0d0;
}

.copy-button svg {
    width: 14px;
    height: 14px;
}

.token-info {
    background-color: #e8f4f8;
    border: 1px solid #b8e6f0;
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #2c5e7a;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.message-text {
    margin: 0;
}

/* Rendered markdown styles */
.rendered-markdown {
    line-height: 1.6;
}

.rendered-markdown h1,
.rendered-markdown h2,
.rendered-markdown h3,
.rendered-markdown h4,
.rendered-markdown h5,
.rendered-markdown h6 {
    margin: 16px 0 8px 0;
    color: #333;
    font-weight: 600;
}

.rendered-markdown h1 {
    font-size: 1.5em;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
}

.rendered-markdown h2 {
    font-size: 1.3em;
}

.rendered-markdown h3 {
    font-size: 1.1em;
}

.rendered-markdown p {
    margin: 8px 0;
}

.rendered-markdown ul,
.rendered-markdown ol {
    margin: 8px 0;
    padding-left: 20px;
}

.rendered-markdown li {
    margin: 4px 0;
}

.rendered-markdown blockquote {
    border-left: 4px solid #ddd;
    margin: 8px 0;
    padding: 0 16px;
    color: #666;
    background-color: #f9f9f9;
}

.rendered-markdown pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 12px 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.rendered-markdown code {
    background-color: #282c34;
    color: #abb2bf;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.rendered-markdown pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.rendered-markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.rendered-markdown th,
.rendered-markdown td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.rendered-markdown th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.rendered-markdown a {
    color: #007bff;
    text-decoration: none;
}

.rendered-markdown a:hover {
    text-decoration: underline;
}

/* Hidden textarea for raw markdown */
.raw-markdown-content {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Message timestamp styling */
.message-timestamp {
    font-size: 11px;
    margin-top: 12px;
    font-style: normal;
}

.user-timestamp {
    text-align: left;
    color: white;
}

.bot-timestamp {
    text-align: right;
    color: #888;
}

/* Loading animation for chatbot response placeholder */
.loading-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-style: italic;
}

.loading-dots {
    display: inline-flex;
    gap: 2px;
}

.loading-dots span {
    width: 4px;
    height: 4px;
    background-color: #666;
    border-radius: 50%;
    animation: loadingDots 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

@media (max-width: 768px) {
    .message-content {
        max-width: 85%;
    }
}

@media print {
    .message {
        page-break-inside: avoid;
    }
}