/* File Preview Modal Styles */
.file-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.file-preview-container {
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.file-preview-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.file-preview-title {
    font-weight: 600;
    margin: 0;
    color: #333;
    font-size: 16px;
    word-break: break-word;
}

.file-preview-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-preview-close:hover {
    background: #dc3545;
    color: white;
}

.file-preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
    min-height: 300px;
}

.file-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.file-preview-pdf {
    width: 100%;
    height: 70vh;
    border: none;
    border-radius: 8px;
}

.file-preview-text {
    width: 100%;
    height: 60vh;
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #f8f9fa;
    white-space: pre-wrap;
    overflow: auto;
}

.file-preview-unsupported {
    text-align: center;
    color: #666;
    padding: 40px;
}

.file-preview-unsupported .icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 20px;
}

.file-preview-unsupported h4 {
    margin-bottom: 10px;
    color: #333;
}

.file-preview-unsupported p {
    margin-bottom: 20px;
}

.file-preview-actions {
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0 0 12px 12px;
}

.file-preview-info {
    font-size: 14px;
    color: #666;
}

.file-preview-download {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.file-preview-download:hover {
    background: #0056b3;
    color: white;
    text-decoration: none;
}

/* Loading spinner */
.file-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.preview-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* File item preview buttons */
.file-preview-btn {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    font-size: 14px;
    transition: color 0.2s ease;
}

.file-preview-btn:hover {
    color: #0056b3;
}

/* Responsive design */
@media (max-width: 768px) {
    .file-preview-container {
        max-width: 95vw;
        max-height: 95vh;
        margin: 10px;
    }
    
    .file-preview-pdf {
        height: 60vh;
    }
    
    .file-preview-text {
        height: 50vh;
        font-size: 12px;
    }
    
    .file-preview-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .file-preview-download {
        justify-content: center;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .file-preview-container {
        background: #2d3748;
        color: white;
    }
    
    .file-preview-header {
        background: #1a202c;
        border-bottom-color: #4a5568;
    }
    
    .file-preview-title {
        color: white;
    }
    
    .file-preview-text {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .file-preview-actions {
        background: #1a202c;
        border-top-color: #4a5568;
    }
    
    .file-preview-info {
        color: #a0aec0;
    }
    
    .file-preview-unsupported {
        color: #a0aec0;
    }
    
    .file-preview-unsupported h4 {
        color: white;
    }
}