/* ============================================================
   STYLES ARCHIVES — Process Chiffrage
   Ajout isolé, ne touche à aucun style existant.
   ============================================================ */

/* Badge cliquable [SOURCE #X] dans la réponse */
.arc-source-badge {
  display: inline-block;
  background: rgba(91, 164, 230, 0.15);
  color: #5ba4e6;
  border: 1px solid rgba(91, 164, 230, 0.4);
  border-radius: 4px;
  padding: 1px 6px;
  margin: 0 2px;
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.arc-source-badge:hover {
  background: rgba(91, 164, 230, 0.3);
  color: #e0e0e0;
}

/* Carte source */
.arc-source-card {
  background: #2a2d35;
  border: 1px solid #3a3d45;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 10px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.arc-source-card:hover {
  border-color: #5ba4e6;
}
.arc-source-cited {
  border-color: #4ade80;
  background: linear-gradient(180deg, #1f2a23 0%, #2a2d35 100%);
}
.arc-source-highlight {
  animation: arc-flash 1.5s ease-out;
}
@keyframes arc-flash {
  0%   { background: #5ba4e6; }
  100% { background: #2a2d35; }
}

.arc-source-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}
.arc-source-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #5ba4e6;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.arc-cite-tag {
  background: #1a4d2e;
  color: #4ade80;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.arc-source-prix {
  font-size: 13px;
  color: #e0e0e0;
}

.arc-source-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 11px;
  color: #ccc;
  padding: 6px 0;
}
.arc-source-row {
  display: flex;
  gap: 10px;
  line-height: 1.5;
}
.arc-source-row > span:first-child {
  flex: 0 0 80px;
  color: #888;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.4px;
  padding-top: 2px;
}
.arc-source-row strong {
  color: #e8e8e8;
}
.arc-source-file {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: #aaa;
  word-break: break-all;
}

.arc-source-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Code inline dans l'astuce */
#sheet-archives code {
  background: #1a1d23;
  color: #5ba4e6;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
}

/* ============================================================
   LAYOUT CARTE AVEC VIGNETTE (page 1 du PDF)
   ============================================================ */
.arc-source-layout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.arc-thumb-wrap {
  position: relative;
  flex: 0 0 140px;
  width: 140px;
  height: 190px;
  cursor: pointer;
  background: #1a1d23;
  border: 1px solid #3a3d45;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.arc-thumb-wrap:hover {
  border-color: #5ba4e6;
  transform: scale(1.02);
}
.arc-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  background: #fff;
}
.arc-thumb-error {
  opacity: 0.3;
  background: #2a2d35 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text x="50" y="55" font-size="40" text-anchor="middle">📄</text></svg>') center/40px no-repeat !important;
}
.arc-thumb-zoom {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(91, 164, 230, 0.9);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s;
}
.arc-thumb-wrap:hover .arc-thumb-zoom {
  opacity: 1;
}
.arc-source-main {
  flex: 1;
  min-width: 0;  /* permet a fichier long de tronquer */
}

/* ============================================================
   MODAL PREVIEW (popup au clic sur vignette)
   ============================================================ */
.arc-preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.arc-preview-overlay.active {
  display: flex;
}
.arc-preview-content {
  background: #1a1d23;
  border: 1px solid #3a3d45;
  border-radius: 8px;
  max-width: 900px;
  width: 100%;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.arc-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #3a3d45;
  background: #2a2d35;
}
.arc-preview-title {
  flex: 1;
  font-size: 12px;
  color: #e0e0e0;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arc-preview-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.arc-preview-close {
  background: #2a2d35;
  color: #e0e0e0;
  border: 1px solid #3a3d45;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.arc-preview-close:hover {
  background: #3a3d45;
  color: #fff;
}
.arc-preview-imgwrap {
  flex: 1;
  background: #0f1115;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
  min-height: 200px;
}
.arc-preview-loader {
  color: #5ba4e6;
  font-size: 13px;
}
.arc-preview-img {
  max-width: 100%;
  max-height: 80vh;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  background: #fff;
  border-radius: 2px;
}

