/* === Gestion Nommage === */

.page_nommage {
  padding: 10px 16px;
  font-size: 10pt;
}

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

.header-nommage h1 {
  font-size: 16pt;
  color: var(--main-bg-color);
  margin: 0;
}

/* Toolbar */
.nommage-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #ddd;
}

.nommage-toolbar-left,
.nommage-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nommage-search {
  padding: 5px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 10pt;
  width: 200px;
}

.nommage-filter-check {
  font-size: 10pt;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.nommage-filter-select {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 10pt;
}

/* Buttons */
.nommage-btn {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10pt;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.nommage-btn:hover { background: #f0f0f0; }
.nommage-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.nommage-btn-create { background: #ede7f6; border-color: #7e57c2; color: #5e35b1; }
.nommage-btn-create:hover { background: #d1c4e9; }

.nommage-btn-convention { background: #e8f0fe; border-color: #4285f4; color: #1a73e8; }
.nommage-btn-convention:hover { background: #d2e3fc; }

.nommage-btn-check { background: #fff3e0; border-color: #fb8c00; color: #e65100; }
.nommage-btn-check:hover { background: #ffe0b2; }

.nommage-btn-apply { background: #e8f5e9; border-color: #43a047; color: #2e7d32; }
.nommage-btn-apply:hover { background: #c8e6c9; }

.nommage-btn-sm {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 9pt;
  background: #fff;
}
.nommage-btn-sm:hover { background: #f0f0f0; }
.nommage-btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }

.nommage-btn-check-sm { color: #e65100; border-color: #fb8c00; }
.nommage-btn-apply-sm { color: #2e7d32; border-color: #43a047; }

.nommage-img-count {
  font-size: 8pt;
  color: #888;
  padding: 2px 4px;
}
.nommage-btn-img-sm { color: #5e35b1; border-color: #7e57c2; }

/* Stats */
.nommage-stats {
  display: flex;
  gap: 15px;
  padding: 8px 15px;
  font-size: 9pt;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}

.nommage-stat {
  padding: 2px 8px;
  border-radius: 10px;
  background: #e0e0e0;
}

/* Progress bar */
.nommage-progress-bar {
  height: 4px;
  background: #e0e0e0;
  overflow: hidden;
}

.nommage-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #fb8c00, #43a047);
  transition: width 0.3s ease;
}

/* Table */
.nommage-table-wrapper {
  overflow-x: auto;
}

.nommage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
}

.nommage-table thead th {
  padding: 8px 10px;
  border-bottom: 2px solid #ddd;
  font-weight: 600;
  font-size: 9pt;
  white-space: nowrap;
}

.nommage-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.nommage-table tbody tr:hover { background: #f0f7ff !important; }

.nommage-th-check,
.nommage-td-check { width: 30px; text-align: center; }

.nommage-ref { font-weight: 600; color: var(--main-bg-color, #333); }

.nommage-td-desc { max-width: 250px; }
.nommage-desc-text { color: #666; font-size: 9pt; }

.nommage-td-remarques { max-width: 200px; font-size: 9pt; color: #555; }

.nommage-td-actions {
  white-space: nowrap;
  display: flex;
  gap: 4px;
}

.nommage-selected-row { background: #e3f2fd !important; }

/* Suggestion inline */
.nommage-suggestion {
  margin-top: 3px;
  padding: 2px 6px;
  background: #e8f5e9;
  border-left: 3px solid #43a047;
  border-radius: 2px;
  font-size: 9pt;
  color: #2e7d32;
}

/* Badge statut */
.nommage-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 9pt;
  font-weight: 500;
  white-space: nowrap;
}

.nommage-status-pending { background: #e0e0e0; color: #616161; }
.nommage-status-checking { background: #fff3e0; color: #e65100; }
.nommage-status-conforme { background: #e8f5e9; color: #2e7d32; }
.nommage-status-presque_conforme { background: #fff8e1; color: #f57f17; }
.nommage-status-ameliorable { background: #e0f7fa; color: #00838f; }
.nommage-status-non_conforme { background: #fce4ec; color: #c62828; }
.nommage-status-error { background: #ffebee; color: #b71c1c; }

/* Pagination */
.nommage-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  background: #f8f9fa;
  border-top: 1px solid #ddd;
}

.nommage-pagination-info {
  font-size: 10pt;
  color: #555;
  margin: 0 8px;
}

/* Extrafields sub-row */
.nommage-extrafields-row td {
  padding: 0 10px 8px 10px !important;
  background: #fafafa;
  border-bottom: 2px solid #ddd;
}

.nommage-extrafields-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
}

.nommage-extrafields-table tr:not(:last-child) td {
  border-bottom: 1px solid #eee;
}

.nommage-extrafields-table td {
  padding: 4px 8px;
  vertical-align: top;
}

.nommage-ef-label {
  font-weight: 600;
  color: #555;
  white-space: nowrap;
  width: 150px;
}

.nommage-ef-value {
  color: #333;
}

.nommage-ef-separator td {
  font-weight: 700;
  font-size: 9pt;
  color: #333;
  background: #e8eaf6;
  padding: 5px 8px;
  border-bottom: 2px solid #c5cae9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nommage-ef-suggestion {
  color: #2e7d32;
}

/* Modal buttons */
.nommage-modal-beta .modal-button,
.nommage-modal-convention .modal-button,
.nommage-modal-detail .modal-button,
.nommage-modal-create .modal-button,
.nommage-modal-success .modal-button {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
}

/* Beta warning */
.nommage-modal-beta {
  max-width: 500px;
  text-align: center;
}

.nommage-modal-beta .modal-body p {
  font-size: 11pt;
  margin: 5px 0;
}

/* Empty */
.nommage-empty {
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 11pt;
}

/* Modal convention */
.nommage-modal-convention {
  max-width: 700px;
  width: 90%;
}

.nommage-convention-help {
  font-size: 9pt;
  color: #666;
  margin-bottom: 10px;
}

.nommage-convention-textarea {
  width: 100%;
  font-family: monospace;
  font-size: 10pt;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
}

/* Modal detail */
.nommage-modal-detail {
  max-width: 900px;
  width: 90%;
}

.nommage-detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
}

.nommage-detail-table th,
.nommage-detail-table td {
  padding: 8px 12px;
  border: 1px solid #ddd;
  text-align: left;
  vertical-align: top;
}

.nommage-detail-table th {
  background: #f5f5f5;
  font-size: 10pt;
}

.nommage-detail-desc {
  max-width: 350px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 9pt;
}

.nommage-diff {
  background: #e8f5e9 !important;
  font-weight: 600;
}

.nommage-detail-remarques {
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
  margin-bottom: 10px;
  font-size: 10pt;
}

.nommage-detail-remarques p { margin: 5px 0 0 0; color: #555; }

.nommage-detail-raw {
  padding: 10px;
  background: #263238;
  color: #e0e0e0;
  border-radius: 4px;
  font-size: 9pt;
  margin-bottom: 10px;
}

.nommage-detail-raw pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 5px 0 0 0;
}

/* Modal création par EAN */
.nommage-modal-create {
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.nommage-create-step { margin-bottom: 12px; }
.nommage-create-step label { display: block; margin-bottom: 5px; font-size: 10pt; }

.nommage-create-ean-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nommage-create-ean-input {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 11pt;
  width: 250px;
  font-family: monospace;
}

.nommage-create-alert {
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-size: 10pt;
}

.nommage-create-alert-error { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
.nommage-create-alert-ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; display: flex; align-items: center; flex-wrap: wrap; }
.nommage-create-alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; white-space: pre-wrap; }

.nommage-create-form { margin-top: 15px; }
.nommage-create-form h4 {
  font-size: 10pt;
  color: #555;
  margin: 15px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid #ddd;
}

.nommage-create-table {
  width: 100%;
  border-collapse: collapse;
}

.nommage-create-table td {
  padding: 4px 6px;
  vertical-align: top;
}

.nommage-create-field-label {
  font-weight: 600;
  font-size: 9pt;
  color: #555;
  white-space: nowrap;
  width: 140px;
  padding-top: 8px !important;
}

.nommage-create-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 10pt;
  box-sizing: border-box;
}

.nommage-create-input:focus {
  border-color: #7e57c2;
  outline: none;
  box-shadow: 0 0 0 2px rgba(126, 87, 194, 0.15);
}

textarea.nommage-create-input {
  resize: vertical;
  font-family: inherit;
}

select.nommage-create-input {
  width: auto;
  min-width: 150px;
}

.nommage-modal-success {
  max-width: 450px;
  text-align: center;
}

.nommage-modal-success .modal-body p {
  margin: 8px 0;
  font-size: 11pt;
}

.nommage-create-cat-hint {
  display: block;
  font-size: 8pt;
  color: #888;
  margin-top: 2px;
}

/* Images web */
.nommage-create-images-section h4 {
  display: flex;
  align-items: center;
}

.nommage-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.nommage-image-card {
  border: 2px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
}
.nommage-image-card:hover { border-color: #999; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.nommage-image-selected { border-color: #43a047 !important; box-shadow: 0 0 0 2px rgba(67, 160, 71, 0.3) !important; }
.nommage-image-verified { border-color: #a5d6a7; }
.nommage-image-rejected { opacity: 0.5; }

.nommage-image-thumb {
  position: relative;
  width: 100%;
  height: 120px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.nommage-image-check {
  position: absolute;
  top: 4px;
  right: 4px;
  color: #43a047;
  font-size: 18px;
  text-shadow: 0 0 3px #fff;
}

.nommage-image-info {
  padding: 4px 6px;
  border-top: 1px solid #eee;
}

.nommage-image-title {
  display: block;
  font-size: 8pt;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nommage-image-badge {
  display: inline-block;
  font-size: 7pt;
  padding: 1px 5px;
  border-radius: 8px;
  margin-top: 2px;
}
.nommage-image-badge-ok { background: #e8f5e9; color: #2e7d32; }
.nommage-image-badge-warn { background: #fff3e0; color: #e65100; }
.nommage-image-badge-unknown { background: #e0e0e0; color: #616161; }
