/* Variables globales */
:root {
    --primary-color: #2196F3;
    --secondary-color: #FF4081;
    --success-color: #4CAF50;
    --error-color: #f44336;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --border-color: #ddd;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-gray);
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* En-tête */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
}

.header h1 {
    font-family: 'Coolvetica', sans-serif;
    font-size: 2.5rem;
    color: #000;
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.header .logo {
    width: 40px;
    height: 40px;
}

.header p {
    color: var(--text-color);
    margin: 0.5rem 0;
}

/* Sections de fichiers */
.file-section {
    position: relative !important;
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    transition: border-color 0.3s ease;
    min-height: 200px;
}

.file-section:hover {
    border-color: var(--primary-color);
}

.file-section h2 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Zone de dépôt de fichiers */
.file-drop-zone {
    position: relative;
    padding: 2rem;
    text-align: center;
    background-color: var(--light-gray);
    border-radius: 4px;
    cursor: pointer;
}

.file-drop-zone.drag-over {
    background-color: rgba(33, 150, 243, 0.1);
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* Liste des fichiers */
.file-list {
    margin-top: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.file-item i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.file-item small {
    margin-left: auto;
    color: #666;
}

/* Gestionnaire de mots-clés */
.keywords-manager {
    margin-bottom: 2rem;
}

.keywords-input {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.keywords-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-item {
    display: inline-flex;
    align-items: center;
    background: var(--light-gray);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin: 0.25rem;
}

.remove-keyword {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 0.25rem;
    margin-left: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-keyword:hover {
    color: var(--error-color);
}

.remove-keyword:focus {
    outline: none;
}

/* Gestionnaire de préfixes à ignorer */
.ignore-prefixes-manager {
    margin-bottom: 2rem;
}

.prefixes-input {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.prefixes-input input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.prefixes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.prefix-item {
    display: inline-flex;
    align-items: center;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin: 0.25rem;
}

.remove-prefix {
    background: none;
    border: none;
    color: #856404;
    padding: 0.25rem;
    margin-left: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-prefix:hover {
    color: var(--error-color);
}

.remove-prefix:focus {
    outline: none;
}

/* Modal de mapping des colonnes */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 4px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: black;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-actions {
    margin-top: 20px;
    text-align: right;
}

.form-actions button {
    margin-left: 10px;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.modal-table th,
.modal-table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.modal-table th:nth-child(1), /* Titre original */
.modal-table th:nth-child(2) { /* Titre matché */
    width: 35%;
}

.modal-table th:nth-child(3) { /* Score */
    width: 10%;
}

.modal-table th:nth-child(4) { /* Code(s) */
    width: 15%;
}

.modal-table th:nth-child(5) { /* Actions */
    width: 120px;
}

.modal-table th {
    background: var(--light-gray);
}

.modal-table th:first-child,
.modal-table th:nth-child(2) {
    width: 25%;
}

.modal-table th:last-child {
    width: 80px;
}

/* Boutons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: darken(var(--primary-color), 10%);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: darken(var(--secondary-color), 10%);
}

.btn-danger {
    background: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background: darken(var(--error-color), 10%);
}

/* Barre de progression */
.progress-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1000;
    max-width: 600px;
    width: 90%;
}

.progress-content {
    text-align: center;
}

.progress-title {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.progress-bar {
    height: 20px;
    background: var(--light-gray);
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0;
    transition: width 0.5s ease;
}

.progress-text {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: var(--text-color);
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    box-shadow: var(--shadow);
}

/* Messages d'erreur et de succès */
.message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.error-message {
    background: #ffebee;
    color: var(--error-color);
    border: 1px solid #ffcdd2;
}

.success-message {
    background: #e8f5e9;
    color: var(--success-color);
    border: 1px solid #c8e6c9;
}

/* Résultats */
.results-container {
    display: none;
    margin-top: 2rem;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.download-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--light-gray);
    border-radius: 8px;
}

.download-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.download-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.download-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.download-item-name {
    font-weight: 500;
    color: var(--text-color);
}

.download-item-size {
    font-size: 0.9rem;
    color: #666;
}

.download-item-count {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 1rem;
        padding: 1rem;
    }

    .modal-content {
        width: 95%;
        margin: 2.5% auto;
        padding: 1rem;
    }

    .file-section {
        padding: 1rem;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Tooltips */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
}

.column-rename {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.column-rename:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.7;
}

.column-rename:not(:disabled) {
    background-color: white;
    cursor: text;
}

.column-type-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.match-title-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.matches-table-container {
    max-height: 60vh;
    overflow-y: auto;
    margin: 1rem 0;
    overflow-x: auto;
}

.modal-table td {
    vertical-align: middle;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}

.modal-table button {
    padding: 0.25rem 0.5rem;
    margin: 0 0.25rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: 4px;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-color);
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.pagination-buttons button {
    padding: 0.5rem 1rem;
    min-width: 40px;
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.autocomplete-input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.autocomplete-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: var(--shadow);
    z-index: 1010;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background-color: var(--light-gray);
}

#codeInputs input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Styles pour le select de matching */
.match-select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.code-group {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--light-gray);
    border-radius: 4px;
}

.code-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.code-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.step {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: var(--light-gray);
    color: var(--text-color);
    font-size: 0.9rem;
}

.step.active {
    background: var(--primary-color);
    color: white;
}

.step.complete {
    background: var(--success-color);
    color: white;
}

.progress-step {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 4px;
    background: var(--light-gray);
    transition: all 0.3s ease;
}

.progress-step.active {
    background: var(--primary-color);
    color: white;
}

.progress-step.complete {
    background: var(--success-color);
    color: white;
}

#progress-container {
    display: none;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--light-gray);
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0;
    transition: width 0.3s ease;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    gap: 10px;
}

.progress-step {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: 4px;
    background: var(--light-gray);
    font-size: 0.9em;
    transition: all 0.3s ease;
}

#progress-text {
    margin-top: 10px;
    text-align: center;
    font-weight: 500;
}

/* Styles pour les boutons d'action */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d32f2f;
}

/* Colonne des actions */
.modal-table th:last-child,
.modal-table td:last-child {
    min-width: 120px;
    text-align: center;
}

/* Style pour les boutons d'action */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.action-buttons button {
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
}

/* Ajustement du contenu des cellules */
.modal-table td {
    vertical-align: middle;
}

.modal-table td:last-child {
    padding: 0.5rem;
    text-align: center;
}

/* Spinner pour l'upload */
.spinner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: none;
}

.spinner-overlay.active {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-message {
    margin-top: 1rem;
    color: #333;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles pour le tri et le filtrage */
.search-filter {
    margin: 1rem 0;
}

.search-filter input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
}

.sortable:hover {
    background-color: var(--light-gray);
}

.sortable i {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
}

.sortable i.fa-sort {
    opacity: 0.3;
}

.sortable i.fa-sort-up,
.sortable i.fa-sort-down {
    opacity: 1;
}

/* Ajouter ces styles pour l'état complet */
.progress-step.error {
    background: var(--error-color);
    color: white;
}

.progress-step.complete {
    background: var(--success-color);
    color: white;
}

.progress-content {
    position: relative;
    z-index: 1;
}
/* Animation pour la transition finale */
.progress-bar-fill.complete {
    transition: width 0.5s ease-out;
    background: var(--success-color);
}

.progress-bar-fill.error {
    background: var(--error-color);
}

/* Remplacer la déclaration @font-face existante par ceci */
@import url('https://fonts.cdnfonts.com/css/coolvetica-2');

/* Styles de pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    gap: 10px;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-color);
}

.pagination-button {
    padding: 5px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-button:hover:not(:disabled) {
    background: var(--light-gray);
}

/* Nouveau bloc pour les erreurs JSON */
.json-error-container {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 1100;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.json-error-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.json-error-icon {
    color: var(--error-color);
    font-size: 3rem;
}

.json-error-message {
    color: var(--text-color);
    font-size: 1.1rem;
    margin: 1rem 0;
    line-height: 1.5;
}

.json-error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Styles pour le rapport d'erreurs */
.error-report-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.error-report-section h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.error-report-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.error-report-item {
    padding: 1rem;
    background: #fff8f8;
    border: 1px solid #ffcdd2;
    border-radius: 6px;
}

.error-report-file {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.error-report-details {
    margin-top: 0.5rem;
}

.error-sheet-item {
    padding: 0.5rem;
    margin: 0.5rem 0;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 4px;
}

.error-sheet-name {
    font-weight: 500;
    color: var(--error-color);
}

.error-message {
    color: #666;
    margin-top: 0.25rem;
}

/* Styles pour le modal de forçage de match */
#forceMatchModal .modal-content {
    max-width: 600px;
}

#forceMatchModal .code-inputs {
    margin-bottom: 20px;
}

#forceMatchModal .code-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

#forceMatchModal .code-input-group input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#forceMatchModal .code-input-group .remove-code {
    padding: 8px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#forceMatchModal #addCodeBtn {
    margin-top: 10px;
    width: 100%;
    padding: 8px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#forceMatchModal #addCodeBtn:hover {
    background-color: #5a6268;
}

/* Style pour le bouton de forçage de match */
.btn-warning {
    background-color: #ffc107;
    color: #000;
    border: none;
}

.btn-warning:hover {
    background-color: #e0a800;
}

/* Style pour les messages de succès */
.toast-content.success {
    background-color: #28a745;
    color: white;
}

/* Ajustements pour les groupes de formulaire */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}
 