* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Nunito', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.header {
    background: #061551;
    color: white;
    padding: 30px;
    text-align: center;
    border-bottom: 4px solid #F27146;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-logo {
    height: 60px;
    width: auto;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 0;
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.upload-section {
    padding: 40px;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.upload-box {
    border: 2px dashed #F27146;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-box:hover {
    background: #fff5f2;
    border-color: #2F2E2E;
    transform: translateY(-2px);
}

.upload-box.dragover {
    background: #fff0eb;
    border-color: #2F2E2E;
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.file-input {
    display: none;
}

.btn-primary {
    background: #F27146;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(242, 113, 70, 0.3);
}

.btn-primary:hover {
    background: #e6632f;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(242, 113, 70, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.select-existing {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
}

.select-existing select {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
}

.results-section {
    display: none;
    padding: 40px;
}

.split-view {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

.input-panel, .results-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    max-height: 70vh;
    overflow-y: auto;
}

.panel-header {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #2F2E2E;
    font-weight: 700;
}

.product-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.product-item:hover {
    border-color: #F27146;
    transform: translateX(3px);
}

.product-item.selected {
    border-color: #2F2E2E;
    background: #fff5f2;
}

.product-item.validated {
    background: #fff9c4;
    border-left: 4px solid #ffd700;
}

.product-item.validated::after {
    content: "✓";
    color: #ffd700;
    font-weight: bold;
    font-size: 1.2em;
    margin-left: 10px;
}

.result-item {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #F27146;
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-item:hover {
    transform: translateX(3px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.result-item.selected-match {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.result-rank {
    background: #2F2E2E;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 15px;
}

.result-info {
    flex: 1;
}

.result-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.result-meta {
    font-size: 0.9em;
    color: #666;
}

.agec-badge {
    background: #28a745;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    margin-left: 10px;
}

.loader {
    display: none;
    text-align: center;
    padding: 40px;
}

.loader.active {
    display: block;
}

.spinner {
    width: 300px;
    height: 300px;
    margin: 0 auto 20px;
    position: relative;
}

#pulse-canvas {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
}

.progress-container {
    width: 100%;
    max-width: 600px;
    margin: 20px auto 0;
}

.progress-bar-wrapper {
    background: #e9ecef;
    border-radius: 25px;
    height: 30px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #F27146 0%, #e6632f 100%);
    width: 0%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.9em;
    box-shadow: 0 2px 4px rgba(242, 113, 70, 0.3);
}

.progress-text {
    margin-top: 10px;
    font-size: 0.95em;
    color: #666;
}

.progress-status {
    font-weight: 600;
    color: #2F2E2E;
}


.vote-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.vote-btn {
    background: none;
    border: 1px solid #dee2e6;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.vote-btn:hover {
    transform: scale(1.1);
    border-color: #F27146;
}

.vote-btn.voted-up {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.vote-btn.voted-down {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.comment-btn {
    background: none;
    border: 1px solid #dee2e6;
    padding: 4px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.comment-btn:hover {
    border-color: #F27146;
    color: #F27146;
}

.comment-btn.has-comment {
    background: #fff3e0;
    border-color: #F27146;
    color: #F27146;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.modal-header {
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2F2E2E;
}

.modal-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
}

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

.btn-cancel {
    background: #e9ecef;
    color: #333;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.btn-save {
    background: #F27146;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

/* Barre de recherche produits */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 0.9em;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #F27146;
    box-shadow: 0 0 0 3px rgba(242, 113, 70, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.2s ease;
}

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

.search-result-item:hover {
    background: #fff5f2;
}

.search-result-sku {
    font-weight: 600;
    color: #2F2E2E;
    margin-bottom: 3px;
}

.search-result-designation {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 3px;
}

.search-result-meta {
    font-size: 0.75em;
    color: #999;
}

/* Produit forcé */
.result-item.forced {
    background: #fffbea;
    border-left: 4px solid #ffd700;
    animation: slideInForced 0.4s ease-out;
}

.forced-badge {
    background: #ffd700;
    color: #2F2E2E;
    width: 35px;
    height: 35px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 15px;
}

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

/* Aucun produit sélectionné (skip mode) */
.product-item.no-product {
    background: #fff2f2;
    border-left: 3px solid #dc3545 !important;
}

/* Validation rouge pour 'Aucun produit' */
.product-item.no-product.validated::after {
    content: "✓ Validé (aucun produit)";
    color: #dc3545; /* red check + label */
    font-weight: 700;
    margin-left: 10px;
}

.no-product-chip {
    background: #ffe6e6;
    color: #b02a37;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
}

.no-product-banner {
    background: #fff2f2;
    color: #842029;
    border: 1px solid #f5c2c7;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 600;
}

.result-item.no-product-overlay {
    background: #fff2f2;
    opacity: 0.8;
    pointer-events: none; /* disable interactions */
}
