/* Version history styles */

/* ---------- Version History Dialog ---------- */
.version-history-dialog .dialog-container {
    max-width: 900px;
    width: 90%;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.version-history-dialog .close-dialog svg {
    width: 24px;
    height: 24px;
}

.version-history-dialog .dialog-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--input-bg);
}

.version-history-dialog .dialog-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.version-history-dialog .dialog-content {
    padding: 0;
    flex: 1;
    overflow: hidden;
}

.version-history-layout {
    display: flex;
    height: 100%;
    max-height: calc(80vh - 60px); /* Account for header */
}

.version-list-container {
    width: 40%;
    border-right: 1px solid var(--border-color);
    padding: 15px;
    overflow-y: auto;
}

.version-preview-container {
    width: 60%;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.version-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.empty-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    background-color: var(--hover-bg);
    border-radius: 8px;
}

.version-list-container h3,
.version-preview-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text-color);
}

.version-list {
    margin-top: 10px;
}

.version-item {
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    background-color: var(--bg-color);
    transition: all 0.2s ease;
    overflow: hidden;
    word-break: break-word;
}

.version-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.version-item.selected {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-rgb), 0.05);
}

.version-info {
    margin-bottom: 10px;
}

.version-date {
    font-weight: 500;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-wrap: break-word;
    font-size: 0.9em;
    line-height: 1.4;
}

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

.version-actions button {
    border: none;
    background-color: var(--hover-bg);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.version-actions button:hover {
    background-color: var(--border-color);
    color: var(--text-color);
}

.version-actions button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    fill: currentColor;
}

/* Additional fixes for version history SVGs */
.version-history-dialog svg {
    fill: currentColor;
}

/* Add styles for dark theme icons */
:root[data-theme="dark"] .version-actions button {
    color: var(--text-secondary);
}

:root[data-theme="dark"] .version-actions button:hover {
    color: var(--text-color);
}

:root[data-theme="dark"] .preview-version-btn:hover,
:root[data-theme="dark"] .restore-version-btn:hover,
.preview-version-btn:hover {
    color: var(--primary-color);
}

.restore-version-btn:hover {
    color: var(--danger-color);
}

.version-content {
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-bg);
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* Make images in version preview responsive */
.version-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Ensure all content in version preview is properly contained */
.version-content.markdown-body {
    width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.version-content.markdown-body * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Add hyperlink styling for version preview */
.version-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.version-content a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Handle pre and code blocks to prevent overflow */
.version-content pre,
.version-content code {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

/* Handle tables to prevent overflow */
.version-content table {
    width: 100%;
    overflow-x: auto;
    max-width: 100%;
}

.version-content blockquote,
.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 0.75em 0;
    padding: 0.5em 1em;
    background-color: var(--blockquote-bg);
    border-radius: 0 8px 8px 0;
}

/* Responsive styles for version history dialog */
@media (max-width: 950px) {
    .version-history-dialog .dialog-container {
        width: 95%;
        padding: 0;
    }

    .version-history-dialog .dialog-content {
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .version-history-layout {
        flex-direction: column;
        max-height: none;
        height: auto;
        overflow: visible;
    }

    .version-list-container {
        width: 100%;
        max-height: 35vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 10px;
        box-sizing: border-box;
        flex: none;
    }

    .version-preview-container {
        width: 100%;
        max-height: none;
        height: auto;
        padding: 10px;
        box-sizing: border-box;
        overflow: visible;
        flex: none;
    }

    .version-preview {
        overflow: visible;
        height: auto;
    }

    .version-item {
        padding: 10px;
        margin-right: 5px;
        margin-left: 5px;
    }
}