/**
 * File Upload Widget Styles
 * 
 * Styles for drag & drop file uploads, thumbnails, and file management
 */

/* ================================
   File Upload Widget Container
   ================================ */
.file-upload-widget {
    margin: 20px 0;
}

.file-upload-widget h6 {
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
}

/* ================================
   Upload Area
   ================================ */
.file-upload-area {
    margin-bottom: 20px;
}

.upload-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-zone:hover {
    border-color: #4a90e2;
    background: #e8f4ff;
}

.upload-zone.dragover {
    border-color: #4a90e2;
    background: #d4e9ff;
    transform: scale(1.02);
}

.upload-zone .file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Upload Progress */
.upload-progress {
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.upload-progress .progress {
    height: 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* ================================
   Files Grid
   ================================ */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .files-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
}

/* ================================
   File Card
   ================================ */
.file-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.file-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Thumbnail Area */
.file-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Square aspect ratio */
    background: #f7fafc;
    overflow: hidden;
}

.file-thumbnail img.thumbnail-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-icon-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
}

/* Overlay Actions */
.file-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-card:hover .file-overlay {
    opacity: 1;
}

.file-overlay .btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* File Info */
.file-info {
    padding: 10px;
    flex-grow: 1;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: #2d3748;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
}

.file-name[contenteditable="true"] {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
    border-radius: 3px;
    padding: 2px 4px;
    white-space: normal;
    word-break: break-word;
}

.file-meta {
    font-size: 11px;
    color: #718096;
}

/* File Actions */
.file-actions {
    padding: 0 10px 10px;
    display: flex;
    justify-content: flex-end;
}

.file-actions .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* ================================
   File Type Icons
   ================================ */
.fa-file-pdf { color: #dc2626 !important; }
.fa-file-word { color: #2563eb !important; }
.fa-file-excel { color: #16a34a !important; }
.fa-file-image { color: #0891b2 !important; }
.fa-file-alt { color: #6b7280 !important; }

/* ================================
   Empty State
   ================================ */
.files-grid p.text-muted {
    grid-column: 1 / -1;
    margin: 0;
}

/* ================================
   Preview Modal
   ================================ */
#filePreviewModal .modal-dialog {
    max-width: 90vw;
    max-height: 90vh;
}

#filePreviewModal .modal-body {
    padding: 0;
    max-height: calc(90vh - 120px);
    overflow: auto;
}

#filePreviewModal img {
    width: 100%;
    height: auto;
}

#filePreviewModal iframe {
    width: 100%;
    height: calc(90vh - 120px);
    border: none;
}

/* ================================
   Loading States
   ================================ */
.file-card.uploading {
    opacity: 0.6;
    pointer-events: none;
}

.file-card.uploading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================================
   Animations
   ================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-card {
    animation: fadeIn 0.3s ease;
}

/* ================================
   Responsive Adjustments
   ================================ */
@media (max-width: 576px) {
    .upload-zone {
        padding: 30px 15px;
    }
    
    .upload-zone .fa-3x {
        font-size: 2rem;
    }
    
    .upload-zone p {
        font-size: 14px;
    }
    
    .file-overlay .btn {
        width: 35px;
        height: 35px;
    }
}

