/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #667eea #f1f3f4;
}

/* Webkit scrollbar styles for all elements */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Home page styles */
.home-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Projects section */
.projects-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.5rem;
    color: #2c3e50;
}

.projects-list {
    display: grid;
    gap: 15px;
}

.project-card {
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.project-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.project-header h3 {
    color: #2c3e50;
    font-size: 1.2rem;
}

.project-date {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.project-description {
    color: #5a6c7d;
    margin-bottom: 15px;
    line-height: 1.5;
}

.project-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.persona-tag,
.document-type-tag,
.files-count {
    background: #f8f9fa;
    color: #495057;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #dee2e6;
}

.persona-tag {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.document-type-tag {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

#refresh-files-btn {
    background: #f8f9fa;
    color: #495057;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
}

#refresh-files-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
}

/* Info section */
.info-section {
    display: grid;
    gap: 20px;
}

.info-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.persona-item,
.document-type-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f3f4;
}

.persona-item:last-child,
.document-type-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.persona-item strong,
.document-type-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
}

.persona-item p,
.document-type-item p {
    color: #5a6c7d;
    font-size: 0.9rem;
    line-height: 1.4;
}

.process-step {
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.process-step:last-child {
    margin-bottom: 0;
}

.process-step strong {
    color: #2c3e50;
}

/* Empty and error states */
.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.empty-state h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 20px;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    color: #666;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.ai-generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ai-generate-btn .btn-icon {
    font-size: 1.1rem;
}

.ai-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: #2c3e50;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
    padding: 12px;
}

/* Form styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Back link */
.back-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

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

/* 
Project page styles */
.project-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.project-header {
    border-bottom: 1px solid #e1e8ed;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    min-height: 50px;
}

.project-name {
    color: #2c3e50;
    font-size: 1.1rem;
    margin: 0;
    font-weight: 600;
}

.project-meta {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.project-tags {
    display: flex;
    gap: 8px;
}

.persona-tag,
.document-type-tag {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.persona-tag {
    background: #e3f2fd;
    color: #1976d2;
}

.document-type-tag {
    background: #f3e5f5;
    color: #7b1fa2;
}

.project-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mode-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-label {
    color: #2c3e50;
    font-weight: 500;
}

.mode-buttons {
    display: flex;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
}

.mode-btn {
    padding: 8px 16px;
    border: none;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover:not(:disabled) {
    background: #f8f9fa;
}

.mode-btn.active {
    background: #667eea;
    color: white;
}

.mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.persona-controls {
    display: flex;
    gap: 10px;
}

.control-select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    color: #495057;
    font-size: 0.9rem;
}

/* Main project layout */
.project-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
    /* Important for flexbox scrolling */
}

@media (max-width: 1024px) {
    .files-sidebar {
        flex: 0 0 250px;
        /* Smaller sidebar on medium screens */
    }
}

@media (max-width: 768px) {
    .project-main {
        flex-direction: column;
    }

    .chat-panel {
        flex: 0 0 300px;
        /* Fixed height for chat on mobile */
    }

    .files-panel {
        flex: 1;
    }

    .files-content {
        flex-direction: column;
    }

    .files-sidebar {
        flex: 0 0 200px;
        /* Fixed height for files list on mobile */
    }

    .editor-area {
        flex: 1;
    }
}

/* Chat panel */
.chat-panel {
    flex: 1;
    background: white;
    border-right: 1px solid #e1e8ed;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Important for flexbox scrolling */
}

.status-indicator {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #dee2e6;
    line-height: 1.5;
}

.status-indicator.plan-mode {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.status-indicator.act-mode {
    background: #e8f5e8;
    color: #2e7d32;
    border-color: #c8e6c9;
}

.readiness-indicator {
    background: #fff3e0;
    color: #f57c00;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #ffe0b2;
    line-height: 1.5;
}

/* Mode toggle button in chat input */
.mode-toggle {
    font-weight: 600;
    min-width: 60px;
    transition: all 0.2s ease;
}

.mode-toggle.plan-mode {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.mode-toggle.plan-mode:hover {
    background: #bbdefb;
    border-color: #90caf9;
}

.mode-toggle.act-mode {
    background: #e8f5e8;
    color: #2e7d32;
    border-color: #c8e6c9;
}

.mode-toggle.act-mode:hover {
    background: #c8e6c9;
    border-color: #a5d6a7;
}

.mode-label {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
    /* Important for flexbox scrolling */
    height: 100%;
    /* Explicit height for scrolling */
    scroll-behavior: smooth;
    /* Ensure scrollbar is always visible for testing */
    scrollbar-width: thin;
    scrollbar-color: #667eea #f1f3f4;
}

.message {
    max-width: 80%;
}

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

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

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
}

.message.user .message-content {
    background: #667eea;
    color: white;
}

.message.assistant .message-content {
    background: #f8f9fa;
    color: #2c3e50;
    border: 1px solid #e1e8ed;
}

.message-meta {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    font-size: 0.8rem;
    color: #7f8c8d;
}

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

.message-mode {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #e1e8ed;
}

.empty-chat,
.error-message {
    text-align: center;
    color: #7f8c8d;
    padding: 40px 20px;
}

.chat-input-container {
    padding: 20px;
    border-top: 1px solid #e1e8ed;
    flex-shrink: 0;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

#chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    min-height: 0;
}

#chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.model-selector {
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    line-height: 1.5;
    color: #495057;
}

.model-selector:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.model-selector:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.action-btn {
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    line-height: 1.5;
}

.action-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #667eea;
}

