/**
 * Styles pour les formulaires d'outils image
 * Migré et adapté du plugin Image pour Admin Tools
 */

/* Container principal */
.do-image-tool-form {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Zone d'upload */
.do-upload-area {
    margin-bottom: 20px;
}

.do-drop-zone {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.do-drop-zone:hover,
.do-drop-zone.do-drag-over {
    border-color: #0073aa;
    background: #f0f8ff;
}

.do-drop-content {
    pointer-events: none;
}

.do-drop-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.do-drop-zone h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.do-drop-zone p {
    margin: 0 0 15px 0;
    color: #666;
}

.do-select-files-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    pointer-events: all;
    transition: background 0.3s ease;
}

.do-select-files-btn:hover {
    background: #005a87;
}

.do-file-info {
    font-size: 12px;
    color: #666;
    margin-top: 15px;
}

.do-file-info p {
    margin: 5px 0;
}

/* Options de l'outil */
.do-tool-options {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.do-option-group {
    margin-bottom: 15px;
}

.do-option-group:last-child {
    margin-bottom: 0;
}

.do-option-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.do-option-group input,
.do-option-group select,
.do-option-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.do-option-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.do-option-group input[type="range"] {
    width: 70%;
    margin-right: 10px;
}

.do-option-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/* Aperçu des fichiers */
.do-file-preview {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.do-file-preview h4 {
    margin: 0 0 15px 0;
    color: #333;
}

.do-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.do-file-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.do-file-info {
    margin-bottom: 10px;
}

.do-file-info strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
}

.do-file-size {
    font-size: 12px;
    color: #666;
}

.do-file-preview-thumb {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

.do-file-preview-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.do-file-icon {
    font-size: 24px;
    color: #666;
}

/* Aperçu avant/après */
.do-before-after-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.do-before,
.do-after {
    text-align: center;
}

.do-before h4,
.do-after h4 {
    margin: 0 0 10px 0;
    color: #333;
}

.do-image-preview {
    height: 200px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.do-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Barre de progression */
.do-progress {
    margin-bottom: 20px;
}

.do-progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.do-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    width: 0%;
    transition: width 0.3s ease;
}

.do-progress-text {
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Actions */
.do-form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.do-process-btn,
.do-reset-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.do-process-btn {
    background: #0073aa;
    color: white;
}

.do-process-btn:hover:not(:disabled) {
    background: #005a87;
}

.do-process-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.do-reset-btn {
    background: #666;
    color: white;
}

.do-reset-btn:hover {
    background: #555;
}

/* Messages de résultat */
.do-results {
    margin-top: 20px;
}

.do-success-message,
.do-error-message {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.do-success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.do-error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.do-error {
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .do-image-tool-form {
        padding: 15px;
    }
    
    .do-drop-zone {
        padding: 30px 15px;
    }
    
    .do-before-after-preview {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .do-form-actions {
        flex-direction: column;
    }
    
    .do-preview-list {
        grid-template-columns: 1fr;
    }
}

/* Animations */
.do-drop-zone {
    transition: all 0.3s ease;
}

.do-option-group {
    transition: opacity 0.3s ease;
}

.do-file-item {
    animation: fadeInUp 0.3s ease;
}

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

/* Animation pour le loader du bouton */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles pour le loader du bouton */
.do-btn-loader {
    display: none;
}

.do-process-btn.loading .do-btn-text {
    display: inline;
    margin-right: 8px;
}

.do-process-btn.loading .do-btn-loader {
    display: inline;
}

.do-process-btn.loading {
    background: #6c757d !important;
    cursor: not-allowed !important;
    opacity: 0.8;
}

/* Loader simple et visible */
.do-simple-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.do-simple-loader.show {
    display: flex;
}

.do-simple-loader-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.do-simple-loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

.do-simple-loader-text {
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

/* États de chargement */
.do-image-tool-form.loading .do-drop-zone {
    pointer-events: none;
    opacity: 0.6;
}

.do-image-tool-form.loading .do-form-actions {
    pointer-events: none;
    opacity: 0.6;
}

/* Styles pour les angles rapides de rotation */
.do-quick-angles {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.do-quick-angle-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.do-quick-angle-btn:hover {
    background: #e9e9e9;
    border-color: #0073aa;
}

.do-quick-angle-btn.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.do-help-text {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}
