/* ===================================
   VMO CHAT MESSAGE FORMATTING STYLES
   Enhances readability with proper spacing,
   list formatting, and typography
   =================================== */

/* ✅ Typing cursor for synchronized text reveal */
.vmo-typing-cursor {
    display: inline;
    color: #4a90d9;
    font-weight: bold;
    animation: vmo-cursor-blink 0.8s steps(1) infinite;
}

@keyframes vmo-cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Message Text Container */
.vmo-message-text {
    line-height: 1.6;
    color: #333;
    font-size: 14px;
}

.vmo-ai-message .vmo-message-text {
    color: #2c3e50;
}

.vmo-user-message .vmo-message-text {
    color: #ffffff;
}

/* Paragraphs */
.vmo-message-text p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.vmo-message-text p:last-child {
    margin-bottom: 0;
}

/* Lists */
.vmo-message-text ul,
.vmo-message-text ol {
    margin: 8px 0 12px 0;
    padding-left: 24px;
}

.vmo-message-text ul {
    list-style-type: disc;
}

.vmo-message-text ol {
    list-style-type: decimal;
}

.vmo-message-text li {
    margin: 4px 0;
    line-height: 1.5;
}

.vmo-message-text li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.vmo-message-text ul ul,
.vmo-message-text ol ul,
.vmo-message-text ul ol,
.vmo-message-text ol ol {
    margin: 4px 0;
    padding-left: 20px;
}

.vmo-message-text ul ul {
    list-style-type: circle;
}

.vmo-message-text ul ul ul {
    list-style-type: square;
}

/* Text Formatting */
.vmo-message-text strong {
    font-weight: 600;
    color: #1a1a1a;
}

.vmo-ai-message .vmo-message-text strong {
    color: #2c3e50;
}

.vmo-user-message .vmo-message-text strong {
    color: #ffffff;
    font-weight: 700;
}

.vmo-message-text em {
    font-style: italic;
}

.vmo-message-text code {
    background: #f4f4f4;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #d63384;
}

.vmo-user-message .vmo-message-text code {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* Line Breaks */
.vmo-message-text br {
    display: block;
    content: "";
    margin: 4px 0;
}

/* Headings (if markdown headers are converted) */
.vmo-message-text h1,
.vmo-message-text h2,
.vmo-message-text h3,
.vmo-message-text h4 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.vmo-message-text h1 {
    font-size: 18px;
}

.vmo-message-text h2 {
    font-size: 16px;
}

.vmo-message-text h3 {
    font-size: 15px;
}

.vmo-message-text h4 {
    font-size: 14px;
}

/* Links */
.vmo-message-text a {
    color: #0066cc;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.vmo-message-text a:hover {
    color: #004499;
}

.vmo-user-message .vmo-message-text a {
    color: #ffffff;
    text-decoration: underline;
}

/* Blockquotes (if implemented) */
.vmo-message-text blockquote {
    border-left: 3px solid #0066cc;
    padding-left: 12px;
    margin: 12px 0;
    color: #666;
    font-style: italic;
}

/* Code Blocks (if implemented) */
.vmo-message-text pre {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
}

.vmo-message-text pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: #333;
    font-size: 13px;
}

/* Improve overall message spacing */
.vmo-message-content {
    padding: 12px 16px;
}

.vmo-user-message-content {
    padding: 10px 14px;
}

/* Ensure proper spacing between consecutive messages */
.vmo-ai-message + .vmo-ai-message,
.vmo-user-message + .vmo-user-message {
    margin-top: 8px;
}

.vmo-ai-message + .vmo-user-message,
.vmo-user-message + .vmo-ai-message {
    margin-top: 16px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .vmo-message-text {
        font-size: 13px;
    }
    
    .vmo-message-text ul,
    .vmo-message-text ol {
        padding-left: 20px;
    }
    
    .vmo-message-content {
        padding: 10px 12px;
    }
}

