/* ShareIt — coquille, mobile-first (~375px). Thème sombre sobre, sans CDN. */
:root {
  --bg: #0f1216;
  --card: #171c22;
  --line: #232a32;
  --fg: #e7ecf1;
  --muted: #93a1b0;
  --accent: #5bc0eb;
  --ok: #6ee7a8;
  --err: #ff8a8a;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.shell { max-width: 640px; margin: 0 auto; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.hero { text-align: center; padding: 24px 0 8px; }
.hero h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; }
.tag { color: var(--muted); margin: 6px 0 0; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  margin-top: 18px;
}
.ctx { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 12px; }
.ctx dt { color: var(--muted); }
.ctx dd { margin: 0; word-break: break-all; }
.out p { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: #0d1114; border: 1px solid var(--line); }
.out .ok { border-color: rgba(110,231,168,.4); color: var(--ok); }
.out .err { border-color: rgba(255,138,138,.4); color: var(--err); }
.out .muted, .muted { color: var(--muted); }
.foot { color: var(--muted); text-align: center; margin-top: 20px; font-size: .85rem; }

/* ─── Auth ─── */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 10px; min-height: 44px; cursor: pointer;
  background: #0d1114; color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; font: inherit;
}
.tab.active { color: var(--fg); border-color: var(--accent); }
.authform { display: grid; gap: 12px; }
.field { display: grid; gap: 6px; }
.field span { color: var(--muted); font-size: .9rem; }
.field input {
  width: 100%; padding: 12px; min-height: 44px;
  background: #0d1114; color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px; font: inherit;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.btn {
  padding: 12px; min-height: 44px; cursor: pointer; font: inherit;
  background: #0d1114; color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px;
}
.btn-primary { background: var(--accent); color: #06222e; border-color: var(--accent); font-weight: 600; }
.formmsg { margin: 4px 0 0; font-size: .9rem; }
.formmsg.ok { color: var(--ok); }
.formmsg.err { color: var(--err); }
.connected { display: grid; gap: 12px; }

/* ─── Connecté : barre + contenu ─── */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line);
}
.bar .btn { padding: 8px 12px; min-height: 40px; }
.content { display: grid; gap: 14px; }
.h2 { margin: 0; font-size: 1.15rem; }

/* ─── Liste de dossiers ─── */
.folders { display: grid; gap: 8px; }
.folder-item {
  display: block; padding: 12px 14px; min-height: 44px;
  background: #0d1114; color: var(--fg); text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px;
}
.folder-item::before { content: "📁 "; }
.folder-item:hover { border-color: var(--accent); }
/* Ligne « partagé avec moi » : nom + petites pastilles de droits */
.folder-shared { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.folder-name { font-weight: 600; }
.folder-caps { display: flex; flex-wrap: wrap; gap: 4px; }
.minibadge {
  font-size: .68rem; padding: 2px 7px; border-radius: 999px;
  color: var(--ok); border: 1px solid rgba(110,231,168,.4); background: rgba(110,231,168,.06);
}

/* ─── Badges de capacités ─── */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { padding: 6px 10px; border-radius: 999px; font-size: .85rem; border: 1px solid var(--line); }
.badge.on { color: var(--ok); border-color: rgba(110,231,168,.5); }
.badge.off { color: var(--muted); opacity: .6; text-decoration: line-through; }

.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ─── Gérer l'accès ─── */
.access { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 12px; }
.h3 { margin: 0; font-size: 1rem; }
.access-list { display: grid; gap: 10px; }
.access-row {
  background: #0d1114; border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  display: grid; gap: 10px;
}
.access-owner { border-color: rgba(91,192,235,.35); }
.access-name { font-weight: 600; font-size: .92rem; word-break: break-word; }
.access-owner .access-name { color: var(--accent); }
.caps-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cap-toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; font-size: .8rem;
  min-height: 36px; user-select: none;
}
.cap-toggle input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.cap-toggle:has(input:checked) { border-color: var(--accent); color: var(--accent); background: rgba(91,192,235,.08); }
.access-owner .caps-row { display: none; }
.access-add {
  display: grid; gap: 10px; background: #0d1114; border: 1px dashed var(--line);
  border-radius: 12px; padding: 14px;
}
.access-add-label { font-weight: 600; font-size: .92rem; }

/* ─── Invitation (lien) ─── */
.invite-banner {
  background: rgba(91,192,235,.08); border: 1px solid rgba(91,192,235,.4);
  border-radius: 12px; padding: 16px; margin-bottom: 16px; display: grid; gap: 8px;
}
.invite-title { font-weight: 700; color: var(--accent); margin: 0; }
.invite-banner p { margin: 0; }
.invite-link-out:empty { display: none; }
/* Résultat : une carte discrète, accent léger, cohérente avec .invite-banner */
.invite-result {
  display: grid; gap: 8px; margin-top: 2px;
  background: rgba(91,192,235,.06); border: 1px solid rgba(91,192,235,.35);
  border-radius: 12px; padding: 12px;
}
.invite-result-label { font-size: .8rem; font-weight: 600; color: var(--accent); letter-spacing: .01em; }
/* Champ + bouton fondus dans un seul bloc arrondi */
.invite-input-group {
  display: flex; align-items: stretch; overflow: hidden;
  background: #0d1114; border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .15s ease;
}
.invite-input-group:focus-within { border-color: var(--accent); }
.invite-url {
  flex: 1 1 auto; min-width: 0; padding: 10px 12px; min-height: 42px;
  background: transparent; color: var(--fg); border: 0;
  font: inherit; font-size: .82rem; text-overflow: ellipsis;
}
.invite-url:focus { outline: none; }
.invite-copy {
  flex: 0 0 auto; padding: 0 16px; min-height: 42px; white-space: nowrap; cursor: pointer;
  border: 0; border-left: 1px solid var(--line);
  background: var(--accent); color: #06222e; font: inherit; font-weight: 700; font-size: .85rem;
  transition: background .15s ease;
}
.invite-copy:hover { filter: brightness(1.05); }
.invite-copy.done { background: var(--ok); }
.invite-result-note { margin: 0; color: var(--muted); font-size: .8rem; }