/* Responsive : carte en colonne sur petit ecran */
@media (max-width: 720px) {
  .arc-source-layout { flex-direction: column; }
  .arc-thumb-wrap { width: 100%; height: 180px; flex: 0 0 auto; }
  .arc-thumb { object-position: center top; }
}

/* Sources non citées — toggle */
.arc-noncited-section {
  margin-top: 12px;
}
.arc-noncited-btn {
  width: 100%;
  background: transparent;
  border: 1px dashed #3a3d45;
  border-radius: 6px;
  color: #666;
  font-size: 12px;
  padding: 8px 14px;
  cursor: pointer;
  text-align: left;
  transition: color .15s, border-color .15s;
}
.arc-noncited-btn:hover {
  color: #999;
  border-color: #555;
}
.arc-noncited-list {
  margin-top: 8px;
}

/* ── Toggle Devis / Fiches ─────────────────────────────────────────────── */
.arc-mode-toggle {
  display: flex;
  background: #1a1d23;
  border: 1px solid #3a3d45;
  border-radius: 6px;
  overflow: hidden;
}
.arc-mode-btn {
  background: transparent;
  border: none;
  color: #888;
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.arc-mode-btn:hover { background: #2a2d35; color: #ccc; }
.arc-mode-active { background: #2a2d35 !important; color: #e0e0e0 !important; }

/* ── Carte affaire (mode fiches) ───────────────────────────────────────── */
.arc-affaire-card {
  background: #1e2128;
  border: 1px solid #3a3d45;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}
.arc-affaire-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #242730;
  border-bottom: 1px solid #3a3d45;
  flex-wrap: wrap;
  gap: 8px;
}
.arc-affaire-annee {
  display: inline-block;
  background: #4ade80;
  color: #0a0c10;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 7px;
  margin-right: 8px;
}
.arc-affaire-name {
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
  margin-right: 10px;
}
.arc-affaire-count {
  font-size: 11px;
  color: #666;
}
.arc-dossier-btn {
  background: transparent;
  border: 1px solid #4ade80;
  border-radius: 5px;
  color: #4ade80;
  font-size: 11px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.arc-dossier-btn:hover { background: rgba(74,222,128,.1); }
.arc-dossier-btn:disabled { opacity: .5; cursor: wait; }

/* ── Catégories & fiches ───────────────────────────────────────────────── */
.arc-affaire-body { padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.arc-fiche-cat-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #5ba4e6;
  margin-bottom: 5px;
}
.arc-fiche-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid #2a2d35;
  flex-wrap: wrap;
}
.arc-fiche-fab {
  font-size: 12px;
  font-weight: 600;
  color: #e0e0e0;
  min-width: 100px;
  flex-shrink: 0;
}
.arc-fiche-ref {
  font-size: 11px;
  color: #4ade80;
  font-family: 'IBM Plex Mono', monospace;
  min-width: 120px;
  flex-shrink: 0;
}
.arc-fiche-desc {
  font-size: 11px;
  color: #888;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.arc-fiche-pdf {
  text-decoration: none;
  font-size: 13px;
  flex-shrink: 0;
  opacity: .7;
  transition: opacity .15s;
}
.arc-fiche-pdf:hover { opacity: 1; }

/* ── Accordéon header cliquable ────────────────────────────────────────── */
.arc-affaire-toggle { cursor: pointer; }
.arc-affaire-toggle:hover { background: #2a2d35; }
.arc-card-arrow { font-size: 10px; color: #666; flex-shrink: 0; width: 10px; }

/* ── Dernier fichier scanné par année (inline dans Archives) ───────────── */
.arc-last-files-block {
  background: #1a1d23;
  border: 1px solid #2a2d35;
  border-radius: 6px;
  padding: 10px 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
}
.arc-last-files-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.arc-last-files-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid #1e2128;
  flex-wrap: wrap;
}
.arc-last-files-row:last-child { border-bottom: none; }
.arc-last-files-year  { font-weight: 700; min-width: 36px; flex-shrink: 0; }
.arc-last-files-aff   { color: #e0e0e0; min-width: 180px; flex-shrink: 0; }
.arc-last-files-fichier { color: #aaa; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arc-last-files-date  { color: #555; white-space: nowrap; flex-shrink: 0; }
