/* 
 * SmartImport CSS - Styles pour l'interface
 * @author Massaoud <massaoud@idzprod.net>
 * @copyright 2025 Massaoud  
 * @license GPL-3.0+
 */

/* ==================================================
   PROGRESS STEPS (Indicateur d'étapes)
   ================================================== */
.progress-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    font-size: 14px;
    flex-wrap: wrap;
}

.progress-steps .step {
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.progress-steps .step.completed {
    background-color: #28a745;
    color: white;
}

.progress-steps .step.active {
    background-color: #007bff;
    color: white;
    border: 2px solid #0056b3;
}

.progress-steps .step.pending {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

/* ==================================================
   PROGRESS BAR (Barre de progression)
   ================================================== */
.progress-bar {
    width: 100%;
    height: 25px;
    background-color: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    margin: 15px 0;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#progress-text {
    margin-top: 10px;
    font-weight: 600;
    color: #495057;
}

/* ==================================================
   IMPORT RESULTS (Cartes de résultats)
   ================================================== */
.import-results {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.result-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    transition: transform 0.2s ease;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.result-card.success {
    border-left: 4px solid #28a745;
}

.result-card.error {
    border-left: 4px solid #dc3545;
}

.result-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #495057;
}

.result-card.success .result-value {
    color: #28a745;
}

.result-card.error .result-value {
    color: #dc3545;
}

.result-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ==================================================
   FORM STYLING (Amélioration des formulaires)
   ================================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-label.required-field::after {
    content: ' *';
    color: #dc3545;
}

.form-help {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    line-height: 1.4;
}

select.flat, input[type="file"].flat {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    transition: border-color 0.2s ease;
}

select.flat:focus, input[type="file"]:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* ==================================================
   TABLE IMPROVEMENTS (Amélioration des tableaux)
   ================================================== */
.noborder th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    padding: 12px 8px;
}

.noborder .oddeven:hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}

/* ==================================================
   BUTTONS (Amélioration des boutons)
   ================================================== */
.button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background-color: #007bff;
    color: white;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    cursor: pointer;
}

.button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: white;
    text-decoration: none;
}

.button:active {
    transform: translateY(0);
}

/* ==================================================
   ALERT BOXES (Boîtes d'alerte)
   ================================================== */
.info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 12px 16px;
    border-radius: 5px;
    margin: 15px 0;
}

.info h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #0c5460;
}

.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 5px;
    margin: 15px 0;
}

/* ==================================================
   RESPONSIVE DESIGN
   ================================================== */
@media (max-width: 768px) {
    .progress-steps {
        flex-direction: column;
        gap: 10px;
    }
    
    .progress-steps .step {
        width: 100%;
        text-align: center;
    }
    
    .import-results {
        flex-direction: column;
        align-items: center;
    }
    
    .result-card {
        width: 100%;
        max-width: 200px;
    }
    
    .div-table-responsive-no-min {
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .form-group input,
    .form-group select {
        width: 100%;
        box-sizing: border-box;
    }
    
    .button {
        width: 100%;
        text-align: center;
        margin: 5px 0;
    }
}

/* ==================================================
   UPLOAD ZONE STYLING
   ================================================== */
input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed #ced4da;
    border-radius: 8px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="file"]:hover {
    border-color: #007bff;
    background-color: #e3f2fd;
}

input[type="file"]:focus {
    border-color: #007bff;
    background-color: #e3f2fd;
    outline: none;
}

/* ==================================================
   MAPPING TABLE STYLING
   ================================================== */
.mapping-table select {
    width: 100%;
    min-width: 200px;
}

.mapping-table .csv-column {
    font-weight: 600;
    background-color: #f8f9fa;
    padding: 8px;
    border-radius: 4px;
}

.mapping-table .field-description {
    font-style: italic;
    color: #6c757d;
    font-size: 11px;
    line-height: 1.3;
}

/* ==================================================
   LOADING ANIMATIONS
   ================================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,123,255,.3);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================================================
   STATUS BADGES (Badges de statut)
   ================================================== */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.processing {
    background-color: #cce5ff;
    color: #004085;
    border: 1px solid #80bdff;
}

.status-badge.completed {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.failed {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ==================================================
   UTILITY CLASSES
   ================================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

/* ==================================================
   DOLIBARR INTEGRATION (Intégration avec Dolibarr)
   ================================================== */
.fichecenter .smartimport-container {
    max-width: 1200px;
    margin: 0 auto;
}

.pictofixedwidth {
    width: 16px;
    margin-right: 6px;
}

/* Override Dolibarr styles if needed */
.noborder.centpercent {
    margin-bottom: 20px;
}

.liste_titre th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
}

/* ==================================================
   DARK MODE SUPPORT (if enabled in Dolibarr)
   ================================================== */
@media (prefers-color-scheme: dark) {
    .result-card {
        background-color: #2d3436;
        border-color: #636e72;
        color: #ddd;
    }
    
    .progress-bar {
        background-color: #2d3436;
        border-color: #636e72;
    }
    
    .info {
        background-color: #2d3436;
        border-color: #636e72;
        color: #74b9ff;
    }
    
    input[type="file"] {
        background-color: #2d3436;
        border-color: #636e72;
        color: #ddd;
    }
}

/* ==================================================
   PRINT STYLES
   ================================================== */
@media print {
    .progress-steps,
    .button,
    form {
        display: none;
    }
    
    .import-results {
        break-inside: avoid;
    }
}

/* ================================================================
 * UTILITY CLASSES
 * ================================================================ */


.border-success {
    border-color: #5cb85c !important;
}

.border-warning {
    border-color: #f0ad4e !important;
}

.border-danger {
    border-color: #d9534f !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

.bg-success-light {
    background-color: #f0fff0 !important;
}

.bg-warning-light {
    background-color: #fffbf0 !important;
}

.bg-danger-light {
    background-color: #fff0f0 !important;
}