.action-btn.primary {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.action-btn.primary:hover:not(:disabled) {
    background: #5a6fd8;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#workflow-help-btn {
    color: #667eea;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0px 8px;
}

#workflow-help-btn:hover:not(:disabled) {
    background: #f0f2ff;
    border-color: #667eea;
    color: #5a6fd8;
}

/* Files panel */
.files-panel {
    flex: 2;
    background: white;
    display: flex;
    flex-direction: column;
}

.files-content {
    flex: 1;
    display: flex;
    min-height: 0;
}

.files-sidebar {
    flex: 0 0 300px;
    border-right: 1px solid #e1e8ed;
    display: flex;
    flex-direction: column;
}

.files-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.file-item:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.file-info {
    flex: 1;
}

.file-name {
    display: block;
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 2px;
}

.file-size {
    color: #7f8c8d;
    font-size: 0.8rem;
}

.file-actions {
    display: flex;
    gap: 5px;
}

.file-action-btn {
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.file-action-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.empty-files {
    text-align: center;
    color: #7f8c8d;
    padding: 40px 20px;
}

/* Editor container */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.editor-header {
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
}

#current-file-name {
    font-weight: 500;
    color: #2c3e50;
    font-size: 1rem;
    line-height: 1.5;
}

.editor-actions {
    display: flex;
    gap: 8px;
}

.editor-actions .action-btn {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #dee2e6;
    line-height: 1.5;
}

.editor {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

/* Milkdown editor constraints */
.editor .milkdown,
.editor .milkdown-menu,
.editor .ProseMirror {
    max-height: none;
    height: auto;
}

.editor .milkdown {
    height: 100%;
}

.markdown-textarea {
    flex: 1;
    width: 100%;
    padding: 20px;
    border: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    background: white;
    color: #2c3e50;
}

.markdown-textarea:focus {
    outline: none;
}

.markdown-editor {
    flex: 1;
    background: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .project-controls {
        width: 100%;
        justify-content: space-between;
    }

    .chat-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .chat-input-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* Streamin
g and typing indicator styles */
.message.typing .message-content {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    padding: 12px 16px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.message.streaming .message-content {
    background: #f8f9fa;
    border: 1px solid #e1e8ed;
    position: relative;
}

.message.streaming .streaming-content {
    min-height: 20px;
}

.message.streaming .message-content::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background: #667eea;
    animation: blink 1s infinite;
    margin-left: 2px;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Chat persistence and history styles */

.message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 8px 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

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

.message-content blockquote {
    border-left: 3px solid #667eea;
    margin: 8px 0;
    padding-left: 12px;
    color: #5a6c7d;
    font-style: italic;
}

/* File upload feedback */
.upload-feedback {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #c8e6c9;
}

.upload-error {
    background: #ffebee;
    color: #c62828;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #ffcdd2;
}

/* Mode transition animations */
.status-indicator {
    transition: all 0.3s ease;
}

.readiness-indicator {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* Chat input enhancements */
#chat-input:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.chat-input-wrapper.disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Connection status indicator */
.connection-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.connection-status.connected {
    background: #e8f5e8;
    color: #2e7d32;
}

.connection-status.disconnected {
    background: #ffebee;
    color: #c62828;
}

.connection-status.connecting {
    background: #fff3e0;
    color: #f57c00;
}

/* Editor enhancements */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e1e8ed;
}

.editor-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#current-file-name {
    font-weight: 500;
    color: #2c3e50;
}

.editor-actions {
    display: flex;
    gap: 8px;
}

.action-btn.modified {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
}


.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e1e8ed;
}

.version-item:last-child {
    border-bottom: none;
}

.version-info {
    flex: 1;
}

.version-info strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 5px;
}

.version-date,
.version-author {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-right: 15px;
}

.version-actions {
    display: flex;
    gap: 8px;
}

/* File list enhancements */
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-item:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.file-item.active {
    border-color: #667eea;
    background: #e3f2fd;
}

.file-info {
    flex: 1;
    pointer-events: none;
}

.file-name {
    display: block;
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 2px;
}

.file-size {
    color: #7f8c8d;
    font-size: 0.8rem;
}

.file-actions {
    display: flex;
    gap: 5px;
}

