/**
 * FileGallery Component Styles
 * Supporta tutti i tipi di file con icone appropriate
 * Richiede: FontAwesome 5+
 */

/* ==================== CAMPO FILE ==================== */
.file-gallery-field {
    margin-bottom: 1rem;
}

.file-gallery-field__container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fafafa;
}

.file-gallery-field__preview {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.file-gallery-field__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Icona per file non immagine */
.file-gallery-field__icon-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    text-align: center;
    width: 100%;
    height: 100%;
}

.file-gallery-field__icon-preview i {
    font-size: 3rem;
    margin-bottom: 8px;
}

.file-gallery-field__filename {
    font-size: 11px;
    color: #666;
    word-break: break-all;
    max-width: 100%;
}

/* Placeholder */
.file-gallery-field__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #aaa;
}

.file-gallery-field__placeholder i {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.file-gallery-field__placeholder span {
    font-size: 12px;
}

/* Azioni */
.file-gallery-field__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-gallery-field__upload-wrapper {
    position: relative;
}

.file-gallery-field__file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}

.file-gallery-field__info {
    flex-basis: 100%;
    margin-top: 10px;
}

/* ==================== MODAL GALLERIA ==================== */
.file-gallery-modal .modal-dialog {
    max-width: 900px;
}

.file-gallery-modal .modal-body {
    max-height: 65vh;
    overflow-y: auto;
}

/* Filtri */
.file-gallery-modal__filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.file-gallery-modal__filter-btn {
    padding: 5px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.file-gallery-modal__filter-btn:hover {
    border-color: #007bff;
    color: #007bff;
}

.file-gallery-modal__filter-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
}

/* Upload zone */
.file-gallery-modal__upload-zone {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.file-gallery-modal__upload-zone:hover {
    border-color: #007bff;
    background: #e7f1ff;
}

.file-gallery-modal__upload-zone.dragover {
    border-color: #28a745;
    background: #d4edda;
}

.file-gallery-modal__upload-zone i {
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
    color: #6c757d;
}

.file-gallery-modal__upload-zone p {
    margin: 0;
    color: #666;
}

.file-gallery-modal__upload-zone small {
    color: #999;
}

/* Griglia file */
.file-gallery-modal__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* Singolo item */
.file-gallery-modal__item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.file-gallery-modal__item:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.file-gallery-modal__item.selected {
    border-color: #28a745;
    background: #f0fff4;
}

/* Preview immagine nel modal */
.file-gallery-modal__item-preview {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #f5f5f5;
}

.file-gallery-modal__item-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Icona file nel modal */
.file-gallery-modal__item-preview i {
    font-size: 2.5rem;
}

/* Nome file */
.file-gallery-modal__item-name {
    font-size: 11px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

/* Info file */
.file-gallery-modal__item-info {
    font-size: 10px;
    color: #999;
}

/* Badge estensione */
.file-gallery-modal__item-ext {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    margin-top: 5px;
}

/* Colori badge per tipo file */
.file-gallery-modal__item-ext.ext-image { background: #e8f5e9; color: #4CAF50; }
.file-gallery-modal__item-ext.ext-pdf { background: #ffebee; color: #F44336; }
.file-gallery-modal__item-ext.ext-word { background: #e3f2fd; color: #2196F3; }
.file-gallery-modal__item-ext.ext-excel { background: #e8f5e9; color: #4CAF50; }
.file-gallery-modal__item-ext.ext-powerpoint { background: #fff3e0; color: #FF9800; }
.file-gallery-modal__item-ext.ext-text { background: #eceff1; color: #607D8B; }
.file-gallery-modal__item-ext.ext-archive { background: #efebe9; color: #795548; }
.file-gallery-modal__item-ext.ext-audio { background: #f3e5f5; color: #9C27B0; }
.file-gallery-modal__item-ext.ext-video { background: #fce4ec; color: #E91E63; }
.file-gallery-modal__item-ext.ext-code { background: #e0f7fa; color: #00BCD4; }
.file-gallery-modal__item-ext.ext-default { background: #f5f5f5; color: #9E9E9E; }

/* Empty state */
.file-gallery-modal__empty {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.file-gallery-modal__empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

/* Loading */
.file-gallery-modal__loading {
    text-align: center;
    padding: 40px;
}

.file-gallery-modal__loading i {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* ==================== COLORI ICONE PER TIPO ==================== */
.file-icon-image { color: #4CAF50; }
.file-icon-pdf { color: #F44336; }
.file-icon-word { color: #2196F3; }
.file-icon-excel { color: #4CAF50; }
.file-icon-powerpoint { color: #FF9800; }
.file-icon-text { color: #607D8B; }
.file-icon-archive { color: #795548; }
.file-icon-audio { color: #9C27B0; }
.file-icon-video { color: #E91E63; }
.file-icon-code { color: #00BCD4; }
.file-icon-default { color: #9E9E9E; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .file-gallery-field__container {
        flex-direction: column;
        align-items: center;
    }
    
    .file-gallery-field__actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .file-gallery-modal__grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .file-gallery-modal__item-preview {
        height: 60px;
    }
    
    .file-gallery-modal__item-preview i {
        font-size: 2rem;
    }
}

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

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

/* Progress bar per upload */
.file-gallery-modal__progress {
    margin-top: 10px;
    display: none;
}

.file-gallery-modal__progress.active {
    display: block;
}

.file-gallery-modal__progress-bar {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.file-gallery-modal__progress-bar-inner {
    height: 100%;
    background: #007bff;
    width: 0%;
    transition: width 0.3s ease;
}
