/* ============================================
   ZEBRAWRITER+ : Styles Panneau Documents
   Multi-documents + Import + Drag & Drop
   ============================================ */

/* Conteneur principal avec panneau */
.main-container {
  display: flex;
  height: 100vh;
}

/* Panneau latéral des documents */
.documents-panel {
  width: 280px;
  min-width: 280px;
  background: #f8f9fa;
  border-right: 2px solid #dee2e6;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
  position: relative;
}

.documents-panel.collapsed {
  margin-left: -280px;
}

/* Header du panneau */
.panel-header {
  padding: 15px;
  background: #3498db;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Actions (boutons Nouveau et Import) */
.panel-actions {
  padding: 15px;
  border-bottom: 1px solid #dee2e6;
}

.btn-primary {
  width: 100%;
  padding: 10px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #229954;
}

.btn-primary:active {
  background: #1e8449;
}

.btn-secondary {
  width: 100%;
  padding: 10px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #2980b9;
}

.btn-secondary:active {
  background: #21618c;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 5px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

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

/* Liste des documents */
.documents-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.empty-state {
  text-align: center;
  color: #6c757d;
  padding: 40px 20px;
  font-style: italic;
  font-size: 14px;
}

/* Item de document */
.document-item {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin-bottom: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  animation: slideIn 0.3s ease;
}

.document-item:hover {
  border-color: #3498db;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.1);
}

.document-item.active {
  border-color: #3498db;
  border-width: 2px;
  background: #e3f2fd;
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
}

/* Info du document */
.doc-info {
  flex: 1;
  min-width: 0;
}

.doc-title {
  font-weight: 600;
  font-size: 14px;
  color: #2c3e50;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-meta {
  font-size: 11px;
  color: #6c757d;
}

/* Actions du document */
.doc-actions {
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity 0.2s;
}

.document-item:hover .doc-actions {
  opacity: 1;
}

.document-item.active .doc-actions {
  opacity: 1;
}

.doc-actions .btn-icon {
  font-size: 14px;
  padding: 4px;
}

.doc-actions [data-action="import-into"] {
  color: #3498db;
}

.doc-actions [data-action="import-into"]:hover {
  color: #2980b9;
}

/* Zone d'édition (ajuster pour faire de la place au panneau) */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Animation drag & drop */
.documents-panel.drag-over {
  background: #e3f2fd;
  border-right-color: #3498db;
  border-right-width: 4px;
}

.documents-panel.drag-over::after {
  content: '📁 Déposez le fichier .txt ici';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(52, 152, 219, 0.95);
  color: white;
  padding: 30px 40px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* Scrollbar personnalisée pour la liste */
.documents-list::-webkit-scrollbar {
  width: 8px;
}

.documents-list::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.documents-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.documents-list::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Toast notifications */
.toast {
  animation: slideInToast 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 14px;
  font-weight: 500;
}

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

/* Responsive : masquer le panneau sur petits écrans */
@media (max-width: 768px) {
  .documents-panel {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  
  .documents-panel.collapsed {
    margin-left: -280px;
  }
  
  /* Bouton pour rouvrir le panneau sur mobile */
  .documents-panel.collapsed::before {
    content: '▶';
    position: absolute;
    right: -30px;
    top: 20px;
    background: #3498db;
    color: white;
    padding: 10px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
  }
}

/* Ajustements pour l'éditeur existant */
#editor-container {
  flex: 1;
}

/* État vide global */
.documents-panel:empty::after {
  content: 'Chargement...';
  display: block;
  text-align: center;
  padding: 40px;
  color: #6c757d;
}
