/* Import page styles */

.import-section {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.section-header {
    text-align: left;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Upload area */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--background-color);
    cursor: pointer;
    margin-bottom: 2rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(124, 58, 237, 0.05);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-content i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-content h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* File info */
.file-info {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--background-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.file-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-color);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.file-details i {
    font-size: 2rem;
}

.file-meta {
    flex: 1;
}

.file-meta span {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.file-meta small {
    color: var(--text-secondary);
}

/* Import instructions */
.import-instructions {
    padding: 1.5rem;
    background: rgba(124, 58, 237, 0.05);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary-color);
}

.import-instructions h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.import-instructions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.import-instructions li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.5rem;
}

.import-instructions li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* Column configuration */
.column-mapping {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.mapping-row {
    display: flex;
    flex-direction: column;
}

.mapping-row label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.mapping-row .required {
    color: var(--error-color);
}

.mapping-row select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s ease;
    background: var(--surface-color);
}

.mapping-row select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.column-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Date configuration */
.date-config {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.date-field label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.date-field input,
.date-field select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.date-field input:focus,
.date-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.date-field input[readonly] {
    background: var(--background-color);
    cursor: not-allowed;
}

.date-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(124, 58, 237, 0.1);
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.date-info i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.date-info strong {
    color: var(--primary-color);
}

.date-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Preview stats */
.preview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 2px solid;
}

.stat-box i {
    font-size: 2rem;
}

.stat-box .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-box .stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.stat-total {
    border-color: var(--primary-color);
    background: rgba(124, 58, 237, 0.05);
}

.stat-total i {
    color: var(--primary-color);
}

.stat-total .stat-value {
    color: var(--primary-color);
}

.stat-new {
    border-color: var(--success-color);
    background: rgba(5, 150, 105, 0.05);
}

.stat-new i {
    color: var(--success-color);
}

.stat-new .stat-value {
    color: var(--success-color);
}

.stat-existing {
    border-color: var(--error-color);
    background: rgba(220, 38, 38, 0.05);
}

.stat-existing i {
    color: var(--error-color);
}

.stat-existing .stat-value {
    color: var(--error-color);
}

/* Filter options */
.filter-options {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--radius);
}

.filter-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.filter-options input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
}

/* Preview table */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 500px;
    position: relative;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1800px;
}

.preview-table th,
.preview-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

/* Largeurs spécifiques pour certaines colonnes */
.preview-table th:nth-child(1) { min-width: 120px; } /* Statut */
.preview-table th:nth-child(2) { min-width: 100px; } /* PMID */
.preview-table th:nth-child(3) { min-width: 300px; white-space: normal; } /* Titre */
.preview-table th:nth-child(4) { min-width: 200px; white-space: normal; } /* Auteur(s) */
.preview-table th:nth-child(5) { min-width: 150px; white-space: normal; } /* Revue */
.preview-table th:nth-child(6) { min-width: 120px; } /* Discipline */
.preview-table th:nth-child(7) { min-width: 100px; } /* Catég */
.preview-table th:nth-child(8) { min-width: 80px; } /* Nb Aut */
.preview-table th:nth-child(9) { min-width: 100px; } /* Nb cherch */
.preview-table th:nth-child(10) { min-width: 80px; } /* Pos */
.preview-table th:nth-child(11) { min-width: 100px; } /* Score frac */
.preview-table th:nth-child(12) { min-width: 100px; } /* NCT */
.preview-table th:nth-child(13) { min-width: 100px; } /* Date pub */

.preview-table td:nth-child(3),
.preview-table td:nth-child(4),
.preview-table td:nth-child(5) {
    white-space: normal;
}

.preview-table th {
    background: var(--background-color);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.preview-table tbody tr {
    transition: background-color 0.2s ease;
}

.preview-table tbody tr:hover {
    background: var(--background-color);
}

.preview-table tbody tr.row-existing {
    background: rgba(220, 38, 38, 0.05);
}

.preview-table tbody tr.row-new {
    background: rgba(5, 150, 105, 0.05);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-new {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success-color);
}

.status-existing {
    background: rgba(220, 38, 38, 0.1);
    color: var(--error-color);
}

.status-badge i {
    font-size: 0.875rem;
}

.preview-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Import progress */
.import-progress {
    text-align: center;
    padding: 2rem;
}

.progress-bar-container {
    position: relative;
    width: 100%;
    height: 60px;
    background: var(--background-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border-color);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #9333ea);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    z-index: 10;
}

.progress-info {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.progress-info span {
    font-weight: 700;
    color: var(--primary-color);
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading p {
    font-size: 1.125rem;
}

/* Success message */
.success-message {
    text-align: center;
    padding: 3rem;
}

.success-message i {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.success-message h3 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.success-message p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.success-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .import-section {
        padding: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-content i {
        font-size: 3rem;
    }

    .column-mapping {
        grid-template-columns: 1fr;
    }
    
    .date-config {
        grid-template-columns: 1fr;
    }
    
    .preview-stats {
        grid-template-columns: 1fr;
    }

    .filter-options {
        flex-direction: column;
        gap: 0.75rem;
    }

    .date-actions,
    .preview-actions,
    .success-actions {
        flex-direction: column;
    }

    .date-actions .btn,
    .preview-actions .btn,
    .success-actions .btn {
        width: 100%;
    }
}
