/* ===== ESPACE DOCUMENTS ===== */
#sec-documents { background: linear-gradient(180deg, #fafbff 0%, #f5f7ff 100%); min-height: calc(100vh - 60px); padding-bottom: 40px; }
#sec-documents .content { padding: 20px; }

.doc-header {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
  padding: 20px 24px; margin-bottom: 16px;
  background: linear-gradient(135deg, #1a237e 0%, #3949ab 100%);
  border-radius: 16px; color: white;
  box-shadow: 0 10px 30px rgba(26,35,126,0.2);
  position: relative; overflow: hidden;
}
.doc-header::before {
  content: ""; position: absolute; top: -50%; right: -20%;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,171,0,0.2), transparent 60%);
}
.doc-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px; font-weight: 900; letter-spacing: 2px;
  margin: 0; color: white; position: relative;
}
.doc-subtitle { font-size: 12px; color: rgba(255,255,255,0.85); margin-top: 4px; position: relative; }
.doc-stats { display: flex; gap: 10px; position: relative; }
.doc-stat {
  background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px; padding: 10px 16px;
  text-align: center; min-width: 90px;
}
.doc-stat-val {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px; font-weight: 900; color: #ffab00;
  text-shadow: 0 0 10px rgba(255,171,0,0.5);
}
.doc-stat-lab { font-size: 10px; color: rgba(255,255,255,0.9); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }

