/* =============================================
   BREADCRUMB NAVIGATION
   ============================================= */
#search-breadcrumb {
  display: none;
  position: sticky;
  top: 0;
  z-index: 10;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 16px;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-family: inherit;
}

#search-breadcrumb.visible {
  display: flex;
}

.breadcrumb-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f3f4f6;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.breadcrumb-back-btn:hover {
  background: #e5e7eb;
}

.breadcrumb-back-btn svg {
  width: 16px;
  height: 16px;
  stroke: #374151;
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.breadcrumb-link {
  color: #6b7280;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
  white-space: nowrap;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.85rem;
  padding: 2px 0;
}

.breadcrumb-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.breadcrumb-separator {
  color: #d1d5db;
  margin: 0 6px;
  user-select: none;
}

.breadcrumb-current {
  color: #111827;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hide old back buttons when breadcrumb is active */
.search-back-btn {
  display: none !important;
}

/* Styles pour l'affichage en une seule colonne et les comparaisons */

/* Grille horizontale de résultats - 3 par ligne, pleine largeur */
.results-grid-horizontal {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 32px;
  width: 100%;
  max-width: 100%;
}

@media (max-width: 1200px) {
  .results-grid-horizontal {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .results-grid-horizontal {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.category-title-inline {
  font-size: 1.1em;
  padding: 8px 0;
  margin-bottom: 12px;
  font-weight: 600;
  border-left: 4px solid;
  padding-left: 12px;
}

.category-title-inline.high {
  color: #059669;
  border-color: #059669;
}

.category-title-inline.medium {
  color: #D97706;
  border-color: #D97706;
}

.category-title-inline.low {
  color: #94a3b8;
  border-color: #94a3b8;
}

/* Cartes en grille - Design propre avec bordure colorée */
.cert-card-grid {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid #e5e7eb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.cert-card-grid:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Bordures colorées selon le score */
.cert-card-high {
  border-color: #059669;
  border-left-width: 4px;
}

.cert-card-high:hover {
  border-color: #047857;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.2);
}

.cert-card-medium {
  border-color: #D97706;
  border-left-width: 4px;
}

.cert-card-medium:hover {
  border-color: #B45309;
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.2);
}

.cert-card-low {
  border-color: #94a3b8;
  border-left-width: 4px;
}

.cert-card-low:hover {
  border-color: #64748b;
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.2);
}

.cert-header-grid {
  padding: 12px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cert-header-left {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.score-badge-grid {
  font-size: 1.4em;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  color: white;
  min-width: 60px;
  text-align: center;
}

.score-badge-grid.high {
  background: #059669;
}

.score-badge-grid.medium {
  background: #D97706;
}

.score-badge-grid.low {
  background: #94a3b8;
}

.cert-body-grid {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cert-body-grid h4 {
  margin: 0 0 12px 0;
  font-size: 1em;
  color: #111827;
  line-height: 1.5;
  font-weight: 600;
  flex: 1;
  min-height: 65px;
}

.cert-code-grid {
  font-family: 'Courier New', monospace;
  font-size: 0.75em;
  color: #6b7280;
  margin-bottom: 8px;
}

.cert-meta-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.75em;
  color: #6b7280;
  margin-top: auto;
}

.cert-meta-grid span {
  padding: 3px 8px;
  background: #f3f4f6;
  border-radius: 4px;
}

.cert-level-badge {
  font-size: 0.75em;
  padding: 2px 8px;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  font-weight: 500;
}

.cert-status-badge {
  font-size: 0.7em;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cert-status-badge.active {
  background: #d1fae5;
  color: #065F46;
}

.cert-status-badge.inactive {
  background: #fee2e2;
  color: #991b1b;
}

/* Modale de comparaison */
.comparison-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  opacity: 1;
  pointer-events: auto;
}

.comparison-modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 1500px;
  width: 95%;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: auto;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.comparison-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 2px solid var(--border);
  background: linear-gradient(135deg, var(--primary) 0%, #64748b 100%);
  color: white;
}

.comparison-header h2,
.comparison-header h3 {
  margin: 0;
  color: white;
}

.comparison-certs {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 20px;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border);
  gap: 12px;
}

.cert-info {
  text-align: center;
  min-width: 0;
  flex: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cert-info h3 {
  margin: 0 0 8px 0;
  font-size: 1.1em;
  color: var(--primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cert-code {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--text-secondary);
  background: white;
  padding: 4px 12px;
  border-radius: 12px;
}

.vs-separator {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--primary);
  padding: 0 20px;
}

.comparison-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  padding: 20px;
  background: white;
  border-bottom: 2px solid var(--border);
}

.stat-item {
  text-align: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.stat-value {
  display: block;
  font-size: 1.8em;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  display: block;
  font-size: 0.85em;
  color: var(--text-secondary);
}

.comparison-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.comparison-section {
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.1em;
  margin-bottom: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  display: inline-block;
}

.section-title.similar {
  background: #d1fae5;
  color: #146356;
}

.section-title.exclusive1 {
  background: #dbeafe;
  color: #1e40af;
}

.section-title.exclusive2 {
  background: #fef3c7;
  color: #92400e;
}

.comparison-block-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.comparison-block-line:hover {
  background: #E3F1EE;
  transform: translateX(4px);
}

.block-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 0.85em;
  font-weight: 700;
  flex-shrink: 0;
}

.block-name {
  flex: 1;
  font-size: 0.95em;
  color: var(--text-primary);
}

.compare-arrow,
.view-icon {
  color: var(--primary);
  font-size: 1.2em;
  font-weight: bold;
  flex-shrink: 0;
}

/* Modale de comparaison de blocs côte à côte */
.block-comparison-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.block-comparison-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.block-comparison-content {
  position: relative;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 1200px;
  width: 95%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  background: var(--border);
  overflow-y: auto;
  flex: 1;
}

.side-panel {
  background: white;
  padding: 24px;
}

.side-panel h4 {
  margin: 0 0 12px 0;
  color: var(--primary);
  font-size: 1.1em;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.block-title {
  font-size: 1em;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.block-code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 16px;
}

.competences-list-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comp-item {
  padding: 8px 0 8px 24px;
  background: transparent;
  border-radius: 0;
  margin-bottom: 10px;
  font-size: 0.95em;
  line-height: 1.7;
  color: var(--text);
  position: relative;
  display: block;
}

.comp-item::before {
  content: "–";
  position: absolute;
  left: 0;
  top: 8px;
  color: #3b82f6;
  font-weight: 700;
  font-size: 1.2em;
}

.comp-num {
  display: none;
}

/* Styles pour la liste de blocs dans la modale */
.section-title-main {
  color: var(--primary);
  font-size: 1.2em;
  margin-bottom: 8px;
}

.blocks-comparison-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comparison-block-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.comparison-block-item.has-match {
  border-left: 4px solid #146356;
}

.comparison-block-item.no-match {
  border-left: 4px solid #94a3b8;
}

.comparison-block-item:hover {
  background: var(--bg-secondary);
  transform: translateX(4px);
}

.block-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.block-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.match-indicator {
  font-size: 0.85em;
  color: #146356;
  font-weight: 600;
}

.no-match-indicator {
  font-size: 0.85em;
  color: #94a3b8;
  font-weight: 600;
}

.view-arrow {
  color: var(--primary);
  font-size: 1.3em;
  font-weight: bold;
}

.single-block-view {
  padding: 24px;
}

/* Labels pour clarifier */
.cert-label {
  font-size: 0.75em;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.cert-source {
  border-left: 4px solid #146356;
  padding-left: 12px;
}

.cert-compared {
  border-left: 4px solid #94a3b8;
  padding-left: 12px;
}

.panel-label {
  font-size: 0.75em;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 12px;
  display: inline-block;
}

.side-yours .panel-label {
  background: #146356;
}

.side-compared .panel-label {
  background: #94a3b8;
}

.similarity-warning {
  padding: 12px 20px;
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  color: #92400e;
  font-size: 0.9em;
  margin: 0 24px 20px 24px;
  border-radius: 4px;
}

.no-match-message {
  margin-top: 20px;
  padding: 16px;
  background: #fee2e2;
  border-left: 4px solid #ef4444;
  color: #991b1b;
  text-align: center;
  border-radius: 4px;
  font-weight: 600;
}

/* Badges d'expiration */
.expiration-box {
  font-size: 0.7em;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-block;
  margin-top: 4px;
}

.expiration-box.valid {
  background: #d1fae5;
  color: #146356;
  border: 1px solid #6ee7b7;
}

.expiration-box.expired {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Boutons de tri */
.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.sort-btn {
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  color: #374151;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.sort-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.sort-btn.active {
  background: var(--primary, #3b82f6);
  color: white;
  border-color: var(--primary, #3b82f6);
}

.sort-controls select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
  color: #374151;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .results-grid-horizontal {
    grid-template-columns: 1fr;
  }

  .side-by-side {
    grid-template-columns: 1fr;
  }

  .comparison-stats {
    grid-template-columns: 1fr 1fr;
  }

  .cert-body-grid h4 {
    min-height: auto;
  }
}

/* =============================================
   ONGLETS RÉSULTATS
   ============================================= */
.results-tabs {
  display: flex;
  gap: 0;
  margin: 24px 0 20px 0;
  border-bottom: 2px solid #e5e7eb;
}

.results-tab {
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: -2px;
}

.results-tab:hover {
  color: #3b82f6;
  background: #f0f7ff;
}

.results-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.tab-content {
  animation: tabFadeIn 0.25s ease;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bloc source card in tab 2 */
.source-bloc-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 24px;
  overflow: hidden;
}

.source-bloc-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #eff6ff, #f0f7ff);
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.source-bloc-header h4 {
  margin: 0;
  font-size: 1rem;
  color: #1f2937;
  font-weight: 700;
  line-height: 1.4;
  word-wrap: break-word;
  flex: 1;
  min-width: 0;
}

.source-bloc-header .bloc-number {
  background: #3b82f6;
  color: white;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.matching-blocs-list {
  padding: 12px 20px;
}

.matching-bloc-row-wrapper {
  border-bottom: 1px solid #f3f4f6;
}

.matching-bloc-row-wrapper:last-child {
  border-bottom: none;
}

.matching-bloc-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
}

.matching-bloc-row:hover {
  background: #f9fafb;
}

.matching-bloc-score {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  padding: 3px 10px;
  border-radius: 6px;
  text-align: center;
}

.matching-bloc-info {
  min-width: 0;
}

.matching-bloc-title {
  font-size: 0.88rem;
  color: #1f2937;
  font-weight: 500;
  line-height: 1.4;
  word-wrap: break-word;
}

.matching-bloc-cert {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 3px;
}

.matching-bloc-cert code {
  font-family: monospace;
  color: #3b82f6;
  font-weight: 600;
}

/* Panneau compétences dépliable */
.bloc-competences-detail {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  padding: 16px 20px;
  animation: tabFadeIn 0.2s ease;
}

.bloc-comp-side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.bloc-comp-column {
  min-width: 0;
}

.bloc-comp-column-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #dbeafe;
  word-wrap: break-word;
}

.bloc-comp-column:last-child .bloc-comp-column-title {
  color: #C6741F;
  border-bottom-color: #FBEEE3;
}

.bloc-comp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

.bloc-comp-list li {
  font-size: 0.82rem;
  color: #374151;
  line-height: 1.55;
  padding: 4px 0;
  word-wrap: break-word;
}

.bloc-comp-list li:nth-child(odd) {
  background: rgba(0,0,0,0.02);
}

@media (max-width: 768px) {
  .results-tab {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .matching-bloc-row {
    grid-template-columns: 50px 1fr;
  }

  .bloc-comp-side-by-side {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