/* ─── Upload ─── */
.uploadwrap { display: grid; gap: 10px; }
.upload-btn { text-align: center; cursor: pointer; }
.progress { display: grid; gap: 6px; }
.prog-row { font-size: .85rem; color: var(--muted); }
.prog-row.err { color: var(--err); }
.prog-bar { height: 6px; background: #0d1114; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.prog-fill { height: 100%; width: 0; background: var(--accent); transition: width .15s ease; }

/* ─── Galerie (masonry par colonnes) ─── */
.gallery { columns: 2; column-gap: 8px; }
@media (min-width: 560px) { .gallery { columns: 3; } }
.gallery .empty { columns: 1; color: var(--muted); }
.tile {
  break-inside: avoid; margin: 0 0 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0d1114;
}
.tile img { display: block; width: 100%; height: auto; }
.tile-file { padding: 18px 12px; text-align: center; }
.tile-file .icon { font-size: 1.8rem; }
.tile-file .name { font-size: .8rem; color: var(--muted); margin-top: 6px; word-break: break-word; }

/* ─── Lightbox ─── */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 16px;
  background: rgba(0,0,0,.85);
}
.lb-box { display: flex; flex-direction: column; gap: 12px; max-width: 100%; max-height: 100%; }
.lb-media { max-width: 100%; max-height: 70vh; border-radius: 10px; }
audio.lb-media { width: 88vw; max-width: 520px; }
.lb-fileinfo { display: grid; gap: 12px; place-items: center; padding: 44px 24px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.lb-fileicon { font-size: 3rem; line-height: 1; }
.lb-filename { color: var(--fg); font-size: .95rem; word-break: break-word; max-width: 80vw; }
.lb-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.lb-actions .btn { text-decoration: none; }

/* ═══ Navigateur d'arbre (serveur de fichiers) ═══════════════════════════════ */
.h2 { font-size: 1.15rem; margin: 6px 0 12px; }
.crumb-home { display: inline-block; color: var(--muted); text-decoration: none; font-size: .85rem; margin-bottom: 10px; }
.crumb-home:hover { color: var(--accent); }

/* Partages (accueil) */
.shares { display: grid; gap: 10px; margin-bottom: 16px; }
.share-card {
  display: grid; gap: 8px; padding: 14px; text-decoration: none;
  background: #0d1114; border: 1px solid var(--line); border-radius: 12px; color: var(--fg);
}
.share-card:hover { border-color: var(--accent); }
.share-name { font-weight: 600; font-size: 1.05rem; }
.share-name::before { content: "🗂️ "; }
.newshare { margin-top: 8px; }

/* Jauge d'espace */
.quota { display: grid; gap: 5px; }
.quota-bar { height: 7px; background: #0d1114; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.quota-fill { height: 100%; width: 0; background: var(--accent); }
.quota-fill.full { background: var(--err); }
.quota-txt { color: var(--muted); font-size: .78rem; }

/* Fil d'Ariane */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0 12px; font-size: .95rem; }
.crumbs .crumb { color: var(--accent); text-decoration: none; }
.crumbs .crumb.cur { color: var(--fg); font-weight: 600; }
.crumb-sep { color: var(--muted); }

/* Sous-dossiers */
.tree-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.folder-tile {
  display: flex; align-items: center; gap: 8px; padding: 12px; min-height: 48px;
  background: #0d1114; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--fg);
}
.folder-tile:hover { border-color: var(--accent); }
.folder-tile.pub { border-left: 3px solid var(--ok); }
.folder-tile.priv { border-left: 3px solid var(--line); }
.folder-ic { font-size: 1.1rem; }
.folder-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Nouveau dossier */
.newfolder { display: flex; gap: 8px; margin-bottom: 10px; }
.nf-input { flex: 1 1 auto; min-width: 0; padding: 10px 12px; min-height: 42px; background: #0d1114; color: var(--fg); border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.nf-input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* Zone de dépôt */
.dropzone { border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; display: grid; gap: 10px; }
.dropzone.over { border-color: var(--accent); background: rgba(91,192,235,.06); }
.dz-hint { margin: 0; color: var(--muted); font-size: .85rem; text-align: center; }
.dz-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* Bascule public/privé */
.vis-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.vis-label { color: var(--muted); font-size: .85rem; }
.vis-btn { padding: 8px 12px; min-height: 40px; border-radius: 999px; cursor: pointer; font: inherit; background: #0d1114; color: var(--fg); border: 1px solid var(--line); }
.vis-btn.pub { border-color: rgba(110,231,168,.5); color: var(--ok); }
.vis-btn.priv { border-color: var(--line); }
.vis-hint { color: var(--muted); font-size: .78rem; font-weight: 400; }
.prog-row.ok { color: var(--ok); }
.zip-btn { justify-self: start; padding: 8px 14px; min-height: 40px; }
