/* Form Auto-save & Image Upload Styles */

/* Auto-save indicator */
.autosave-indicator {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.autosave-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

.autosave-indicator.saving {
    border-color: var(--accent-blue, #1b3050);
}

.autosave-indicator.saved {
    border-color: var(--accent-green, #10b981);
}

.autosave-indicator .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: var(--accent-blue, #1b3050);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.autosave-indicator .icon {
    font-size: 1rem;
}

.autosave-indicator .icon.saving {
    color: var(--accent-blue, #1b3050);
}

.autosave-indicator .icon.saved {
    color: var(--accent-green, #10b981);
}

.autosave-indicator .text {
    color: var(--text-primary, #e2e8f0);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Clear saved data button */
.clear-saved-data-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red, #ef4444);
    padding: 0.625rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
}

.clear-saved-data-btn.show {
    opacity: 1;
    pointer-events: all;
}

.clear-saved-data-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red, #ef4444);
    transform: translateY(-2px);
}

/* Image upload container */
.image-upload-container {
    margin-top: 1rem;
}

.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.upload-item {
    position: relative;
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.upload-item:hover {
    border-color: var(--accent-blue, #1b3050);
    box-shadow: 0 4px 12px rgba(27, 48, 80, 0.2);
}

.upload-item-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: var(--bg-primary, #0f172a);
}

.upload-item-info {
    padding: 0.75rem;
}

.upload-item-name {
    color: var(--text-primary, #e2e8f0);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-item-size {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

/* Progress bar */
.upload-progress {
    height: 4px;
    background: var(--bg-primary, #0f172a);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue, #1b3050), var(--accent-purple, #8b5cf6));
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.upload-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.upload-status.uploading {
    color: var(--accent-blue, #1b3050);
}

.upload-status.success {
    color: var(--accent-green, #10b981);
}

.upload-status.error {
    color: var(--accent-red, #ef4444);
}

.upload-status i {
    font-size: 0.85rem;
}

/* Remove button */
.upload-remove-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    z-index: 10;
}

.upload-remove-btn:hover {
    background: var(--accent-red, #ef4444);
    transform: scale(1.1);
}

/* Upload stats */
.upload-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(27, 48, 80, 0.1);
    border: 1px solid rgba(27, 48, 80, 0.2);
    border-radius: 8px;
    margin-top: 1rem;
}

.upload-stats-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-stats-label {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.85rem;
}

.upload-stats-value {
    color: var(--text-primary, #e2e8f0);
    font-weight: 600;
    font-size: 0.9rem;
}

.upload-stats-icon {
    color: var(--accent-blue, #1b3050);
    font-size: 1rem;
}

/* Drag and drop zone */
.image-drop-zone {
    border: 2px dashed var(--border-color, #334155);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background: var(--bg-secondary, #1e293b);
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-drop-zone:hover,
.image-drop-zone.dragover {
    border-color: var(--accent-blue, #1b3050);
    background: rgba(27, 48, 80, 0.05);
}

.image-drop-zone-icon {
    font-size: 3rem;
    color: var(--accent-blue, #1b3050);
    margin-bottom: 1rem;
}

.image-drop-zone-text {
    color: var(--text-primary, #e2e8f0);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.image-drop-zone-hint {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.85rem;
}

/* Loading overlay for uploads */
.upload-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.upload-loading-overlay.active {
    display: flex;
}

.upload-loading-content {
    background: var(--bg-card, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
}

.upload-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color, #334155);
    border-top-color: var(--accent-blue, #1b3050);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

.upload-loading-text {
    color: var(--text-primary, #e2e8f0);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-loading-subtext {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
}

/* Restored data notification */
.restored-data-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    z-index: 9999;
    display: none;
    align-items: center;
    gap: 1rem;
    animation: slideInRight 0.3s ease;
}

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

.restored-data-notification.show {
    display: flex;
}

.restored-data-notification .icon {
    font-size: 1.5rem;
}

.restored-data-notification .content {
    flex: 1;
}

.restored-data-notification .title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.restored-data-notification .message {
    font-size: 0.85rem;
    opacity: 0.9;
}

.restored-data-notification .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.restored-data-notification .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .upload-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .autosave-indicator,
    .clear-saved-data-btn {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        font-size: 0.8rem;
    }
    
    .restored-data-notification {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }
}
