/* File Preview Component Styles */
.file-preview-container {
    position: relative;
    height: 100%;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #dc3545;
}

.error-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.preview-header {
    padding: 6px 10px;
    background-color: #f8f9fa;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Prevent header from shrinking */
    border-bottom: 1px solid #ddd;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: -2px;
}

.file-info {
    display: flex;
    gap: 10px;
}

.download-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-button:hover {
    background-color: #e9ecef;
}

.download-icon {
    font-size: 16px;
}

.file-extension, .file-size {
    color: #666;
    font-weight: normal;
}

.preview-content {
    flex: 1;
    overflow: auto;
    min-height: 0; /* Important for flex child to allow shrinking */
}

.svg-preview, .image-preview {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.svg-content {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.markdown-preview {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

.text-preview, .code-preview {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.text-preview pre, .code-preview pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-preview .text-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.json-preview pre {
    color: #333;
}

.language-csharp {
    color: #178600;
}

.language-javascript, .language-typescript {
    color: #f1e05a;
}

.language-css {
    color: #563d7c;
}

.language-html, .language-xml {
    color: #e34c26;
}

.language-yaml {
    color: #cb171e;
}

.pdf-preview {
    flex: 1;
    min-height: 500px;
    padding: 10px;
}

.file-preview-container img {
    max-width: 100%;
    max-height: 400px;
}

/* Markdown Content Styling */
.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview h4,
.markdown-preview h5,
.markdown-preview h6 {
    color: #2c3e50;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.markdown-preview h1 {
    font-size: 2em;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.3em;
}

.markdown-preview h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.3em;
}

.markdown-preview p {
    margin-bottom: 1em;
}

.markdown-preview ul,
.markdown-preview ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-preview code {
    background-color: #f8f9fa;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.markdown-preview pre {
    background-color: #f8f9fa;
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1em 0;
}

.markdown-preview blockquote {
    border-left: 4px solid #ddd;
    padding-left: 1em;
    margin: 1em 0;
    color: #666;
}

.markdown-preview table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.markdown-preview th,
.markdown-preview td {
    border: 1px solid #ddd;
    padding: 0.5em;
    text-align: left;
}

.markdown-preview th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.markdown-preview img {
    max-width: 100%;
    height: auto;
    margin: 1em 0;
}

.markdown-preview a {
    color: #007bff;
    text-decoration: none;
}

.markdown-preview a:hover {
    text-decoration: underline;
}