/* Reset de base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
    "Segoe UI", sans-serif;
  color: #1d1d1f;
  background: #f5f5f7;
}

/* ---------- Header façon barre de fenêtre macOS ---------- */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 1.1rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.app-title {
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 0.95rem;
  color: #111827;
}

.app-subtitle {
  font-size: 0.75rem;
  color: #6e6e73;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.85);
  color: #1d1d1f;
}

.pill::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  margin-right: 0.3rem;
}

.pill-ok::before {
  background: #34c759;
}

.pill-env::before {
  background: #ff9f0a;
}

/* ---------- Layout global ---------- */

.app-main {
  height: calc(100vh - 44px);
  padding: 0.6rem 0.6rem 0.8rem;
}

/* 3 colonnes : gauche navigation, centre, droite journal */
.columns {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 260px;
  gap: 0.6rem;
  height: 100%;
}

/* Panneaux / cartes principales */

.panel {
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 8px 16px rgba(0, 0, 0, 0.03);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Légère variation pour la sidebar gauche */
.panel-left {
  background: #f9f9fb;
}

/* Typo titres */
.panel h2 {
  font-size: 0.85rem;
  margin: 0 0 0.4rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6e6e73;
}

/* ---------- Switch BD / Downloads ---------- */

.mode-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: #e5e5ea;
  margin-bottom: 0.4rem;
}

.mode-pill {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: #3a3a3c;
  text-decoration: none;
}

.mode-pill.active {
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  color: #111827;
}

/* ---------- Outils dossier ---------- */

.tools-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.btn-secondary {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #f2f2f7;
  color: #111827;
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #e5e5ea;
}

.panel h3 {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.panel h4 {
  margin: 0.4rem 0 0.15rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Scroll interne */
.panel-left,
.panel-center,
.panel-right {
  overflow-y: auto;
}

/* ---------- Breadcrumbs / navigation ---------- */

.breadcrumbs {
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
  color: #8e8e93;
}

.breadcrumbs a {
  color: #0a84ff;
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.parent-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  color: #6e6e73;
  text-decoration: none;
}

.parent-link:hover {
  color: #111827;
}

/* ---------- Listes de dossiers / fichiers ---------- */

.dir-list,
.file-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.dir-list li,
.file-list li {
  padding: 0.28rem 0.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.12s ease, transform 0.06s ease;
}

.dir-list li:hover,
.file-list li:hover {
  background: rgba(0, 0, 0, 0.03);
}

.dir-list a {
  text-decoration: none;
  color: #111827;
}

.dir-list a:hover {
  color: #0a84ff;
}

.file-list a {
  color: #111827;
  text-decoration: none;
}

.file-list a:hover {
  color: #0a84ff;
  text-decoration: underline;
}

/* Lien loupe */
.dir-list a[title*="Rechercher"] {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* ---------- Formulaire de recherche ---------- */

.search-form {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.search-form input[type="text"] {
  flex: 1;
  padding: 0.42rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  font-size: 0.85rem;
  background-color: #ffffff;
  color: #111827;
}

.search-form input[type="text"]::placeholder {
  color: #b0b0b4;
}

.search-form input[type="text"]:focus {
  outline: none;
  border-color: #0a84ff;
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.25);
}

/* Boutons */

button,
.btn {
  font-family: inherit;
}

.search-form button {
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: #0a84ff;
  color: #ffffff;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(10, 132, 255, 0.35);
}

.search-form button:hover {
  background: #0667d8;
}

/* Bouton "Intégrer les métadonnées..." */

.btn-apply-metadata {
  margin-left: auto;
  padding: 0.23rem 0.6rem;
  border-radius: 999px;
  border: none;
  font-size: 0.75rem;
  cursor: pointer;
  background: #e7f6eb;
  color: #176f3d;
  border: 1px solid #b7e1c4;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-apply-metadata::before {
  content: "⟶";
  font-size: 0.75rem;
}

.btn-apply-metadata:hover {
  background: #d3f1dd;
}

/* ---------- Séparateurs / hints ---------- */

.section-divider {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin: 0.5rem 0 0.6rem;
}

.hint {
  font-size: 0.78rem;
  color: #6e6e73;
}

.hint code {
  background: #f2f2f7;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ---------- Résultat d'intégration ---------- */

.apply-result {
  margin-top: 0.45rem;
  font-size: 0.8rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  background: #f2f8ff;
  border: 1px solid rgba(10, 132, 255, 0.3);
  color: #111827;
  white-space: pre-line;
}

/* ---------- Journal à droite ---------- */

.log {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #3a3a3c;
}

.log-line {
  padding: 0.18rem 0;
}

.log-error {
  color: #b00020;
  font-weight: 500;
}

.log-muted {
  color: #8e8e93;
  font-style: italic;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .app-main {
    height: auto;
  }

  .columns {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel {
    min-height: auto;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .app-header-right {
    align-self: flex-end;
  }
}}
