/**
 * SOLCYTE.AI - Folder Manager Styles
 * Version: 1.1.0
 * 
 * Styles pour le module de gestion des dossiers hiérarchiques
 * Compatible avec les thèmes dark/light existants
 */

/* ============================================
   CONTENEUR PRINCIPAL MENU 3 (RAPPORT)
   ============================================ */

.menu-3-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  background: var(--bg-primary);
  overflow: hidden;
}

/* ============================================
   HEADER DU MODULE
   ============================================ */

.folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.folder-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.folder-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.folder-header-actions {
  display: flex;
  gap: 0.5rem;
}

.folder-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.folder-btn:hover {
  background: var(--bg-hover);
  border-color: var(--color-primary);
}

.folder-btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border: none;
  color: white;
}

.folder-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(74, 144, 164, 0.3);
}

/* ✅ NOUVEAU: Bouton Import */
.folder-btn-import {
  background: linear-gradient(135deg, #2d5a45 0%, #1a3d2e 100%);
  border: 1px solid rgba(45, 90, 69, 0.3);
  color: white;
}

.folder-btn-import:hover {
  background: linear-gradient(135deg, #3a6b54 0%, #245038 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(45, 90, 69, 0.3);
  border-color: rgba(45, 90, 69, 0.5);
}

/* ============================================
   BREADCRUMB (FIL D'ARIANE)
   ============================================ */

.folder-breadcrumb {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow-x: auto;
  gap: 0.25rem;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.breadcrumb-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.breadcrumb-item.active {
  background: rgba(74, 144, 164, 0.15);
  color: var(--color-primary);
  font-weight: 500;
}

.breadcrumb-item.breadcrumb-root {
  font-weight: 500;
}

.breadcrumb-icon {
  font-size: 1rem;
}

.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0 0.25rem;
}

/* ============================================
   GRILLE DES DOSSIERS/RAPPORTS
   ============================================ */

.folder-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}

.folder-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 120px;
}

.folder-item:hover {
  background: var(--bg-hover);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.folder-item.selected {
  background: rgba(74, 144, 164, 0.15);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(74, 144, 164, 0.3);
}

.folder-item-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.folder-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.folder-item-badges {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.folder-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Badges de certification */
.cert-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--badge-color, #64748b);
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badges de statut */
.status-badge {
  font-size: 0.875rem;
}

.status-badge.status-processing {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================
   ÉTAT VIDE
   ============================================ */

.folder-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.empty-state-icon {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ============================================
   LOADER
   ============================================ */

.folder-loader {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  z-index: 10;
}

.folder-loader .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   BARRE DE STATUT
   ============================================ */

.folder-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.status-left,
.status-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-s3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.s3-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 3px #10b981; }
  50% { box-shadow: 0 0 8px #10b981, 0 0 12px #10b981; }
}

.status-rgpd {
  padding: 0.2rem 0.5rem;
  background: rgba(74, 144, 164, 0.15);
  border-radius: 4px;
  color: var(--color-primary);
  font-weight: 500;
}

/* ============================================
   MENU CONTEXTUEL
   ============================================ */

.folder-context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.5rem 0;
  min-width: 200px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  animation: contextMenuIn 0.15s ease-out;
}

@keyframes contextMenuIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
  color: var(--text-primary);
}

.context-menu-item:hover {
  background: var(--bg-hover);
}

.context-menu-item.danger {
  color: #ef4444;
}

.context-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.context-menu-icon {
  font-size: 1rem;
  width: 1.5rem;
  text-align: center;
}

.context-menu-label {
  font-size: 0.875rem;
}

.context-menu-separator {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

.folder-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  z-index: 10001;
  max-width: 350px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  color: white;
  transform: translateX(120%);
  transition: transform 0.3s ease;
}

.folder-notification.show {
  transform: translateX(0);
}

/* ============================================
   THÈME CLAIR - OVERRIDES
   ============================================ */

html.light-theme .folder-header,
html.light-theme .folder-breadcrumb,
html.light-theme .folder-status-bar {
  background: #FFFFFF !important;
}

html.light-theme .folder-content {
  background: #F7FAFC !important;
}

html.light-theme .folder-item {
  background: #FFFFFF !important;
  border-color: rgba(74, 144, 164, 0.1) !important;
}

html.light-theme .folder-item:hover {
  background: #F7FAFC !important;
}

html.light-theme .folder-item.selected {
  background: rgba(74, 144, 164, 0.1) !important;
}

html.light-theme .folder-context-menu {
  background: #FFFFFF !important;
  border-color: #E2E8F0 !important;
}

html.light-theme .context-menu-item:hover {
  background: #F7FAFC !important;
}

html.light-theme .breadcrumb-item:hover {
  background: #F7FAFC !important;
}

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

@media (max-width: 768px) {
  .folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .folder-item {
    padding: 1rem 0.75rem;
    min-height: 100px;
  }

  .folder-item-icon {
    font-size: 2.5rem;
  }

  .folder-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .folder-header-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .folder-breadcrumb {
    padding: 0.5rem 1rem;
  }

  .breadcrumb-text {
    display: none;
  }

  .breadcrumb-item.active .breadcrumb-text {
    display: inline;
  }
}

@media (max-width: 480px) {
  .folder-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .folder-status-bar {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .folder-header-actions {
    flex-direction: column;
  }
  
  .folder-btn {
    justify-content: center;
  }
}
