/* Endo Chatbot - Minimalist Light Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, 'Courier New', monospace;
    background: #f5f5f5;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.compact-header {
    background: #ffffff;
    color: #1a1a1a;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.app-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    color: #795548;
}

.app-subtitle {
    font-size: 13px;
    color: #666666;
    font-weight: 400;
}

.clear-button {
    background: transparent;
    border: 1px solid #d0d0d0;
    color: #666666;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.clear-button:hover {
    border-color: #9181c4;
    color: #9181c4;
    background: rgba(145, 129, 196, 0.08);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #ffffff;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 85%;
    animation: slideIn 0.3s ease-out;
}

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

/* Image Modal */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.2s ease-out;
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px;
}

.image-modal-content {
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-modal-header {
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.image-modal-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.image-modal-button {
    padding: 8px 16px;
    background: #9181c4;
    color: white;
    border: none;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s ease;
}

.image-modal-button:hover {
    background: #7a6aad;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 36px;
    color: white;
    cursor: pointer;
    font-weight: 300;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.image-modal-close:hover {
    opacity: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

/* Blockquote-only messages (source quotes) - no gray bubble */
.message-blockquote-only {
    width: 100%;
    max-width: 85%;  /* Teams-style width - not full width */
    padding: 0;
    margin: 12px 0;
    background: transparent !important;
    border: none !important;
    align-self: flex-start;
}

.message-blockquote-only .message-content {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

/* Document generation messages should be narrower */
.message.assistant:has(.document-actions) {
    max-width: 52%;
}

.message.error {
    align-self: center;
    max-width: 100%;
}

.message-content {
    padding: 12px 16px;
    border-radius: 8px;
    line-height: 1.6;
    font-size: 14px;
}

.message.user .message-content {
    background: #9181c4;
    color: white;
    border-radius: 8px 8px 2px 8px;
}

.message.assistant .message-content {
    background: #f5f5f5;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
    border-radius: 8px 8px 8px 2px;
}

.message.error .message-content {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.message-content p {
    margin: 8px 0;
}

.message-content ul,
.message-content ol {
    margin: 8px 0 8px 20px;
}

.message-content li {
    margin: 4px 0;
}

.message-content strong {
    font-weight: 600;
    color: #1a1a1a;
}

.message.user .message-content strong {
    color: white;
}

.message-content code {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    border: 1px solid #d0d0d0;
}

.message.user .message-content code {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Loading indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px 8px 8px 2px;
    color: #666666;
    font-size: 14px;
    max-width: 85%;
    align-self: flex-start;
    animation: slideIn 0.3s ease-out;
}

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

.loading-dots span {
    width: 6px;
    height: 6px;
    background: #9181c4;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

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

/* Direct quotes from source documents */
.message-content blockquote {
    margin: 12px 0;
    padding: 16px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #795548;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
    color: #1a1a1a;
    position: relative;
}

/* Database-specific blockquote colors */
.message-content blockquote.clinical-database {
    border-left: 4px solid #e74c3c;
}

.message-content blockquote.condition-database {
    border-left: 4px solid #27ae60;
}

/* Flatten nested blockquotes */
.message-content blockquote blockquote {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
}

/* Hide duplicate source headers in nested blockquotes */
.message-content blockquote blockquote .quote-source-header {
    display: none;
}

/* Dynamic quote source header */
.quote-source-header {
    display: inline-block;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    color: #9181c4;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 4px 8px;
    border: 1px solid #9181c4;
    border-radius: 4px;
    background: rgba(145, 129, 196, 0.08);
    transition: all 0.2s ease;
}

/* Links inside source headers */
.quote-source-header a {
    color: #9181c4;
    text-decoration: none;
    display: inline-block;
}

/* Hover effect - entire box fills with purple, text becomes white */
.quote-source-header:hover {
    background: #9181c4;
    color: white;
    cursor: pointer;
}

.quote-source-header:hover a {
    color: white;
    text-decoration: none;
}

/* Orange styling for property-only sources (Contact database) */
.quote-source-header.property-only,
.quote-source-header.contact-database {
    color: #e67e22;
    border-color: #e67e22;
    background: rgba(230, 126, 34, 0.08);
}

.quote-source-header.property-only a,
.quote-source-header.contact-database a {
    color: #e67e22;
}

.quote-source-header.property-only:hover,
.quote-source-header.contact-database:hover {
    background: #e67e22;
    color: white;
}

.quote-source-header.property-only:hover a,
.quote-source-header.contact-database:hover a {
    color: white;
}

/* Red styling for Clinical Database */
.quote-source-header.clinical-database {
    color: #e74c3c;
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.08);
}

.quote-source-header.clinical-database a {
    color: #e74c3c;
}

.quote-source-header.clinical-database:hover {
    background: #e74c3c;
    color: white;
}

.quote-source-header.clinical-database:hover a {
    color: white;
}

/* Green styling for Condition Database */
.quote-source-header.condition-database {
    color: #27ae60;
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.08);
}

.quote-source-header.condition-database a {
    color: #27ae60;
}

.quote-source-header.condition-database:hover {
    background: #27ae60;
    color: white;
}

.quote-source-header.condition-database:hover a {
    color: white;
}

/* Contact information tables (for property-only sources) */
.message-content table {
    width: 100%;
    max-width: 500px;
    margin: 12px 0;
    border-collapse: separate;
    border-spacing: 0;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #e67e22;
    border-radius: 4px;
    font-size: 14px;
    position: relative;
}

/* Hide table headers (no Property/Value row) */
.message-content table th,
.message-content table thead {
    display: none;
}

.message-content table td {
    padding: 10px 14px;
    color: #1a1a1a;
    border-bottom: 1px solid #eeeeee;
    line-height: 1.5;
}

.message-content table tr:last-child td {
    border-bottom: none;
}

.message-content table td:first-child {
    font-weight: 500;
    color: #666;
    width: 45%;
}

.message-content table td:last-child {
    color: #000;
    font-weight: 400;
}

.message-content blockquote p {
    margin: 8px 0;
}

.message-content blockquote p:first-of-type {
    margin-top: 0;
}

.message-content blockquote p:last-of-type {
    margin-bottom: 0;
}

.message-content blockquote strong {
    font-weight: 600;
    color: #1a1a1a;
}

.message-content blockquote em {
    font-style: italic;
}

.message-content blockquote a {
    color: #795548;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

/* Override for source header links - keep purple, no underline */
.message-content blockquote .quote-source-header a {
    color: #9181c4;
    text-decoration: none;
}

.message-content blockquote a:hover {
    color: #5d4037;
}

/* Override hover for source header links */
.message-content blockquote .quote-source-header:hover a {
    color: white;
    text-decoration: none;
}

.message-content blockquote ul,
.message-content blockquote ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-content blockquote li {
    margin: 4px 0;
}

.message-content blockquote br {
    display: block;
    content: "";
    margin: 4px 0;
}

.message-content blockquote code {
    background: #e5e7eb;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

/* Headers inside blockquotes */
.message-content blockquote h1,
.message-content blockquote h2,
.message-content blockquote h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 12px 0 8px 0;
    color: #1a1a1a;
    line-height: 1.4;
}

.message-content blockquote h4,
.message-content blockquote h5,
.message-content blockquote h6 {
    font-size: 15px;
    font-weight: 600;
    margin: 10px 0 6px 0;
    color: #1a1a1a;
    line-height: 1.4;
}

.message-content blockquote h1:first-of-type,
.message-content blockquote h2:first-of-type,
.message-content blockquote h3:first-of-type,
.message-content blockquote h4:first-of-type,
.message-content blockquote h5:first-of-type,
.message-content blockquote h6:first-of-type {
    margin-top: 0;
}

/* Referenced images from sources */
.image-box {
    margin: 16px 0;
    padding: 16px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #e74c3c;  /* Match Clinical Database color */
    border-radius: 4px;
    max-width: 85%;  /* Match blockquote width for consistency */
}

.image-box img {
    cursor: pointer;  /* Indicate clickable */
    max-width: 100%;
    height: auto;
    display: block;
}

.image-label {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.referenced-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.image-caption {
    margin-top: 8px;
    font-size: 12px;
    color: #666666;
    font-style: italic;
    text-align: center;
}

/* Clickable image styling */
.image-link {
    display: block;
    position: relative;
    text-decoration: none;
    transition: opacity 0.2s;
}

.image-link:hover .referenced-image {
    opacity: 0.85;
    cursor: pointer;
}

.image-link::after {
    content: "🔗 Open in Notion";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    font-family: 'Mulish', sans-serif;
}

.image-link:hover::after {
    opacity: 1;
}

.click-hint {
    color: #9181c4;
    font-weight: 500;
    font-style: normal;
}

.sources {
    padding: 12px 16px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #8b7355;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 8px;
}

.sources strong {
    color: #666666;
    display: block;
    margin-bottom: 6px;
}

.sources ul {
    list-style: disc;
    padding-left: 20px;
    margin: 8px 0 0 0;
}

.sources li {
    padding: 3px 0;
    color: #666666;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.sources li a {
    color: #8b7355;
    text-decoration: none;
    transition: color 0.2s ease;
}

.sources li a:hover {
    color: #6b5344;
    text-decoration: underline;
}

.educational-objectives {
    padding: 12px 16px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-left: 3px solid #9181c4;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 8px;
}

.educational-objectives strong {
    color: #666666;
    display: block;
    margin-bottom: 6px;
}

.educational-objectives ul {
    list-style: disc;
    padding-left: 20px;
    margin: 8px 0 0 0;
}

/* Document action buttons in chat */
.document-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.doc-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: white;
    color: #1a1a1a;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.doc-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.doc-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.doc-action-btn.edit-btn:hover {
    background: #f3f0ff;
    border-color: #9181c4;
    color: #9181c4;
}

.doc-action-btn.download-btn:hover {
    background: #e3f2fd;
    border-color: #2196F3;
    color: #2196F3;
}

/* Document generation message header styles */
.doc-gen-header {
    font-weight: 600;
    font-size: 14px;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.doc-gen-template {
    font-size: 13px;
    color: #666666;
    margin-bottom: 12px;
}

.template-link {
    color: #9181c4;
    text-decoration: none;
    font-weight: 500;
}

.template-link:hover {
    text-decoration: underline;
}

.ai-generated {
    color: #856404;
    font-style: italic;
}

.action-divider {
    color: #d0d0d0;
    margin: 0 4px;
    user-select: none;
}

.educational-objectives li {
    padding: 3px 0;
    color: #666666;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.educational-objectives a.objective-link {
    color: #9181c4;
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.educational-objectives a.objective-link:hover {
    color: #7b6fa0;
    border-bottom-color: #7b6fa0;
    text-decoration: none;
}

.welcome-message {
    background: #fafafa;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.welcome-message strong {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
    color: #795548;
}

.welcome-message p {
    color: #666666;
    margin: 8px 0;
}

.example-queries {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.example-queries em {
    color: #666666;
    font-style: normal;
    font-weight: 600;
    font-size: 13px;
}

.example-queries ul {
    margin-top: 8px;
    list-style: none;
    padding: 0;
}

.example-queries li {
    padding: 6px 0;
    color: #666666;
    font-size: 13px;
}

.example-queries li:before {
    content: "→ ";
    color: #9181c4;
    margin-right: 6px;
}

.input-area {
    padding: 16px 24px;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
}

.status-message {
    font-size: 12px;
    color: #666666;
    margin-bottom: 8px;
    min-height: 18px;
}

.status-message.error {
    color: #dc2626;
}

.chat-form {
    width: 100%;
}

.input-wrapper {
    display: flex;
    gap: 8px;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: #ffffff;
    color: #1a1a1a;
}

.message-input:focus {
    outline: none;
    border-color: #9181c4;
    box-shadow: 0 0 0 3px rgba(145, 129, 196, 0.15);
}

.message-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.message-input::placeholder {
    color: #999999;
}

.send-button {
    padding: 12px 20px;
    background: #9181c4;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover:not(:disabled) {
    background: #7b6fa0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(145, 129, 196, 0.3);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Scrollbar styling */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .chat-container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        border: none;
    }

    .compact-header {
        padding: 12px 16px;
    }

    .app-title {
        font-size: 20px;
    }

    .app-subtitle {
        font-size: 12px;
    }

    .messages-container {
        padding: 16px;
    }

    .message {
        max-width: 90%;
    }

    .input-area {
        padding: 12px 16px;
    }
}

/* Document Generation Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-container {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #1a1a1a;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-status {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-status.using-template {
    background: #e3f2fd;
    color: #0066cc;
}

.template-status.custom-generation {
    background: #fff3cd;
    color: #856404;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover {
    color: #1a1a1a;
}

/* Editor Toolbar */
.editor-toolbar-container {
    background: #fafafa;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

.toolbar-btn {
    padding: 6px 8px;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 32px;
}

.toolbar-btn:hover {
    background: #f5f5f5;
    border-color: #9181c4;
    color: #9181c4;
}

.toolbar-btn:active {
    background: #e5e5e5;
    transform: translateY(1px);
}

/* Active state when formatting is applied */
.toolbar-btn.active {
    background: #9181c4;
    border-color: #9181c4;
    color: white;
}

.toolbar-btn.active:hover {
    background: #7b6fa0;
    border-color: #7b6fa0;
    color: white;
}

.toolbar-btn svg {
    width: 16px;
    height: 16px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: #d0d0d0;
    margin: 0 4px;
    align-self: center;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Legacy editor-toolbar - replaced by formatting-toolbar */

.btn-primary, .btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-primary {
    background: #9181c4;
    color: white;
}

.btn-primary:hover {
    background: #7b6fa0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(145, 129, 196, 0.3);
}

.btn-secondary {
    background: #f5f5f5;
    color: #1a1a1a;
    border: 1px solid #d0d0d0;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Document Editor - Match CHLA Letterhead Dimensions */
.document-editor {
    /* US Letter: 8.5" × 11" at 96 DPI = 816px × 1056px */
    width: 816px;
    min-height: 1056px;
    max-width: 100%;
    margin: 0 auto;

    /* Match letterhead margins (approx 1" = 96px) */
    /* Reduced padding for better readability */
    padding: 160px 80px 80px 80px; /* Extra top padding for logo space */

    background: white;
    background-image: url('./assets/chla-letterhead.png');
    background-size: 100% auto;
    background-repeat: no-repeat;
    background-position: top left;
    border: 1px solid #e0e0e0;
    border-radius: 4px;

    font-family: 'Arial', sans-serif; /* Professional letter font */
    font-size: 12pt;
    line-height: 1.5;
    color: #000;

    /* Editable styling */
    outline: none;
    cursor: text;

    /* Simulate paper shadow */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.document-editor:focus {
    border-color: #9181c4;
    box-shadow: 0 0 0 3px rgba(145, 129, 196, 0.15);
}

/* Formatted text within editor */
.document-editor h1 {
    font-size: 20pt;
    font-weight: bold;
    margin: 20px 0 10px 0;
    line-height: 1.3;
}

.document-editor h2 {
    font-size: 18pt;
    font-weight: bold;
    margin: 18px 0 9px 0;
    line-height: 1.3;
}

.document-editor h3 {
    font-size: 16pt;
    font-weight: bold;
    margin: 16px 0 8px 0;
    line-height: 1.3;
}

.document-editor ul,
.document-editor ol {
    margin: 12px 0;
    padding-left: 32px;
}

.document-editor li {
    margin: 6px 0;
}

.document-editor strong {
    font-weight: bold;
}

.document-editor em {
    font-style: italic;
}

.document-editor u {
    text-decoration: underline;
}

.document-editor a {
    color: #0066cc;
    text-decoration: underline;
}

.document-editor pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11pt;
    overflow-x: auto;
    margin: 12px 0;
}

/* Page break simulation */
.document-editor .page-break {
    margin: 96px -96px;
    padding-top: 140px;
    border-top: 2px dashed #d0d0d0;
}

.page-info {
    text-align: center;
    font-size: 12px;
    color: #666;
    padding-top: 12px;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: #1a1a1a;
    color: white;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.toast-success {
    background: #27ae60;
}

.toast.toast-error {
    background: #e74c3c;
}

.toast.toast-info {
    background: #3498db;
}
