/* =====================================================================
   Fichiers (Linux) — style Nautilus / Yaru : dossiers violets avec emblème orange, barre latérale « Emplacements », fil d'Ariane,
   vues grille / liste, zoom des icônes (--z : 1 à 3), menu contextuel, panneau Propriétés.
   Animations : transform + opacity seulement, coupées avec « Animations » (body.no-anim) et prefers-reduced-motion.
   ===================================================================== */
.fm { --nf-a: var(--accent, #e95420); --nf-aub: #77216f; position: relative; display: grid; grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; min-height: 0; color: var(--win-fg); font: 13.5px/1.4 var(--font); }
body.theme-dark .fm { --nf-aub: #b36fae; }
.fm *, .fm *::before, .fm *::after { box-sizing: border-box; }
html.lang-rtl .fm { direction: rtl; }
.fm button:focus-visible, .fm input:focus-visible, .fm .fm-item:focus-visible { outline: 2px solid var(--nf-a); outline-offset: -2px; }

/* Barre latérale */
.fm-side { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 1px; padding: 10px 8px; border-inline-end: 1px solid var(--win-line); background: var(--win-soft); scrollbar-width: thin; }
.fm-h { margin: 2px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--win-muted); }
.fm-side button { flex: none; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; transition: background .15s; }
.fm-side button span { width: 18px; text-align: center; color: var(--nf-a); }
.fm-side button b { font-weight: 500; }
.fm-side button:hover { background: color-mix(in srgb, var(--nf-a) 9%, transparent); }
.fm-side button.on { background: color-mix(in srgb, var(--nf-a) 17%, transparent); }
.fm-side button.on b { font-weight: 700; }
.fm-side hr { margin: 8px 6px; border: 0; border-top: 1px solid var(--win-line); }

.fm-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
/* Barre d'en-tête */
.fm-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--win-line); background: var(--bar); }
.fm-nav { display: inline-flex; border: 1px solid var(--win-line); border-radius: 8px; overflow: hidden; }
.fm-nav button, .fm-tb { height: 30px; min-width: 30px; padding: 0 8px; border: 0; background: color-mix(in srgb, var(--win-fg) 6%, transparent); color: var(--win-fg); font-size: 15px; line-height: 1; cursor: pointer; transition: background .15s; }
.fm-tb { border-radius: 8px; }
.fm-nav button:hover:not(:disabled), .fm-tb:hover { background: color-mix(in srgb, var(--nf-a) 16%, transparent); }
.fm-nav button:disabled { opacity: .35; cursor: default; }
.fm-tb[aria-pressed="true"], .fm-tb[aria-expanded="true"] { background: color-mix(in srgb, var(--nf-a) 24%, transparent); }
.fm-zoom { display: inline-flex; gap: 2px; }
html.lang-rtl .fm-nav button { transform: scaleX(-1); }
.fm-loc { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; height: 30px; padding: 0 4px; border: 1px solid var(--win-line); border-radius: 8px; background: var(--win-bg); overflow: hidden; white-space: nowrap; }
.fm-loc i { font-style: normal; color: var(--win-muted); }
.fm-crumb { height: 24px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: inherit; font: inherit; cursor: pointer; }
.fm-crumb:hover { background: color-mix(in srgb, var(--nf-a) 12%, transparent); }
.fm-crumb.on { font-weight: 700; }
span.fm-crumb { display: inline-flex; align-items: center; cursor: default; }
.fm-locin { flex: 1; min-width: 0; height: 24px; border: 0; outline: 0; background: none; color: inherit; font: 13px var(--mono); }
.fm-search { flex: none; padding: 6px 10px; border-bottom: 1px solid var(--win-line); background: var(--win-soft); }
.fm-search[hidden] { display: none; }
.fm-search input { width: 100%; height: 30px; padding: 0 12px; border: 1px solid var(--win-line); border-radius: 8px; background: var(--win-bg); color: inherit; font: inherit; }
.fm-tmp { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 7px 14px; border-bottom: 1px solid var(--win-line); background: color-mix(in srgb, var(--nf-a) 8%, var(--win-soft)); font-size: 12.5px; }
.fm-tmp[hidden] { display: none; }
.fm-tmp p { margin: 0; display: flex; gap: 8px; align-items: center; color: var(--win-muted); }
.fm-tmp-act { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-tmp-act button, .fm-ren button { height: 28px; padding: 0 12px; border: 1px solid var(--win-line); border-radius: 8px; background: var(--win-bg); color: inherit; font: inherit; cursor: pointer; }
.fm-tmp-act button:disabled { opacity: .4; cursor: default; }
.fm-tmp-act button:hover:not(:disabled) { border-color: var(--nf-a); }
.fm-ren { display: flex; gap: 6px; flex-basis: 100%; }
.fm-ren[hidden] { display: none; }
.fm-ren input { flex: 1; height: 28px; padding: 0 10px; border: 1px solid var(--nf-a); border-radius: 8px; background: var(--win-bg); color: inherit; font: inherit; }

/* Liste d'éléments */
.fm-list { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 14px; outline: none; overscroll-behavior: contain; scrollbar-width: thin; }
.fm[data-view="grid"] .fm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(70px + var(--z) * 28px), 1fr)); grid-auto-rows: max-content; gap: 6px; align-content: start; }
.fm-item { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 10px 6px 8px; border: 1px solid transparent; border-radius: 12px; background: none; color: inherit; font: inherit; text-align: center; cursor: pointer; animation: nfIn .35s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--i, 0) * 28ms); transition: background .15s; }
.fm-item:not(.in) { animation: none; }
.fm-item:hover { background: color-mix(in srgb, var(--nf-a) 8%, transparent); }
.fm-item.sel { background: color-mix(in srgb, var(--nf-a) 20%, transparent); border-color: color-mix(in srgb, var(--nf-a) 50%, transparent); }
.fm-nm { display: grid; gap: 1px; min-width: 0; max-width: 100%; }
.fm-nm small { font-size: 10.5px; color: var(--nf-a); font-weight: 700; }
.fm-nm b { font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.fm-ty { display: none; }
.fm-sz { color: var(--win-muted); font-size: 10.5px; }
.fm[data-view="grid"] .fm-head { display: none; }

/* Icônes */
.fm-folder { position: relative; display: grid; place-items: center; width: calc(36px + var(--z) * 14px); height: calc(28px + var(--z) * 11px); margin-top: 6px; border-radius: 5px 5px 8px 8px; background: linear-gradient(180deg, #a447a0, var(--nf-aub)); box-shadow: inset 0 1px 0 #ffffff55, 0 3px 8px #0003; }
.fm-folder::before { content: ''; position: absolute; left: 0; top: -7px; width: 46%; height: 10px; border-radius: 5px 5px 0 0; background: #8a3585; }
.fm-folder i { font-style: normal; font-size: calc(10px + var(--z) * 4px); color: #ffb287; text-shadow: 0 1px 2px #0005; line-height: 1; }
.fm-folder.is-hidden, .fm-file.is-hidden { opacity: .6; }
.fm-file { position: relative; display: grid; place-items: center; width: calc(26px + var(--z) * 10px); height: calc(32px + var(--z) * 12px); border: 2px solid var(--fc, #8d7f99); border-radius: 5px; background: var(--win-bg); color: var(--fc, #8d7f99); font-size: calc(12px + var(--z) * 5px); }
.fm-file u { position: absolute; right: -6px; bottom: -4px; font-size: 11px; text-decoration: none; }
.fm-thumb { display: block; width: calc(64px + var(--z) * 22px); height: auto; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; box-shadow: 0 3px 10px #0004; }
.fm-ph { display: grid; place-items: center; color: #ffffffd9; font-size: 20px; background: linear-gradient(135deg, var(--pg-g1, #ff8a4c), var(--pg-g2, #e95420)); }
.fm-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 6px; padding: 50px 20px; color: var(--win-muted); text-align: center; }
.fm-empty span { font-size: 36px; }
.fm-empty h3 { margin: 0; font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--win-fg); }
.fm-empty p { margin: 0; }

/* Vue liste */
.fm[data-view="list"] .fm-list { display: block; padding: 8px 10px; }
.fm[data-view="list"] .fm-head, .fm[data-view="list"] .fm-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) 150px 110px; align-items: center; gap: 0 10px; width: 100%; padding: 4px 10px; text-align: start; justify-items: start; border-radius: 8px; }
.fm[data-view="list"] .fm-head { color: var(--win-muted); font-size: 11.5px; font-weight: 700; border-bottom: 1px solid var(--win-line); border-radius: 0; margin-bottom: 4px; position: sticky; top: -8px; background: var(--win-bg); z-index: 1; }
.fm[data-view="list"] .fm-ty { display: block; color: var(--win-muted); font-size: 12px; }
.fm[data-view="list"] .fm-sz { font-size: 12px; text-align: end; justify-self: end; }
.fm[data-view="list"] .fm-nm { display: flex; align-items: baseline; gap: 8px; }
.fm[data-view="list"] .fm-nm b { -webkit-line-clamp: 1; }
.fm[data-view="list"] .fm-folder { width: 30px; height: 22px; margin: 4px 0; }
.fm[data-view="list"] .fm-folder::before { top: -5px; height: 7px; }
.fm[data-view="list"] .fm-folder i { font-size: 11px; }
.fm[data-view="list"] .fm-file { width: 22px; height: 28px; font-size: 12px; }
.fm[data-view="list"] .fm-thumb { width: 40px; border-radius: 5px; }
.fm-status { flex: none; padding: 5px 14px; border-top: 1px solid var(--win-line); font-size: 11.5px; color: var(--win-muted); }

/* Menu contextuel et panneau Propriétés */
.fm-menu { position: absolute; z-index: 8; min-width: 210px; padding: 6px; border: 1px solid var(--win-line); border-radius: 12px; background: var(--win-bg); box-shadow: 0 14px 34px #0005; animation: nfIn .15s ease both; }
.fm-menu[hidden] { display: none; }
.fm-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 12px 7px 6px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.fm-menu button i { width: 14px; font-style: normal; font-size: 8px; color: var(--nf-a); text-align: center; }
.fm-menu button:hover:not(:disabled), .fm-menu button:focus-visible { background: color-mix(in srgb, var(--nf-a) 16%, transparent); outline: none; }
.fm-menu hr { margin: 4px 6px; border: 0; border-top: 1px solid var(--win-line); }
.fm-prop { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: #0006; animation: nfFade .2s ease both; }
.fm-prop[hidden] { display: none; }
.fm-pbox { width: min(420px, calc(100% - 28px)); padding: 16px 20px 18px; border: 1px solid var(--win-line); border-radius: 14px; background: var(--win-bg); box-shadow: 0 20px 50px #0007; }
.fm-pbox header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fm-pbox header b { font-size: 16px; }
.fm-pclose { width: 28px; height: 28px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--win-fg) 10%, transparent); color: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
.fm-pbox dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.fm-pbox dt { color: var(--win-muted); }
.fm-pbox dd { margin: 0; overflow-wrap: anywhere; }
.fm-pbox code { font: 13px var(--mono); }
@keyframes nfIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes nfFade { from { opacity: 0; } }

@media (max-width: 760px) {
  .fm { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .fm-side { flex-direction: row; overflow-x: auto; border-inline-end: 0; border-bottom: 1px solid var(--win-line); padding: 6px; }
  .fm-h, .fm-side hr { display: none; }
  .fm-side button { padding: 6px 10px; }
  .fm-zoom { display: none; }
  .fm[data-view="list"] .fm-head, .fm[data-view="list"] .fm-item { grid-template-columns: 40px minmax(0, 1fr) 80px; }
  .fm[data-view="list"] .fm-ty { display: none; }
}
@media (prefers-reduced-motion: reduce) { .fm *, .fm *::before, .fm *::after { animation: none !important; transition: none !important; } }
body.no-anim .fm *, body.no-anim .fm *::before, body.no-anim .fm *::after { animation: none !important; transition: none !important; }