/* Sous-onglets dossiers */
.doc-subnav {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: white; border-radius: 14px; padding: 8px;
  box-shadow: 0 2px 8px rgba(26,35,126,0.06);
  margin-bottom: 16px;
  border: 1px solid #e5e9ff;
}
.doc-subtab {
  flex: 1; min-width: 130px;
  background: transparent; border: none; cursor: pointer;
  padding: 10px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 700; color: #64748b;
  transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.doc-subtab:hover { background: #f5f7ff; color: #1a237e; }
.doc-subtab.active {
  background: linear-gradient(135deg, #1a237e, #ff6d00);
  color: white;
  box-shadow: 0 4px 12px rgba(255,109,0,0.3);
}
.doc-subtab-count {
  background: rgba(255,255,255,0.25); padding: 1px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 800;
}
.doc-subtab:not(.active) .doc-subtab-count { background: #ffab00; color: white; }

/* Upload card */
.doc-upload-card {
  background: white; border-radius: 14px; padding: 18px;
  box-shadow: 0 2px 8px rgba(26,35,126,0.06);
  border: 1px solid #e5e9ff;
  margin-bottom: 16px;
}
.doc-section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 13px; font-weight: 700; letter-spacing: 1px;
  color: #1a237e; margin: 0 0 14px 0;
  padding-bottom: 8px; border-bottom: 2px solid #ff6d00;
}
.doc-upload-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.doc-drop-zone {
  border: 2px dashed #ff6d00; border-radius: 14px;
  padding: 28px 20px; text-align: center; cursor: pointer;
  background: linear-gradient(135deg, #fff8ec, #fff);
  transition: all 0.25s ease;
}
.doc-drop-zone:hover { background: linear-gradient(135deg, #ffedd5, #fff8ec); border-color: #ffab00; }
.doc-drop-zone.doc-drop-active {
  background: linear-gradient(135deg, #ffd98a, #fff8ec);
  border-color: #ff6d00; border-style: solid;
}
.doc-drop-emoji { font-size: 42px; margin-bottom: 8px; }
.doc-drop-text { font-size: 14px; color: #1a237e; font-weight: 600; margin-bottom: 4px; }
.doc-drop-hint { font-size: 11px; color: #888; }

.doc-meta-fields { display: flex; flex-direction: column; gap: 10px; }
.doc-meta-fields label { font-size: 11px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: flex; flex-direction: column; gap: 4px; }
.doc-meta-fields select, .doc-meta-fields input {
  padding: 9px 12px; border: 1px solid #e0e4ff; border-radius: 8px;
  font-size: 13px; color: #1a237e;
}
.doc-meta-fields select:focus, .doc-meta-fields input:focus { border-color: #ff6d00; outline: none; }

.doc-upload-result { margin-top: 12px; }
.doc-progress { background: #e3f2fd; color: #0d47a1; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.doc-ok { background: linear-gradient(135deg, #e8f5e9, #c8e6c9); color: #1b5e20; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; border-left: 3px solid #2e7d32; }
.doc-err { background: linear-gradient(135deg, #ffebee, #ffcdd2); color: #c62828; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; border-left: 3px solid #c62828; margin-top: 4px; }
.doc-warn { background: #fff3e0; color: #e65100; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-top: 4px; }

/* Filters */
.doc-filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  background: white; padding: 12px 14px; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(26,35,126,0.06);
  border: 1px solid #e5e9ff; margin-bottom: 16px;
}
.doc-filters input, .doc-filters select {
  padding: 9px 12px; border: 1px solid #e0e4ff; border-radius: 8px;
  font-size: 13px; color: #1a237e; background: white;
}
.doc-filters input { flex: 1; min-width: 200px; }
.doc-filters input:focus, .doc-filters select:focus { border-color: #ff6d00; outline: none; }

/* Grid */
.doc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.doc-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 60px 20px;
  background: white; border: 2px dashed #e5e9ff; border-radius: 14px;
}
.doc-empty-emoji { font-size: 48px; margin-bottom: 8px; }
.doc-empty h3 { color: #1a237e; margin: 0 0 4px 0; }
.doc-empty p { color: #888; font-size: 13px; margin: 0; }

.doc-card {
  background: white; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(26,35,126,0.06);
  border: 1px solid #e5e9ff; overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.doc-card:hover { box-shadow: 0 8px 24px rgba(26,35,126,0.15); border-color: #ff6d00; }

.doc-card-icon {
  height: 100px; display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  background: linear-gradient(135deg, #f5f7ff, #e5e9ff);
}
.doc-card.doc-folder-compta  .doc-card-icon { background: linear-gradient(135deg, #dcedc8, #c5e1a5); }
.doc-card.doc-folder-audit   .doc-card-icon { background: linear-gradient(135deg, #fff8e1, #ffe082); }
.doc-card.doc-folder-telepro .doc-card-icon { background: linear-gradient(135deg, #e3f2fd, #90caf9); }
.doc-card.doc-folder-avant   .doc-card-icon { background: linear-gradient(135deg, #ffebee, #ffcdd2); }
.doc-card.doc-folder-apres   .doc-card-icon { background: linear-gradient(135deg, #e8f5e9, #a5d6a7); }
.doc-card.doc-folder-autre   .doc-card-icon { background: linear-gradient(135deg, #f3e5f5, #ce93d8); }

.doc-card-preview {
  height: 140px; overflow: hidden;
  background: #f5f7ff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
}
.doc-card-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.doc-card-preview:hover img { transform: scale(1.05); }
.doc-card-preview-loading { font-size: 40px; opacity: 0.3; }

.doc-card-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.doc-card-name {
  font-size: 13px; font-weight: 700; color: #1a237e;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doc-badge {
  padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700;
  background: #e5e9ff; color: #1a237e;
}
.doc-cat-facture  { background: #dcedc8; color: #2e7d32; }
.doc-cat-devis    { background: #e3f2fd; color: #1565c0; }
.doc-cat-contrat  { background: #f3e5f5; color: #6a1b9a; }
.doc-cat-audit    { background: #fff8e1; color: #ef6c00; }
.doc-cat-dpe      { background: #e0f2f1; color: #00695c; }
.doc-cat-photo    { background: #ffebee; color: #c62828; }
.doc-cat-plan     { background: #ede7f6; color: #4527a0; }
.doc-cat-pv       { background: #ffe0b2; color: #e65100; }
.doc-cat-script   { background: #e1f5fe; color: #01579b; }
.doc-cat-autre    { background: #eceff1; color: #455a64; }

.doc-meta-item { font-size: 11px; color: #64748b; }
.doc-card-note {
  font-size: 12px; color: #475569;
  background: #f8fafc; padding: 6px 10px; border-radius: 6px;
  border-left: 2px solid #ffab00;
}
.doc-card-client-adr {
  font-size: 11px; color: #1a237e; font-weight: 600;
  background: linear-gradient(90deg, #e8eaf6, #fff);
  padding: 5px 8px; border-radius: 6px;
  border-left: 2px solid #1a237e;
}
.doc-card-footer {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 10px; color: #94a3b8; padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}

.doc-card-actions {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 4px;
}
.doc-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 14px;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.15s ease;
}
.doc-btn:hover { transform: scale(1.1); }
.doc-btn-download:hover { background: #2e7d32; color: white; }
.doc-btn-delete:hover { background: #c62828; color: white; }

/* Image preview overlay */
.doc-img-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 40px;
  cursor: zoom-out;
}
.doc-img-overlay img { max-width: 100%; max-height: 85vh; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.doc-img-caption {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: white; background: rgba(0,0,0,0.6); padding: 8px 18px; border-radius: 20px;
  font-size: 13px;
}
.doc-img-close {
  position: absolute; top: 20px; right: 30px;
  color: white; font-size: 36px; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center;
}
.doc-img-close:hover { background: rgba(255,255,255,0.2); }
