/* CSS pour Sidebar Unifiée - Version Minimaliste */

.sidebar-content-unifiee {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-header-unifiee {
  padding: 8px;
  border-bottom: 1px solid var(--bordure);
}

.sidebar-tabs-unifies {
  display: flex;
  gap: 4px;
}

.btn-toggle-vue {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  color: var(--texte-secondaire);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-toggle-vue:hover {
  background: var(--hover-overlay);
  border-color: var(--bordure-hover);
}

.btn-toggle-vue.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.sidebar-filtres {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--bordure);
}

.btn-filtre {
  flex: 1;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  color: var(--texte-secondaire);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-filtre:hover {
  background: var(--hover-overlay);
}

.btn-filtre.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent);
}

.vue-historique,
.vue-contacts {
  display: none;
  flex: 1;
  overflow-y: auto;
}

.vue-historique.active,
.vue-contacts.active {
  display: block;
}

.liste-historique,
.liste-contacts {
  padding: 4px;
}

.contacts-section {
  margin: 12px 0;
}

.contacts-section-titre {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  color: var(--texte-secondaire, #666);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.conversation-item,
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin: 4px 0;
  background: var(--fond-secondaire, #f5f5f5);
  border: 1px solid var(--bordure, #ddd);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

/* Marquages temporels - barre de gauche */
.conversation-item.activite-tres-recente::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #ef4444;
  border-radius: 8px 0 0 8px;
  animation: pulseTresRecent 1.5s infinite ease-in-out;
}

.conversation-item.activite-recente::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #f59e0b;
  border-radius: 8px 0 0 8px;
}

.conversation-item.activite-aujourdhui::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #3b82f6;
  border-radius: 8px 0 0 8px;
}

@keyframes pulseTresRecent {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 8px #ef4444;
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 0 #ef4444;
  }
}

/* Badge messages non lus */
.badge-non-lus {
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  margin-left: auto;
}

.conversation-item.conversation-non-lue {
  font-weight: 600;
}

.conversation-item.conversation-non-lue .conversation-titre {
  font-weight: 600;
  color: var(--accent, #007bff);
}

/* Bouton supprimer conversation */
.btn-supprimer-conv {
  display: none;
  background: transparent;
  border: none;
  color: var(--texte-tertiaire, #888);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.conversation-item:hover .btn-supprimer-conv {
  display: block;
}

.btn-supprimer-conv:hover {
  background: #ef4444;
  color: white;
}

.conversation-date {
  font-size: 11px;
  color: var(--texte-tertiaire, #888);
  flex-shrink: 0;
  margin-left: auto;
}

.contact-avatar {
  position: relative;
  width: 40px;
  height: 40px;
}

.avatar-humain,
.avatar-llm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
}

.avatar-humain {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.avatar-llm {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  font-size: 20px;
}

.statut-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--fond-principal, white);
}

.statut-en-ligne {
  background: #10b981;
}

.statut-absent {
  background: #f59e0b;
}

.statut-occupe {
  background: #ef4444;
}

.statut-hors-ligne {
  background: #6b7280;
}

.contact-statut {
  font-size: 12px;
  color: var(--texte-secondaire, #666);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item:hover,
.contact-item:hover {
  background: var(--hover-overlay, #eaeaea);
  border-color: var(--accent, #007bff);
}

.conversation-item.active {
  background: var(--accent-bg, #e7f3ff);
  border-color: var(--accent, #007bff);
}

.conversation-icone,
.contact-icone {
  font-size: 24px;
  flex-shrink: 0;
}

.conversation-info,
.contact-info {
  flex: 1;
  min-width: 0;
}

.conversation-titre,
.contact-nom {
  font-weight: 500;
  font-size: 14px;
  color: var(--texte-principal, #333);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-details,
.contact-details {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--texte-tertiaire, #888);
}

.conversation-participants,
.conversation-meta,
.conversation-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-favori {
  flex-shrink: 0;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.btn-favori:hover {
  opacity: 1;
}

.btn-favori.active {
  opacity: 1;
}

.liste-vide {
  padding: 40px 20px;
  text-align: center;
  color: var(--texte-tertiaire, #888);
  font-size: 13px;
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
  .conversation-item,
  .contact-item {
    background: var(--fond-secondaire, #2a2a2a);
    border-color: var(--bordure, #444);
  }

  .conversation-item:hover,
  .contact-item:hover {
    background: var(--hover-overlay, #353535);
  }

  .conversation-item.active {
    background: var(--accent-bg, #1a3a5a);
  }

  .conversation-titre,
  .contact-nom {
    color: var(--texte-principal, #eee);
  }
}

/* Vue détaillée du contact */
.vue-detail-contact {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.vue-detail-contact.active {
  display: flex;
}

.detail-contact-header {
  padding: 12px;
  border-bottom: 1px solid var(--bordure);
}

.btn-retour-contacts {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-retour-contacts:hover {
  background: var(--hover-overlay);
}

.detail-contact-info {
  padding: 16px;
  border-bottom: 1px solid var(--bordure);
}

.detail-contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--fond-secondaire);
  border: 1px solid var(--bordure);
  border-radius: 8px;
}

.detail-contact-conversations {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.detail-conversations-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

.detail-conversations-titre {
  font-size: 12px;
  font-weight: 600;
  color: var(--texte-secondaire);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-nouvelle-conversation {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-nouvelle-conversation:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

.liste-conversations-contact {
  padding: 4px;
}

.message-non-lu {
  background: var(--accent-bg) !important;
  border-left: 3px solid var(--accent) !important;
  font-weight: 600;
}

.message-non-lu .message-nom {
  color: var(--accent);
}
