/* Salon Facile — même famille visuelle que les logiciels « Facile » */
:root {
  --bg: #ffffff;
  --panel: #f4f6f5;
  --rail: #e7ecea;
  --line: #dde3e1;
  --fg: #1d2523;
  --muted: #5d6965;
  --accent: #2f7d6d;
  --accent-fg: #ffffff;
  --accent-soft: #e3f1ed;
  --hover: #e9eeec;
  --danger: #c0392b;
  --ok: #2e9b5b;
  --warn: #c98a12;
  --ombre: 0 10px 30px rgba(0, 0, 0, .14);
  --font: "Segoe UI", "Open Sans", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161a19;
    --panel: #1d2220;
    --rail: #111413;
    --line: #2d3431;
    --fg: #e6ebe9;
    --muted: #9aa6a1;
    --accent: #4fb39c;
    --accent-fg: #0b1a16;
    --accent-soft: #1f3530;
    --hover: #262d2a;
    --danger: #e5624f;
    --ok: #4cc38a;
    --ombre: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161a19; --panel: #1d2220; --rail: #111413; --line: #2d3431; --fg: #e6ebe9; --muted: #9aa6a1;
  --accent: #4fb39c; --accent-fg: #0b1a16; --accent-soft: #1f3530; --hover: #262d2a; --danger: #e5624f; --ok: #4cc38a;
  --ombre: 0 10px 30px rgba(0, 0, 0, .5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--font); overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cache { display: none !important; }
a { color: var(--accent); }

/* ---------- Connexion ---------- */
#ecran-connexion { height: 100%; display: grid; place-items: center; padding: 16px; background: var(--panel); overflow: auto; }
.carte { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(400px, 100%); box-shadow: var(--ombre); }
.carte h1 { margin: 0 0 4px; font-size: 26px; display: flex; align-items: center; gap: 10px; }
.carte p.sous { margin: 0 0 20px; color: var(--muted); }
.logo { width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; flex: none; }
.logo svg { width: 22px; height: 22px; }
.champ { display: block; margin-bottom: 14px; }
.champ span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.champ input, .champ select, .champ textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.champ input:focus, .champ select:focus { border-color: var(--accent); outline: none; }
.btn { border: 0; border-radius: 8px; padding: 10px 16px; background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.plein { width: 100%; }
.btn.gris { background: var(--hover); color: var(--fg); }
.btn.rouge { background: var(--danger); color: #fff; }
.lien { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; }
.erreur { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 4px 0 10px; }
.info { color: var(--muted); font-size: 14px; }

/* ---------- Disposition principale ---------- */
#appli { display: grid; grid-template-columns: 72px 240px 1fr auto; height: 100%; }
#rail { background: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; overflow-y: auto; scrollbar-width: none; }
.pastille { position: relative; width: 48px; height: 48px; border-radius: 16px; border: 0; background: var(--bg); color: var(--fg); font-weight: 700; display: grid; place-items: center; transition: border-radius .15s, background .15s; flex: none; }
.pastille:hover, .pastille.actif { border-radius: 12px; background: var(--accent); color: var(--accent-fg); }
.pastille svg { width: 24px; height: 24px; }
.pastille.ajout { color: var(--accent); background: var(--bg); }
.pastille.ajout:hover { background: var(--accent); color: var(--accent-fg); }
.pastille .point { position: absolute; left: -12px; width: 6px; height: 8px; border-radius: 0 4px 4px 0; background: var(--fg); }
.pastille.actif .point { height: 36px; }
.pastille .badge { position: absolute; right: -4px; bottom: -4px; }
.separateur { width: 32px; height: 2px; background: var(--line); border-radius: 2px; flex: none; }

#colonne { background: var(--panel); display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
#colonne-entete { height: 52px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); font-weight: 700; gap: 8px; }
#colonne-actions { display: flex; gap: 2px; }
#colonne-entete .titre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icone-btn { border: 0; background: none; color: var(--muted); width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.icone-btn:hover { background: var(--hover); color: var(--fg); }
.icone-btn svg { width: 20px; height: 20px; }
.icone-btn.actif { color: var(--danger); }
#liste-salons { flex: 1; overflow-y: auto; padding: 10px 8px; }
.groupe-titre { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 6px 4px; }
.groupe-titre .icone-btn { width: 22px; height: 22px; }
.groupe-titre .icone-btn svg { width: 16px; height: 16px; }
.element { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 0; background: none; border-radius: 7px; color: var(--muted); text-align: left; }
.element:hover { background: var(--hover); color: var(--fg); }
.element.actif { background: var(--accent-soft); color: var(--fg); font-weight: 600; }
.element.non-lu { color: var(--fg); font-weight: 700; }
.element svg { width: 18px; height: 18px; flex: none; }
.element .nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participants-vocal { padding: 2px 0 4px 34px; }
.participant-vocal { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; color: var(--muted); }
.participant-vocal .avatar { width: 22px; height: 22px; font-size: 11px; }
.participant-vocal .etat svg { width: 14px; height: 14px; }

.badge { background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center; }

/* Barre vocale + profil en bas de la colonne */
#barre-vocal { border-top: 1px solid var(--line); padding: 10px 12px; }
#barre-vocal .etat-co { color: var(--ok); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
#barre-vocal .ou { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#barre-vocal .commandes { display: flex; gap: 4px; margin-top: 8px; }
#barre-vocal .commandes .icone-btn { flex: 1; width: auto; background: var(--hover); }
#barre-vocal .commandes .icone-btn.allume { background: var(--accent); color: var(--accent-fg); }
#barre-vocal .commandes .icone-btn.quitter { background: var(--danger); color: #fff; }
#barre-profil { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; align-items: center; gap: 8px; background: var(--rail); }
#barre-profil .qui { flex: 1; min-width: 0; }
#barre-profil .qui b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#barre-profil .qui small { color: var(--muted); font-size: 12px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; position: relative; background-size: cover; background-position: center; }
.avatar .presence { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--panel); background: #8a948f; }
.avatar .presence.en-ligne { background: var(--ok); }
.avatar.parle { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ok); }

/* ---------- Zone centrale ---------- */
#centre { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#centre-entete { height: 52px; padding: 0 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); flex: none; }
#centre-entete .titre { font-weight: 700; display: flex; align-items: center; gap: 6px; min-width: 0; }
#centre-entete .titre svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
#centre-entete .titre span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#centre-entete .espace { flex: 1; }
#bouton-menu { display: none; }

#messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; }
.debut-salon { padding: 16px 20px 20px; }
.debut-salon .gros { width: 64px; height: 64px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 10px; }
.debut-salon .gros svg { width: 34px; height: 34px; }
.debut-salon h2 { margin: 0 0 4px; font-size: 26px; }
.debut-salon p { margin: 0; color: var(--muted); }
.message { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 2px 20px; position: relative; }
.message.premier { margin-top: 14px; }
.message:hover { background: var(--panel); }
.message .avatar { width: 40px; height: 40px; }
.message .entete { display: flex; align-items: baseline; gap: 8px; }
.message .entete b { font-weight: 700; }
.message .heure { color: var(--muted); font-size: 12px; }
.message .heure-cote { color: var(--muted); font-size: 11px; text-align: right; padding-top: 3px; visibility: hidden; }
.message:hover .heure-cote { visibility: visible; }
.message .texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.message .texte code { background: var(--hover); padding: 1px 5px; border-radius: 4px; font-family: Consolas, monospace; font-size: .9em; }
.message .texte .modif { color: var(--muted); font-size: 11px; }
.message .image { max-width: min(400px, 100%); max-height: 320px; border-radius: 8px; margin-top: 6px; display: block; cursor: zoom-in; border: 1px solid var(--line); }
.message .fichier { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); text-decoration: none; color: var(--fg); max-width: 100%; }
.message .fichier svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
.message .actions { position: absolute; right: 16px; top: -14px; display: none; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--ombre); }
.message:hover .actions { display: flex; }
.message .actions .icone-btn { width: 30px; height: 30px; }
.message .actions .icone-btn svg { width: 17px; height: 17px; }
.message.mention { background: color-mix(in srgb, var(--warn) 12%, transparent); box-shadow: inset 3px 0 var(--warn); }
.edition textarea { width: 100%; border: 1px solid var(--accent); border-radius: 8px; padding: 8px; background: var(--panel); resize: vertical; }
.edition small { color: var(--muted); }

