/**
 * Estilos para Sistema de Upload de Imagens
 * Inclui drag & drop, preview, progresso e animações
 * 
 * @author Sistema AgendQui
 * @version 1.0
 */

/* === ESTILOS GERAIS === */
.image-upload-container {
    position: relative;
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-upload-container:hover {
    border-color: #4f46e5;
    background: #f1f5f9;
    transform: translateY(-1px);
}

.image-upload-container.drag-over {
    border-color: #10b981;
    background: #ecfdf5;
    transform: scale(1.02);
}

/* === INPUT DE ARQUIVO === */
.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

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

.file-input-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.file-input-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.2);
}

.file-input-button:active {
    transform: translateY(0);
}

/* === PREVIEW DE IMAGEM === */
.image-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.3s ease;
}

.image-preview img {
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.image-preview img:hover {
    transform: scale(1.05);
}

.preview-remove-btn {
    transition: all 0.2s ease;
}

.preview-remove-btn:hover {
    background-color: #dc2626;
    transform: scale(1.1);
}

/* === MODAL DE PROGRESSO === */
.upload-progress-modal {
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.upload-progress-content {
    animation: slideInUp 0.3s ease;
}

.upload-progress-bar {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    animation: pulse 2s infinite;
}

.upload-progress-bar.complete {
    background: linear-gradient(90deg, #10b981, #059669);
    animation: none;
}

/* === SPINNER DE CARREGAMENTO === */
.upload-spinner {
    animation: spin 1s linear infinite;
}

/* === GALERIA DE IMAGENS === */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

/* === INFORMAÇÕES DE COMPRESSÃO === */
.compression-info {
    animation: slideInDown 0.4s ease;
}

.compression-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    animation: bounceIn 0.5s ease;
}

/* === NOTIFICAÇÕES === */
.upload-notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    max-width: 400px;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease;
}

.upload-notification.success {
    background: #10b981;
    color: white;
}

.upload-notification.error {
    background: #ef4444;
    color: white;
}

.upload-notification.warning {
    background: #f59e0b;
    color: white;
}

/* === DRAG AND DROP ZONES === */
[data-drop-zone] {
    position: relative;
    transition: all 0.3s ease;
}

[data-drop-zone].drag-over {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

[data-drop-zone].drag-over::before {
    content: "Solte a imagem aqui";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    font-weight: 600;
    font-size: 1.125rem;
    z-index: 10;
    border-radius: inherit;
}

/* === ESTADOS DE VALIDAÇÃO === */
.file-input-error {
    border-color: #ef4444;
    background: #fef2f2;
}

.file-input-success {
    border-color: #10b981;
    background: #ecfdf5;
}

/* === RESPONSIVIDADE === */
@media (max-width: 768px) {
    .image-upload-container {
        padding: 1.5rem;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .upload-progress-modal .bg-white {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .upload-notification {
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .image-gallery {
        grid-template-columns: 1fr;
    }
    
    .file-input-button {
        width: 100%;
        padding: 1rem;
    }
}

/* === ANIMAÇÕES === */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* === UTILITÁRIOS === */
.upload-hidden {
    display: none !important;
}

.upload-loading {
    pointer-events: none;
    opacity: 0.6;
}

.upload-success {
    border-color: #10b981;
    background: #ecfdf5;
}

.upload-error {
    border-color: #ef4444;
    background: #fef2f2;
}

/* === TEMA ESCURO === */
@media (prefers-color-scheme: dark) {
    .image-upload-container {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .image-upload-container:hover {
        background: #111827;
        border-color: #6366f1;
    }
    
    .image-preview {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .upload-progress-modal .bg-white {
        background: #1f2937;
        color: #f9fafb;
    }
}

/* === ACESSIBILIDADE === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === FOCUS STATES === */
.file-input-button:focus,
.preview-remove-btn:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* === LOADING STATES === */
.uploading .file-input-button {
    background: #9ca3af;
    cursor: not-allowed;
}

.uploading .file-input-button::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
} 