.file-action-btn {
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.file-action-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

/* Auto-save indicator */
.auto-save-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e8f5e8;
    color: #2e7d32;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auto-save-status.visible {
    opacity: 1;
}

/* Context synchronization indicator */
.context-sync {
    position: relative;
}

.context-sync::after {
    content: '🔄';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.context-sync.syncing::after {
    opacity: 1;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Responsive editor layout */
@media (max-width: 768px) {
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .editor-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .version-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .version-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Enhanced file management styles */
.file-search {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 150px;
}

.file-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.file-filter-dropdown {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
}

/* Enhanced file items */
.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.file-item:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.file-item.active {
    border-color: #667eea;
    background: #e3f2fd;
}

.file-item.modified::before {
    content: '●';
    position: absolute;
    top: 8px;
    right: 8px;
    color: #ffc107;
    font-size: 1.2rem;
}

.file-info {
    flex: 1;
    pointer-events: none;
}

.file-name {
    display: block;
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 2px #667eea solid;
    border-radius: 2px;
    padding-left: 4px;
}

.file-meta {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: #7f8c8d;
}

.file-size,
.file-modified,
.file-versions {
    display: inline-block;
}

.file-versions {
    color: #667eea;
    font-weight: 500;
}

.file-actions {
    display: flex;
    gap: 5px;
}

.file-action-btn {
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.file-action-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.file-action-btn.primary {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.file-action-btn.primary:hover {
    background: #5a6fd8;
}

/* File creation modal */
.create-file-modal .modal-content {
    max-width: 400px;
}

.file-template-selector {
    margin-bottom: 15px;
}

.template-option {
    padding: 10px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-option:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.template-option.selected {
    border-color: #667eea;
    background: #e3f2fd;
}

.template-option strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 4px;
}

.template-option p {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0;
}

/* Version comparison modal */
.version-compare-modal .modal-content {
    max-width: 900px;
    max-height: 80vh;
}

.version-compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e8ed;
}

.version-selectors {
    display: flex;
    gap: 20px;
    align-items: center;
}

.version-selector {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.version-selector label {
    font-weight: 500;
    color: #2c3e50;
}

.version-selector select {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.changes-summary {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
}

.change-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.change-stat.added {
    color: #28a745;
}

.change-stat.removed {
    color: #dc3545;
}

.change-stat.changed {
    color: #ffc107;
}

.change-stat.unchanged {
    color: #6c757d;
}

/* Diff viewer */
.diff-viewer {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
}

.diff-line {
    display: flex;
    min-height: 20px;
    border-bottom: 1px solid #f1f3f4;
}

.diff-line:last-child {
    border-bottom: none;
}

.line-number {
    width: 60px;
    padding: 2px 8px;
    background: #f8f9fa;
    color: #7f8c8d;
    text-align: right;
    border-right: 1px solid #e1e8ed;
    flex-shrink: 0;
}

.line-content {
    padding: 2px 8px;
    flex: 1;
    white-space: pre-wrap;
}

.diff-unchanged {
    background: white;
}

.diff-added {
    background: #e6ffed;
}

.diff-added .line-number {
    background: #cdffd8;
    color: #28a745;
}

.diff-removed {
    background: #ffeef0;
}

.diff-removed .line-number {
    background: #ffc1cc;
    color: #dc3545;
}

.diff-changed .old-line {
    background: #ffeef0;
}

.diff-changed .old-line .line-number {
    background: #ffc1cc;
    color: #dc3545;
}

.diff-changed .new-line {
    background: #e6ffed;
}

.diff-changed .new-line .line-number {
    background: #cdffd8;
    color: #28a745;
}

/* File statistics */
.file-stats {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.file-stats h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
}

.stat-label {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* File type indicators */
.file-type-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.file-type-md {
    background: #667eea;
}

.file-type-txt {
    background: #6c757d;
}

.file-type-pdf {
    background: #dc3545;
}

.file-type-docx {
    background: #0066cc;
}

/* Drag and drop zone */
.file-drop-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    color: #7f8c8d;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.file-drop-zone.drag-over {
    border-color: #667eea;
    background: #f8f9fa;
    color: #667eea;
}

.file-drop-zone.drag-over::before {
    content: '📁 Drop files here';
    display: block;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

/* Responsive file management */
@media (max-width: 768px) {
    .file-search {
        width: 100%;
    }

    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .version-compare-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .version-selectors {
        width: 100%;
        justify-content: space-between;
    }

    .changes-summary {
        width: 100%;
        justify-content: space-around;
    }
}

/* File upd
ate notifications */
.file-update-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #e1e8ed;
    border-left: 4px solid #667eea;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px;
    max-width: 350px;
    z-index: 1001;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-content strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 5px;
}

.notification-content p {
    color: #7f8c8d;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.notification-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.notification-actions .btn {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Enhanced modal styles for file operations */
.create-file-modal .modal-content {
    max-width: 500px;
}

.file-template-selector {
    margin-bottom: 20px;
}

.file-template-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #2c3e50;
}

.template-option {
    padding: 12px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-option:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.template-option.selected {
    border-color: #667eea;
    background: #e3f2fd;
}

.template-option strong {
    display: block;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.template-option p {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.3;
}

/* File operation feedback */
.file-operation-feedback {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.file-operation-feedback.error {
    background: #dc3545;
}

.file-operation-feedback.warning {
    background: #ffc107;
    color: #212529;
}

/* Enhanced file list animations */
.file-item {
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-item.removing {
    animation: fadeOutDown 0.2s ease forwards;
}

@keyframes fadeOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Loading states for file operations */
.files-list.loading {
    opacity: 0.6;
    pointer-events: none;
}

.file-item.loading {
    opacity: 0.6;
}

.file-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    border: 2px solid #e1e8ed;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* File context menu (for future enhancement) */
.file-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    z-index: 1002;
    min-width: 150px;
}

.file-context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 0.9rem;
}

.file-context-menu-item:hover {
    background: #f8f9fa;
}

.file-context-menu-item.danger {
    color: #dc3545;
}

.file-context-menu-item.danger:hover {
    background: #f8d7da;
}

/* Keyboard shortcuts help */
.keyboard-shortcuts {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.keyboard-shortcuts.visible {
    opacity: 1;
}

.keyboard-shortcuts kbd {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.75rem;
}

/* PDF
 Export Modal Styles */
.pdf-export-modal .modal-content {
    max-width: 500px;
}

.export-options {
    margin-bottom: 20px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.radio-option:hover {
    background: #f8f9fa;
}

.radio-option input[type="radio"] {
    margin: 0;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-option input[type="checkbox"] {
    margin: 0;
}

.project-options {
    border-left: 3px solid #667eea;
    padding-left: 15px;
    margin-left: 10px;
    background: #f8f9fa;
    border-radius: 0 4px 4px 0;
}

.export-btn .btn-loading {
    display: none;
}

.export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.export-btn:disabled .btn-text {
    display: none;
}

.export-btn:disabled .btn-loading {
    display: inline;
}

/* PDF Export Progress */
.pdf-export-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1003;
    text-align: center;
    min-width: 300px;
}

.pdf-export-progress h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.pdf-export-progress p {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e8ed;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: progressPulse 2s infinite;
}

@keyframes progressPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.progress-steps {
    text-align: left;
    font-size: 0.9rem;
    color: #5a6c7d;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.progress-step.completed {
    color: #28a745;
}

.progress-step.active {
    color: #667eea;
    font-weight: 500;
}

.progress-step::before {
    content: '○';
    font-size: 1.2rem;
}

.progress-step.completed::before {
    content: '✓';
    color: #28a745;
}

.progress-step.active::before {
    content: '●';
    color: #667eea;
}

/* PDF Export Success Animation */
.pdf-export-success {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 1px solid #28a745;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.2);
    z-index: 1003;
    text-align: center;
    min-width: 300px;
    animation: successBounce 0.5s ease;
}

@keyframes successBounce {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.pdf-export-success .success-icon {
    font-size: 3rem;
    color: #28a745;
    margin-bottom: 15px;
}

.pdf-export-success h3 {
    color: #28a745;
    margin-bottom: 10px;
}

.pdf-export-success p {
    color: #5a6c7d;
    margin-bottom: 20px;
}

/* Enhanced file operation feedback */
.file-operation-feedback {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    z-index: 1001;
    animation: slideInUp 0.3s ease;
    max-width: 350px;
}

.file-operation-feedback strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1rem;
}

.file-operation-feedback p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.file-operation-feedback.error {
    background: #dc3545;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.file-operation-feedback.warning {
    background: #ffc107;
    color: #212529;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

/* PDF format preview */
.pdf-format-preview {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #5a6c7d;
}

.format-dimensions {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
}

/* Responsive PDF export modal */
@media (max-width: 768px) {
    .pdf-export-modal .modal-content {
        max-width: 95%;
        margin: 20px;
    }

    .radio-group {
        gap: 12px;
    }

    .radio-option,
    .checkbox-option {
        padding: 12px 8px;
    }

    .pdf-export-progress,
    .pdf-export-success {
        max-width: 90%;
        margin: 20px;
    }
}

/* S
ettings Modal Styles */
.settings-modal .modal-content {
    max-width: 800px;
    max-height: 90vh;
    width: 90%;
}

.settings-modal .modal-content.large {
    max-width: 900px;
}

.settings-tabs {
    display: flex;
    border-bottom: 1px solid #e1e8ed;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #7f8c8d;
}

.tab-btn:hover {
    color: #2c3e50;
    background: #f8f9fa;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: #f8f9fa;
}

.settings-content {
    min-height: 400px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.settings-section {
    margin-bottom: 30px;
}

.settings-section h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e1e8ed;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

/* Persona and Document Type Items */
.persona-item,
.document-type-item {
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

.persona-item:hover,
.document-type-item:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.persona-header,
.document-type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.persona-header h5,
.document-type-header h5 {
    color: #2c3e50;
    margin: 0;
}

.persona-actions,
.document-type-actions {
    display: flex;
    gap: 8px;
}

.persona-description,
.document-type-description {
    color: #5a6c7d;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* File Types List */
.file-types-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.file-type-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.file-type-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
}

.remove-file-type {
    padding: 6px 10px;
    min-width: auto;
}

/* Persona/Document Type Editor Modal */
.persona-editor-modal .modal-content,
.document-type-editor-modal .modal-content {
    max-width: 600px;
}

.persona-editor-modal textarea,
.document-type-editor-modal textarea {
    min-height: 100px;
    resize: vertical;
}

/* Button Variants */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
    border-color: #ffc107;
}

.btn-warning:hover {
    background: #e0a800;
    border-color: #d39e00;
}

.btn-info {
    background: #17a2b8;
    color: white;
    border-color: #17a2b8;
}

.btn-info:hover {
    background: #138496;
    border-color: #117a8b;
}

/* Settings Form Enhancements */
.form-group small {
    display: block;
    color: #7f8c8d;
    font-size: 0.8rem;
    margin-top: 4px;
}

.form-group input[type="number"] {
    max-width: 120px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-option input[type="checkbox"] {
    margin: 0;
}

/* Configuration Import/Export */
.config-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

/* Success/Error Messages */
.settings-message {
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.settings-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.settings-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.settings-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Responsive Settings Modal */
@media (max-width: 768px) {
    .settings-modal .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .settings-tabs {
        flex-wrap: wrap;
        gap: 5px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .persona-header,
    .document-type-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .persona-actions,
    .document-type-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .config-actions {
        flex-direction: column;
    }
}

/* Enhanced
 scrollbar styles for chat */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

/* Ensure chat messages container is properly sized */
.chat-panel {
    background: white;
    border-right: 1px solid #e1e8ed;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    position: relative;
    /* Ensure proper positioning context */
}

/* Force proper height calculation */
.project-main {
    flex: 1;
    /* display: grid; */
    grid-template-columns: 1fr 1fr;
    gap: 0;
    overflow: hidden;
    min-height: 0;
    height: 100%;
    /* Explicit height */
}

/* Debug styles - can be removed later */
.chat-messages.debug {
    border: 2px solid red !important;
    background: rgba(255, 0, 0, 0.1) !important;
}

/* Ensure messages don't break scrolling */
.message {
    flex-shrink: 0;
    /* Prevent messages from shrinking */
    max-width: 80%;
}

.message-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* S
ync notifications */
.sync-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

.sync-notification.success {
    background: #28a745;
    color: white;
}

.sync-notification.info {
    background: #17a2b8;
    color: white;
}

.sync-notification.error {
    background: #dc3545;
    color: white;
}

.sync-notification strong {
    display: block;
    margin-bottom: 5px;
}

.sync-notification p {
    margin: 0;
    font-size: 14px;
}

/* No file selected state */
.no-file-selected {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.no-file-message {
    text-align: center;
    color: #7f8c8d;
}

.no-file-message h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.no-file-message p {
    margin: 0;
}

.file-search {
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 150px;
}

.file-filter-dropdown {
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
}

/* File item improvements */
.file-item {
    cursor: pointer;
    user-select: none;
}

.file-item.selected {
    background: #e3f2fd;
    border-color: #667eea;
}

.file-type-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.file-type-indicator.file-type-md {
    background: #667eea;
}

.file-type-indicator.file-type-txt {
    background: #28a745;
}

.file-type-indicator.file-type-pdf {
    background: #dc3545;
}

.file-meta {
    display: flex;
    gap: 10px;
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-top: 2px;
}

/*
 Files sidebar improvements */
.files-sidebar {
    min-width: 250px;
    max-width: 400px;
}

.files-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    margin-bottom: 0;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
}

.file-item:hover {
    background: #f8f9fa;
    border-color: #e1e8ed;
}

.file-item.selected {
    background: #e3f2fd;
    border-color: #667eea;
}

.file-name {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

/* File excluded from context styling */
.file-item.excluded-from-context .file-name {
    border-left: 3px solid #dc3545;
    padding-left: 8px;
}

.file-item.excluded-from-context .file-versions {
    color: #dc3545;
    font-weight: 500;
}

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

/* Only hide the versions action button, not the context button or versions text */
.file-action-btn {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-item:hover .file-action-btn {
    opacity: 0.6;
}

.file-item.selected .file-action-btn {
    opacity: 0.6;
}

.file-action-btn:hover {
    opacity: 1 !important;
}

/* Editor area improvements */
.editor-area {
    min-height: 0;
    overflow: hidden;
}

.editor-header {
    background: white;
    border-bottom: 1px solid #e1e8ed;
    padding: 12px 20px;
}


.editor-info {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Responsive styles for minimal header */
@media (max-width: 768px) {
    .project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 16px;
    }

    .project-meta {
        margin-left: 0;
    }

    .project-name {
        font-size: 1rem;
    }

    .persona-tag,
    .document-type-tag {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

@media (max-width: 480px) {
    .project-header {
        padding: 8px 12px;
    }

    .back-link {
        font-size: 0.9rem;
    }

    .project-name {
        font-size: 0.95rem;
    }
}


.editor-status {
    display: flex;
    justify-content: space-between;
    padding: 8px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e1e8ed;
    font-size: 12px;
    color: #6c757d;
    flex-shrink: 0;
}

.word-count,
.char-count,
.line-count {
    font-weight: 500;
}


/* 
Read-only editor styles */
.simple-editor-wrapper.read-only {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
}

.simple-editor-wrapper.read-only #simple-editor {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border: none;
    outline: none;
}

.simple-editor-wrapper.read-only #simple-editor:focus {
    box-shadow: none;
}

.read-only-indicator {
    background-color: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 10px;
}

.editor-status {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 0.9rem;
    color: #6c757d;
}

.editor-status span {
    margin-right: 15px;
}

/* Version modal button fixes */
.version-actions button {
    margin-right: 8px;
}

.version-actions .btn {
    padding: 4px 12px;
    font-size: 0.9rem;
}

/*
 Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #dc3545;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Version list styles */
.versions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background-color: #f8f9fa;
}

.version-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.version-info strong {
    color: #333;
}

.version-date,
.version-author {
    font-size: 0.9rem;
    color: #6c757d;
}

.version-actions {
    display: flex;
    gap: 8px;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

/* Version comparison styles */
.version-compare-header {
    display: flex;
    align-items: end;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.version-selectors {
    display: flex;
    gap: 20px;
    flex: 1;
}

.version-selector {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.version-selector label {
    font-weight: 500;
    color: #333;
}

.version-selector select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
}

.changes-summary {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.change-stat {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.change-stat.added {
    background-color: #d4edda;
    color: #155724;
}

.change-stat.removed {
    background-color: #f8d7da;
    color: #721c24;
}

.change-stat.changed {
    background-color: #fff3cd;
    color: #856404;
}

.change-stat.unchanged {
    background-color: #e2e3e5;
    color: #383d41;
}

.diff-viewer {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.diff-line {
    display: flex;
    padding: 2px 0;
}

.diff-line.diff-added {
    background-color: #d4edda;
}

.diff-line.diff-removed {
    background-color: #f8d7da;
}

.diff-line.diff-changed {
    background-color: #fff3cd;
}

.line-number {
    display: inline-block;
    width: 50px;
    padding: 0 8px;
    color: #6c757d;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    text-align: right;
    user-select: none;
}

.line-content {
    padding: 0 8px;
    flex: 1;
    white-space: pre-wrap;
}

/*
 Project card delete button */
.project-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.delete-project-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.delete-project-btn:hover {
    opacity: 1;
    background-color: #fee;
    transform: scale(1.1);
}

.project-card:hover .delete-project-btn {
    opacity: 0.8;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    background-color: #28a745;
}

.notification.error {
    background-color: #dc3545;
}

.notification.info {
    background-color: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Cente
r the no file selected message */
.no-file-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.no-file-message {
    text-align: center;
    color: #6c757d;
}

.no-file-message h3 {
    margin-bottom: 8px;
    font-weight: 500;
}

.no-file-message p {
    margin: 0;
    opacity: 0.8;
}

/* File actions in file-meta */
.file-meta {
    display: flex;
    align-items: center;
    gap: 0px;
    column-gap: 12px;
    flex-wrap: wrap;
}

.file-meta .file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
    z-index: 10;
}

.file-meta .file-action-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 3px;
    opacity: 0;
    transition: all 0.2s ease;
    position: relative;
    z-index: 11;
    pointer-events: auto;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-item:hover .file-meta .file-action-btn {
    opacity: 0.6;
}

.file-meta .file-action-btn:hover {
    opacity: 1 !important;
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

/* File context toggle button */
.file-context-btn {
    background: none;
    border: 1px solid transparent;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
    z-index: 11;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.file-context-btn.included {
    background-color: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-color: rgba(102, 126, 234, 0.3);
}

.file-context-btn.included:hover {
    background-color: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    transform: translateY(-1px);
}

.file-context-btn.excluded {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
}

.file-context-btn.excluded:hover {
    background-color: rgba(220, 53, 69, 0.2);
    border-color: #dc3545;
    transform: translateY(-1px);
}

.file-context-btn .context-icon {
    display: inline-block;
    font-size: 14px;
}

.file-context-btn .context-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/*
 Selection Cards for Create Project Modal */
.selection-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.selection-card {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.selection-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.selection-card.selected {
    border-color: #007bff;
    background-color: #f8f9ff;
    box-shadow: 0 2px 12px rgba(0, 123, 255, 0.15);
}

.selection-card .card-header {
    margin-bottom: 8px;
}

.selection-card .card-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.selection-card .card-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
}

.selection-card.selected .card-header h4 {
    color: #007bff;
}

.selection-card.selected .card-description {
    color: #495057;
}

.loading-card {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-style: italic;
}

.add-custom-card {
    border: 2px solid transparent !important;
    background: transparent !important;
}

.add-custom-card:hover {
    border: 2px dotted #007bff !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

.add-custom-card .card-header h4 {
    color: #333 !important;
}

.add-custom-card .card-description {
    color: #6c757d !important;
}

/* Modal adjustments for cards */
.modal-content {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

/*
 Full-width home page layout */
.home-page-fullwidth {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding-bottom: 2rem;
}

.page-header {
    background: white;
    border-bottom: 1px solid #dee2e6;
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    margin: 0;
    color: #333;
    font-size: 2rem;
    font-weight: 700;
}

/* Info notice */
.info-notice {
    max-width: 1400px;
    margin: 16px auto 0;
    padding: 12px 16px;
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-notice.bottom {
    margin: 0 auto;
    max-width: 1400px;
}

.info-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.info-text {
    color: #004085;
    font-size: 0.95rem;
    line-height: 1.5;
}

.info-text a {
    color: #0056b3;
    text-decoration: underline;
    font-weight: 500;
}

.info-text a:hover {
    color: #003d82;
}

/* Home Intro Section */
.home-intro-section {
    max-width: 1400px;
    margin: 1.5rem auto;
}

.intro-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.intro-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.intro-close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.intro-header {
    text-align: center;
    margin-bottom: 2rem;
}

.intro-header h3 {
    color: #333;
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.intro-header p {
    color: #555;
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 900px;
    margin: 0 auto;
}

.intro-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.intro-column {
    padding: 1.5rem;
    border-radius: 8px;
    background: #f8f9fa;
}

.intro-column.highlight {
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f7ff 100%);
    border: 2px solid #007bff;
}

.column-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.intro-column h4 {
    color: #333;
    font-size: 1.15rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.intro-column p {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.intro-column ul {
    margin: 0;
    padding-left: 1.25rem;
    color: #555;
}

.intro-column li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.workflow-steps {
    margin-top: 1rem;
}

.workflow-phase {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.workflow-phase strong {
    display: block;
    color: #007bff;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.workflow-phase p {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.phase-arrow {
    text-align: center;
    color: #007bff;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

/* Responsive Intro Section */
@media (max-width: 1024px) {
    .intro-columns {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .intro-header h3 {
        font-size: 1.5rem;
    }

    .intro-header p {
        font-size: 1rem;
    }
}

/* Create project section */
.create-project-section {
    background: white;
    padding: 40px 20px;
    border-bottom: 1px solid #dee2e6;
}

.create-project-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 40px;
    align-items: start;
}

.project-info-section h2 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 1.8rem;
    font-weight: 600;
}

.project-info-section p {
    color: #6c757d;
    margin-bottom: 24px;
    line-height: 1.5;
}

.persona-selection-section h3,
.document-type-selection-section h3 {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
}

/* Form elements in the new layout */
.project-info-section .form-group {
    margin-bottom: 20px;
}

.project-info-section .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}

.project-info-section input,
.project-info-section textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.project-info-section input:focus,
.project-info-section textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.btn-large {
    padding: 14px 28px;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    margin-top: 12px;
}

.btn-large:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Selection cards in new layout */
.create-project-section .selection-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Document type cards in 2 columns */
.document-type-selection-section .selection-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.create-project-section .selection-card {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.create-project-section .selection-card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
    transform: translateY(-1px);
}

.create-project-section .selection-card.selected {
    border-color: #007bff;
    background-color: #f8f9ff;
    box-shadow: 0 2px 12px rgba(0, 123, 255, 0.15);
}

/* Projects section */
.projects-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px 20px;
}

.projects-section .section-header {
    margin-bottom: 24px;
}

.projects-section .section-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.8rem;
    font-weight: 600;
}

.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Responsive design */
@media (max-width: 1200px) {
    .create-project-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .persona-selection-section,
    .document-type-selection-section {
        .selection-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 12px;
        }
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .create-project-section {
        padding: 30px 15px;
    }

    .projects-section {
        padding: 30px 15px;
    }

    .projects-list {
        grid-template-columns: 1fr;
    }
}

/* Enha
nced Header */
.page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 40px;
}

.header-branding h1 {
    margin: 0 0 4px 0;
    color: white;
    font-size: 2.2rem;
    font-weight: 700;
}

.header-tagline {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 400;
}

.header-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 2px;
}

/* Enhanced Projects Section */
.projects-section {
    max-width: 1400px;
    margin: 20px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.projects-section .section-header {
    background: #f8f9fa;
    padding: 20px 24px;
    border-bottom: 1px solid #dee2e6;
    text-align: center;
}

.projects-section .section-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

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

.project-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 12px;
}

.project-card-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    flex-shrink: 0;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.project-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.project-date {
    font-size: 0.85rem;
    color: #6c757d;
}

.project-description {
    color: #6c757d;
    margin: 0;
    line-height: 1.4;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.persona-tag,
.document-type-tag {
    background: #e9ecef;
    color: #495057;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.persona-tag {
    background: #e3f2fd;
    color: #1976d2;
}

.document-type-tag {
    background: #f3e5f5;
    color: #7b1fa2;
}

.files-count {
    color: #6c757d;
    font-size: 0.85rem;
    margin-left: auto;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    color: #495057;
}

.empty-state p {
    margin: 0 0 20px 0;
}

.error-state {
    text-align: center;
    padding: 40px 20px;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 6px;
}



.editor-container,
.editor {
    height: 100%;
}

#milkdown-editor {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.milkdown {
    overflow-y: scroll;
}

/* Binary file viewers */
.docx-viewer {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

.docx-viewer h1, .docx-viewer h2, .docx-viewer h3, .docx-viewer h4, .docx-viewer h5, .docx-viewer h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.docx-viewer p {
    margin-bottom: 1em;
}

.docx-viewer table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.docx-viewer table td, .docx-viewer table th {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.docx-viewer table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.docx-viewer ul, .docx-viewer ol {
    margin: 1em 0;
    padding-left: 2em;
}

.docx-viewer li {
    margin-bottom: 0.5em;
}

/* File delete button styling */
.file-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s;
    pointer-events: auto;
    position: relative;
    z-index: 11;
    min-width: 24px;
    min-height: 24px;
}

.file-item:hover .file-delete-btn {
    opacity: 0.6;
}

.file-item.selected .file-delete-btn {
    opacity: 0.6;
}

.file-delete-btn:hover {
    opacity: 1 !important;
    background-color: #fee;
    color: #d32f2f;
}

.file-delete-btn:active {
    background-color: #fdd;
}


/* Document Type Editor Modal - Fullscreen 3 Column */
.modal-content.fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.modal-content.fullscreen .modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    max-height: none !important;
}

.document-type-editor-3col {
    display: grid;
    grid-template-columns: 300px 1fr 1fr;
    gap: 1.5rem;
    height: 100%;
    padding: 1rem;
    margin: 1rem;
}

.editor-col-1 {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.editor-col-1 .form-actions {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
}

.editor-col-1 .form-actions-left {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.editor-col-1 .form-actions-right {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.editor-col-1 .form-actions .btn {
    width: 100%;
}

.editor-col-2,
.editor-col-3 {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.form-group.full-height {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.form-group.full-height label {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
    display: flex;
    gap: 5px;
    align-items: baseline;
}

.form-group.full-height textarea {
    flex: 1;
    min-height: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: none;
}


/* Document Type Card Actions */
.selection-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.selection-card .card-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.selection-card:hover .card-actions {
    opacity: 1;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.1s;
    z-index: 10;
    position: relative;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.btn-icon:active {
    transform: scale(0.95);
}


/* Label row for document type editor */
.label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.label-row label {
    margin-bottom: 0;
}

/* Workflow Help Modal */
.workflow-help-modal .modal-content {
    max-width: 800px;
    max-height: 90vh;
}

.workflow-help .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h4 {
    color: #333;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.help-section p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.help-section ul {
    margin-left: 1.5rem;
    color: #555;
}

.help-section li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Workflow Diagram */
.workflow-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.workflow-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.step-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.plan-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.act-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.step-content h5 {
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 1.2rem;
}

.step-description {
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.step-content ul {
    text-align: left;
    margin: 0;
    padding-left: 1.25rem;
}

.step-content li {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.4rem;
}

.workflow-arrow {
    font-size: 2rem;
    color: #007bff;
    font-weight: bold;
}

/* Example Section */
.example-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.example-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.example-bad,
.example-good {
    padding: 1rem;
    border-radius: 6px;
    background: white;
}

.example-bad {
    border-left: 4px solid #dc3545;
}

.example-good {
    border-left: 4px solid #28a745;
}

.example-bad h5,
.example-good h5 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.example-text {
    font-style: italic;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.example-result {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.5;
}

/* Tips Section */
.tips-section {
    background: #e7f3ff;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.tips-section h4 {
    color: #0056b3;
}

.tips-section li {
    color: #333;
}

.tips-section strong {
    color: #0056b3;
}

/* Responsive Workflow Help */
@media (max-width: 768px) {
    .workflow-help-modal .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .workflow-diagram {
        flex-direction: column;
        gap: 1rem;
    }

    .workflow-arrow {
        transform: rotate(90deg);
    }

    .example-comparison {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}