#zone-saisie { padding: 0 16px 16px; flex: none; }
#saisie-boite { display: flex; align-items: flex-end; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
#saisie-boite:focus-within { border-color: var(--accent); }
#saisie { flex: 1; border: 0; background: none; resize: none; max-height: 200px; padding: 7px 4px; outline: none; }
#ecrit { height: 18px; font-size: 12px; color: var(--muted); padding: 2px 4px 0; }
#apercu-fichier { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
#apercu-fichier img { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }
#apercu-fichier span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Vocal / vidéo ---------- */
#scene-vocal { flex: 1; background: #0f1312; padding: 16px; overflow: auto; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-content: center; }
.tuile { position: relative; background: #1e2523; border-radius: 12px; aspect-ratio: 16 / 9; overflow: hidden; display: grid; place-items: center; border: 2px solid transparent; }
.tuile.parle { border-color: var(--ok); }
.tuile video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.tuile .avatar { width: 80px; height: 80px; font-size: 32px; }
.tuile .etiquette { position: absolute; left: 10px; bottom: 10px; background: rgba(0, 0, 0, .6); color: #fff; padding: 3px 10px; border-radius: 6px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tuile .etiquette svg { width: 14px; height: 14px; }
.tuile .agrandir { position: absolute; right: 8px; top: 8px; background: rgba(0, 0, 0, .55); color: #fff; }
.tuile .agrandir:hover { background: rgba(0, 0, 0, .8); color: #fff; }
#scene-vocal.focus { grid-template-columns: 1fr; }
.vide-vocal { color: #c9d2ce; text-align: center; grid-column: 1 / -1; }
.vide-vocal .btn { margin-top: 12px; }
#commandes-scene { display: flex; justify-content: center; gap: 10px; padding: 12px; background: #0f1312; }
#commandes-scene .icone-btn { width: 48px; height: 48px; border-radius: 50%; background: #2a3330; color: #e6ebe9; }
#commandes-scene .icone-btn:hover { background: #36413d; }
#commandes-scene .icone-btn.allume { background: var(--accent); color: var(--accent-fg); }
#commandes-scene .icone-btn.coupe { background: #e5624f; color: #fff; }
#commandes-scene .icone-btn.quitter { background: #e5624f; color: #fff; }
#commandes-scene .icone-btn svg { width: 22px; height: 22px; }

/* ---------- Membres ---------- */
#membres { width: 240px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 8px; }
.membre { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; border: 0; background: none; width: 100%; text-align: left; }
.membre:hover { background: var(--hover); }
.membre.hors-ligne { opacity: .55; }
.membre .nom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.couronne { color: var(--warn); width: 15px; height: 15px; flex: none; }

/* ---------- Accueil / amis ---------- */
#accueil { flex: 1; overflow-y: auto; padding: 16px 20px; }
.onglets { display: flex; gap: 6px; flex-wrap: wrap; }
.onglet { border: 0; background: none; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; }
.onglet:hover { background: var(--hover); color: var(--fg); }
.onglet.actif { background: var(--accent-soft); color: var(--fg); }
.onglet.vert { background: var(--accent); color: var(--accent-fg); }
.ami { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-top: 1px solid var(--line); }
.ami:hover { background: var(--panel); }
.ami .qui { flex: 1; min-width: 0; }
.ami .qui small { color: var(--muted); display: block; }
.ami .icone-btn { background: var(--hover); border-radius: 50%; }
.ami .icone-btn.ok:hover { color: var(--ok); }
.ami .icone-btn.non:hover { color: var(--danger); }
.compte { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; letter-spacing: .04em; }
.vide { text-align: center; color: var(--muted); padding: 48px 16px; }
.ajout-ami { display: flex; gap: 8px; margin-top: 12px; max-width: 560px; }
.ajout-ami input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }

/* ---------- Fenêtres ---------- */
#voile { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.fenetre { background: var(--bg); border-radius: 14px; width: min(460px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--ombre); padding: 24px; }
.fenetre h2 { margin: 0 0 6px; font-size: 21px; }
.fenetre p { color: var(--muted); margin: 0 0 16px; }
.fenetre .boutons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.choix-type { display: grid; gap: 8px; margin-bottom: 14px; }
.choix-type label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }
.choix-type label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choix-type svg { width: 20px; height: 20px; color: var(--muted); }
.code-invit { display: flex; gap: 8px; }
.code-invit input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-family: Consolas, monospace; font-size: 16px; letter-spacing: .08em; }
.liste-regl { display: grid; gap: 6px; margin: 10px 0; }
.liste-regl .ligne { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; background: var(--panel); }
.liste-regl .ligne span { flex: 1; }
.liste-regl svg { width: 16px; height: 16px; color: var(--muted); }

#visionneuse { position: fixed; inset: 0; background: rgba(0, 0, 0, .85); display: grid; place-items: center; z-index: 60; cursor: zoom-out; padding: 16px; }
#visionneuse img { max-width: 100%; max-height: 100%; border-radius: 8px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 70; box-shadow: var(--ombre); max-width: calc(100% - 32px); }

/* ---------- Téléphone / petite fenêtre ---------- */
@media (max-width: 1100px) { #membres { display: none; } #membres.force { display: block; position: fixed; right: 0; top: 52px; bottom: 0; z-index: 30; box-shadow: var(--ombre); } }
@media (max-width: 760px) {
  #appli { grid-template-columns: 1fr; }
  #rail, #colonne { position: fixed; top: 0; bottom: 0; z-index: 40; transform: translateX(-120%); transition: transform .2s; }
  #rail { left: 0; width: 72px; }
  #colonne { left: 72px; width: min(260px, calc(100vw - 72px)); }
  #appli.menu-ouvert #rail, #appli.menu-ouvert #colonne { transform: none; }
  #bouton-menu { display: grid; }
  .message { padding: 2px 12px; }
  #zone-saisie { padding: 0 10px 10px; }
}
