/* ================================================================
   NAVIGATION INTELLIGENTE V3 - Proposition 3: Hybride
   ================================================================
   Sidebar organisée par sections intelligentes plutôt que par types
   ================================================================ */

/* Navigation Container */
.tc-sidebar-nav-smart {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) 0;
}

/* Vue d'ensemble (item fixe) */
.tc-sidebar-nav-smart > .tc-nav-item {
  margin: 0 var(--space-4);
  padding: var(--space-3);
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--stone-700);
  font-weight: 500;
}

.tc-sidebar-nav-smart > .tc-nav-item:hover {
  background: white;
  border-color: var(--sage-400);
  color: var(--stone-900);
  box-shadow: var(--shadow-sm);
}

.tc-sidebar-nav-smart > .tc-nav-item.active {
  background: var(--sage-50);
  border-color: var(--sage-500);
  color: var(--sage-700);
}

.tc-sidebar-nav-smart > .tc-nav-item .material-symbols-outlined {
  font-size: 20px;
  color: var(--sage-600);
}

/* ================================================================
   SECTIONS INTELLIGENTES
   ================================================================ */

.tc-smart-section {
  margin-bottom: var(--space-2);
  padding: 0 var(--space-4);
}

/* Titres de section */
.tc-smart-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--stone-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--stone-200);
}

.tc-smart-section-title .material-symbols-outlined {
  font-size: 18px;
  color: var(--sage-600);
}

/* Badge de compteur */
.tc-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--stone-200);
  color: var(--stone-700);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
}

/* Bouton refresh inline */
.tc-btn-refresh-inline {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--stone-500);
  transition: all 0.2s ease;
}

.tc-btn-refresh-inline:hover {
  background: var(--stone-100);
  color: var(--sage-600);
}

.tc-btn-refresh-inline:active {
  transform: rotate(180deg);
}

/* Contenu des sections */
.tc-smart-section-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ================================================================
   ITEMS INTELLIGENTS (dans les sections)
   ================================================================ */

.tc-smart-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--stone-50);
  border: 1px solid var(--stone-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.tc-smart-item:hover {
  background: white;
  border-color: var(--sage-400);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.tc-smart-item:focus {
  outline: 2px solid var(--sage-500);
  outline-offset: 2px;
}

/* Icône de l'item */
.tc-smart-item-icon {
  width: 36px;
  height: 36px;
  background: var(--sage-100);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tc-smart-item-icon .material-symbols-outlined {
  font-size: 20px;
  color: var(--sage-600);
}

/* Contenu de l'item */
.tc-smart-item-content {
  flex: 1;
  min-width: 0;
}

.tc-smart-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--stone-900);
  margin: 0 0 4px 0;
  /* Permettre le multiligne avec limitation à 2 lignes */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  word-wrap: break-word;
}

.tc-smart-item-meta {
  font-size: 12px;
  color: var(--stone-600);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Barre de progression inline */
.tc-progress-bar-inline {
  width: 60px;
  height: 4px;
  background: var(--stone-200);
  border-radius: 2px;
  overflow: hidden;
}

.tc-progress-fill-inline {
  height: 100%;
  background: var(--sage-500);
  transition: width 0.3s ease;
}

/* Badge score IA */
.tc-ai-score-badge {
  padding: 2px 6px;
  background: var(--copper-100);
  color: var(--copper-700);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

/* Badge favori */
.tc-favorite-badge {
  color: var(--copper-500);
  font-size: 16px;
}

/* ================================================================
   SECTION "TERMINÉS" (collapsible)
   ================================================================ */

.tc-smart-section-title.collapsible {
  cursor: pointer;
  user-select: none;
  padding: var(--space-2);
  margin: 0 calc(var(--space-2) * -1) var(--space-3);
  border-radius: 6px;
  border-bottom: none;
}

.tc-smart-section-title.collapsible:hover {
  background: var(--stone-100);
  color: var(--stone-900);
}

.tc-toggle-icon {
  margin-left: auto;
  transition: transform 0.3s ease;
}

.tc-smart-section.collapsed .tc-smart-section-content {
  display: none;
}

.tc-smart-section:not(.collapsed) .tc-toggle-icon {
  transform: rotate(180deg);
}

/* ================================================================
   SECTION "TOUT PARCOURIR"
   ================================================================ */

.tc-section-browse {
  background: var(--stone-50);
  border-radius: 10px;
}

.tc-btn-browse-all {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--sage-500);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: var(--space-3);
}

.tc-btn-browse-all:hover {
  background: var(--sage-600);
  box-shadow: var(--shadow-md);
}

.tc-btn-browse-all:active {
  transform: scale(0.98);
}

.tc-btn-browse-all .material-symbols-outlined {
  font-size: 20px;
}

.tc-btn-browse-all kbd {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
  margin-left: var(--space-2);
}

/* Statistiques de navigation */
.tc-browse-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tc-stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--stone-600);
}

.tc-stat-item .material-symbols-outlined {
  font-size: 16px;
  color: var(--stone-500);
}

.tc-stat-item span:nth-child(2) {
  font-weight: 600;
  color: var(--stone-800);
}

/* ================================================================
   ÉTATS VIDES
   ================================================================ */

.tc-section-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--stone-500);
  font-size: 13px;
}

.tc-section-empty .material-symbols-outlined {
  font-size: 32px;
  color: var(--stone-400);
  margin-bottom: var(--space-2);
}

/* État de chargement (skeleton) */
.tc-smart-item-skeleton {
  height: 64px;
  background: linear-gradient(
    90deg,
    var(--stone-100) 0%,
    var(--stone-200) 50%,
    var(--stone-100) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 768px) {
  .tc-smart-section {
    padding: 0 var(--space-3);
  }

  .tc-section-browse {
    margin: var(--space-3);
    padding: var(--space-3);
  }

  .tc-smart-item-title {
    font-size: 13px;
    /* Conserver le multiligne sur mobile */
    -webkit-line-clamp: 2;
  }

  .tc-smart-item-meta {
    font-size: 11px;
  }
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */

.tc-smart-item:focus-visible,
.tc-btn-browse-all:focus-visible,
.tc-btn-refresh-inline:focus-visible,
.tc-smart-section-title.collapsible:focus-visible {
  outline: 2px solid var(--sage-500);
  outline-offset: 2px;
}

/* Support clavier pour les sections collapsibles */
.tc-smart-section-title.collapsible[aria-expanded="false"] .tc-toggle-icon {
  transform: rotate(0deg);
}

.tc-smart-section-title.collapsible[aria-expanded="true"] .tc-toggle-icon {
  transform: rotate(180deg);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tc-smart-item,
  .tc-btn-browse-all,
  .tc-toggle-icon,
  .tc-progress-fill-inline {
    transition: none;
  }

  .tc-smart-item-skeleton {
    animation: none;
  }
}

/* ================================================================
   HIGH CONTRAST MODE
   ================================================================ */

@media (prefers-contrast: high) {
  .tc-smart-item {
    border-width: 2px;
  }

  .tc-smart-item:hover {
    border-width: 3px;
  }

  .tc-btn-browse-all {
    border: 2px solid currentColor;
  }
}