/* Improve readability for long messages */
.vmo-message-text {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Special formatting for numbered steps */
.vmo-message-text ol li::marker {
    font-weight: 600;
    color: #0066cc;
}

/* Better visual hierarchy */
.vmo-ai-message .vmo-message-text > *:first-child {
    margin-top: 0;
}

.vmo-ai-message .vmo-message-text > *:last-child {
    margin-bottom: 0;
}

/* ===================================
   QUOTE FEATURE STYLES
   Allows users to select and quote text
   from previous messages
   =================================== */

/* Quote popup button that appears on text selection */
.vmo-quote-popup {
    position: fixed;
    z-index: 999999;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(74, 144, 226, 0.4);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 10px rgba(74, 144, 226, 0.2);
    padding: 0;
    display: none;
    transform: translateX(-50%);
    animation: vmo-quote-popup-appear 0.15s ease-out;
    pointer-events: auto;
}

.vmo-quote-popup.visible {
    display: block;
}

@keyframes vmo-quote-popup-appear {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.vmo-quote-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: #e0e0e0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.vmo-quote-btn:hover {
    background: rgba(74, 144, 226, 0.2);
    color: #4a90d9;
}

.vmo-quote-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Quote preview in input area */
.vmo-quote-preview {
    background: rgba(74, 144, 226, 0.1);
    border-left: 3px solid #4a90d9;
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    margin-bottom: 8px;
    position: relative;
    animation: vmo-quote-preview-appear 0.2s ease-out;
}

@keyframes vmo-quote-preview-appear {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vmo-quote-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.vmo-quote-preview-label {
    font-size: 11px;
    color: #4a90d9;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vmo-quote-preview-remove {
    background: transparent;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.vmo-quote-preview-remove:hover {
    color: #ff6b6b;
}

.vmo-quote-preview-text {
    font-size: 12px;
    color: #a0a0a0;
    font-style: italic;
    line-height: 1.4;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Quoted text in sent messages */
.vmo-quoted-text {
    background: rgba(74, 144, 226, 0.08);
    border-left: 2px solid rgba(74, 144, 226, 0.5);
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 0 4px 4px 0;
}

.vmo-quoted-text-label {
    font-size: 10px;
    color: #4a90d9;
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.vmo-quoted-text-content {
    font-size: 12px;
    color: #888;
    font-style: italic;
    line-height: 1.4;
}

.vmo-user-message .vmo-quoted-text {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: rgba(255, 255, 255, 0.4);
}

.vmo-user-message .vmo-quoted-text-label {
    color: rgba(255, 255, 255, 0.7);
}

.vmo-user-message .vmo-quoted-text-content {
    color: rgba(255, 255, 255, 0.8);
}

/* ===================================
   RESEARCH CONFIRMATION UI
   =================================== */
.vmo-research-confirmation {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin: 10px 0;
}

.vmo-research-confirmation h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #2c3e50;
}

.vmo-research-confirmation p {
    margin: 10px 0;
    color: #495057;
    line-height: 1.6;
}

.vmo-research-confirmation ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.vmo-research-confirmation li {
    padding: 8px 12px;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 6px;
    font-size: 13px;
    color: #2c3e50;
}

.vmo-confirmation-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.vmo-btn-confirm-research,
.vmo-btn-add-more-info {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vmo-btn-confirm-research {
    background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.vmo-btn-confirm-research:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.4);
}

.vmo-btn-confirm-research:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.vmo-btn-add-more-info {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.vmo-btn-add-more-info:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .vmo-research-confirmation ul {
        grid-template-columns: 1fr;
    }
    
    .vmo-confirmation-actions {
        flex-direction: column;
    }
}

/* ===================================
   VMO DOCUMENT VIEWER
   Professional MS Word-style document
   container for long AI-generated docs
   =================================== */

.vmo-doc-viewer {
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    margin: 14px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Georgia', 'Cambria', 'Times New Roman', Times, serif;
    scroll-behavior: smooth;
}

.vmo-doc-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: linear-gradient(to bottom, #f8f9fa, #eef0f2);
    border-bottom: 1px solid #d0d0d0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.vmo-doc-viewer-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.vmo-doc-viewer-title .vmo-doc-icon {
    font-size: 16px;
    filter: none;
}

.vmo-doc-viewer-actions {
    display: flex;
    gap: 6px;
}

.vmo-doc-viewer-actions button {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    color: #555;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.15s ease;
}

.vmo-doc-viewer-actions button:hover {
    background: #f0f0f0;
    border-color: #999;
    color: #333;
}

.vmo-doc-viewer-body {
    padding: 32px 40px;
    color: #1a1a1a;
    font-size: 14.5px;
    line-height: 1.75;
    letter-spacing: 0.01em;
}

/* Document headings — clean, authoritative */
.vmo-doc-viewer-body h1,
.vmo-doc-viewer-body h2,
.vmo-doc-viewer-body h3,
.vmo-doc-viewer-body h4 {
    font-family: 'Georgia', 'Cambria', 'Times New Roman', Times, serif;
    color: #111;
    margin-top: 24px;
    margin-bottom: 10px;
    line-height: 1.35;
}

.vmo-doc-viewer-body h1 {
    font-size: 22px;
    font-weight: 700;
    border-bottom: 2px solid #333;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.vmo-doc-viewer-body h2 {
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid #ccc;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.vmo-doc-viewer-body h3 {
    font-size: 16px;
    font-weight: 600;
}

.vmo-doc-viewer-body h4 {
    font-size: 14.5px;
    font-weight: 600;
    color: #333;
}

/* Paragraphs */
.vmo-doc-viewer-body p {
    margin: 0 0 14px 0;
    text-align: left;
    color: #1a1a1a;
}

.vmo-doc-viewer-body p:last-child {
    margin-bottom: 0;
}

/* Lists */
.vmo-doc-viewer-body ul,
.vmo-doc-viewer-body ol {
    margin: 8px 0 14px 0;
    padding-left: 28px;
    color: #1a1a1a;
}

.vmo-doc-viewer-body ul {
    list-style-type: disc;
}

.vmo-doc-viewer-body ol {
    list-style-type: decimal;
}

.vmo-doc-viewer-body li {
    margin: 5px 0;
    line-height: 1.65;
}

.vmo-doc-viewer-body li::marker {
    color: #444;
}

/* Bold / italic inside doc */
.vmo-doc-viewer-body strong {
    font-weight: 700;
    color: #111;
}

.vmo-doc-viewer-body em {
    font-style: italic;
}

/* Horizontal rules */
.vmo-doc-viewer-body hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 20px 0;
}

/* Tables */
.vmo-doc-viewer-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 13.5px;
}

.vmo-doc-viewer-body th,
.vmo-doc-viewer-body td {
    border: 1px solid #ccc;
    padding: 8px 12px;
    text-align: left;
}

.vmo-doc-viewer-body th {
    background: #f5f5f5;
    font-weight: 700;
    color: #222;
}

.vmo-doc-viewer-body tr:nth-child(even) {
    background: #fafafa;
}

/* Blockquotes */
.vmo-doc-viewer-body blockquote {
    border-left: 4px solid #4a90d9;
    padding: 10px 16px;
    margin: 14px 0;
    background: #f8fafc;
    color: #333;
    font-style: italic;
}

/* Scrollbar styling */
.vmo-doc-viewer::-webkit-scrollbar {
    width: 8px;
}

.vmo-doc-viewer::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.vmo-doc-viewer::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

.vmo-doc-viewer::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Announcement text above doc viewer */
.vmo-doc-announcement {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 6px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .vmo-doc-viewer-body {
        padding: 20px 18px;
        font-size: 13.5px;
    }

    .vmo-doc-viewer {
        max-height: 450px;
    }

    .vmo-doc-viewer-body h1 { font-size: 19px; }
    .vmo-doc-viewer-body h2 { font-size: 16px; }
}

/* Print-friendly */
@media print {
    .vmo-doc-viewer {
        max-height: none;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .vmo-doc-viewer-header {
        display: none;
    }
}
