/* ===== GALERIA AVANÇADA - SISTEMA DE FOTOS MODERNO ===== */

/* CSS Custom Properties para Galeria */
:root {
    /* Cores da Galeria */
    --gallery-bg: #f8fafc;
    --gallery-item-bg: #ffffff;
    --gallery-border: #e2e8f0;
    --gallery-hover: #f1f5f9;
    
    /* Dimensões */
    --gallery-border-radius: 12px;
    --gallery-item-size: 120px;
    --gallery-gap: 16px;
    
    /* Sombras */
    --gallery-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --gallery-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Container da Galeria */
.gallery-container-modern {
    background: var(--gallery-bg);
    border-radius: var(--gallery-border-radius);
    padding: 20px;
    border: 2px dashed var(--gallery-border);
    min-height: 200px;
    position: relative;
}

.gallery-container-modern.has-images {
    border-style: solid;
    background: var(--gallery-item-bg);
}

/* Grid da Galeria */
.gallery-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--gallery-item-size), 1fr));
    gap: var(--gallery-gap);
    margin-bottom: 16px;
}

/* Item da Galeria */
.gallery-item-modern {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--gallery-border-radius);
    overflow: hidden;
    background: var(--gallery-item-bg);
    border: 2px solid var(--gallery-border);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--gallery-shadow);
}

.gallery-item-modern:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--gallery-shadow-hover);
    border-color: #3b82f6;
}

.gallery-item-modern img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.gallery-item-modern:hover img {
    transform: scale(1.1);
}

/* Overlay do Item */
.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.4), rgba(0,0,0,0.7));
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gallery-item-modern:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-overlay-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.gallery-overlay-btn:hover {
    background: white;
    transform: scale(1.1);
}

.gallery-overlay-btn.view {
    color: #3b82f6;
}

.gallery-overlay-btn.remove {
    color: #dc2626;
}

/* Badge de Destaque */
.gallery-item-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Placeholder para Galeria Vazia */
.gallery-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6b7280;
}

.gallery-empty-icon {
    font-size: 48px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.gallery-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.gallery-empty-subtitle {
    font-size: 14px;
    color: #6b7280;
}

/* Upload Area */
.gallery-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: var(--gallery-border-radius);
    padding: 24px;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.gallery-upload-area:hover,
.gallery-upload-area.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.gallery-upload-icon {
    font-size: 32px;
    color: #94a3b8;
    margin-bottom: 12px;
}

.gallery-upload-text {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.gallery-upload-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Preview de Upload */
.gallery-upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.gallery-upload-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
}

.gallery-upload-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #e2e8f0;
}

.gallery-upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    transition: width 0.3s ease;
}

.gallery-upload-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.gallery-upload-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Contador de Fotos */
.gallery-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 12px;
    color: #475569;
}

.gallery-counter-text {
    font-weight: 500;
}

.gallery-counter-limit {
    color: #64748b;
}

/* Responsividade */
@media (max-width: 768px) {
    .gallery-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .gallery-container-modern {
        padding: 16px;
    }
    
    .gallery-upload-area {
        padding: 20px;
    }
    
    .gallery-upload-preview {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .gallery-grid-modern {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .gallery-upload-preview {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Animações */
@keyframes galleryItemAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-item-modern {
    animation: galleryItemAppear 0.3s ease;
}

/* Estados de Loading */
.gallery-item-loading {
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item-loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Erro de Carregamento */
.gallery-item-error {
    background: #fef2f2;
    border-color: #fecaca;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #dc2626;
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

.gallery-item-error i {
    font-size: 20px;
    margin-bottom: 4px;
}

/* Drag and Drop */
.gallery-container-modern.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}

.gallery-container-modern.drag-over::after {
    content: 'Solte as imagens aqui';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 600;
    color: #3b82f6;
    background: rgba(255, 255, 255, 0.9);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}