/* ═══════════════════════════════════════════════════════════════════════════
   ASSA — Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────────────────────── */
:root {
  --bg:        #080d18;
  --surface:   #0e1729;
  --surface2:  #13203a;
  --text:      #e8eaf0;
  --text2:     #8b97b2;
  --brand:     #7c3aed;
  --brand2:    #22c55e;
  --danger:    #ef4444;
  --border:    rgba(148,163,184,.14);
  --border2:   rgba(148,163,184,.24);
  --glow:      rgba(124,58,237,.18);
  --radius:    16px;
  --radius-sm: 10px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80vw 60vh at 10% -5%,  rgba(124,58,237,.28) 0%, transparent 55%),
    radial-gradient(ellipse 60vw 50vh at 92% 15%,  rgba(34,197,94,.18)  0%, transparent 50%),
    radial-gradient(ellipse 50vw 40vh at 50% 100%, rgba(124,58,237,.10) 0%, transparent 55%);
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (max-width: 560px) { .wrap { padding: 12px 10px; gap: 12px; } }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(14,23,41,.80);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
}
.brand {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.badge {
  font-size: 11px;
  color: var(--text2);
  border: 1px solid var(--border2);
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 500;
  background: rgba(148,163,184,.06);
}
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav a, .nav button.navBtn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text2);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav a:hover, .nav button.navBtn:hover {
  color: var(--text);
  background: rgba(148,163,184,.09);
}
.nav .sep { width: 1px; height: 16px; background: var(--border2); margin: 0 4px; flex-shrink: 0; }
.nav .decoBtn { color: rgba(239,68,68,.65); }
.nav .decoBtn:hover { color: #f87171; background: rgba(239,68,68,.10); }

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: rgba(14,23,41,.72);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 40px rgba(0,0,0,.40), inset 0 1px 0 rgba(255,255,255,.04);
  overflow: hidden;
}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.tab {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  color: var(--text2);
  border: 1px solid transparent;
  background: transparent;
  padding: 7px 18px;
  border-radius: var(--radius-sm);
  transition: color .15s, border-color .15s, background .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--text); background: rgba(148,163,184,.07); }
.tab[aria-selected="true"] {
  color: var(--text);
  border-color: rgba(124,58,237,.50);
  background: rgba(124,58,237,.14);
  box-shadow: 0 0 12px rgba(124,58,237,.12);
}

.panel { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.panel[hidden] { display: none; }
.panelTitle {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .1em;
}

/* ── Inputs ────────────────────────────────────────────────────────────────── */
.input, textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: rgba(8,13,24,.65);
  color: var(--text);
  padding: 11px 14px;
  outline: none;
  font: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  caret-color: var(--brand);
}
.input::placeholder, textarea::placeholder { color: var(--text2); opacity: .7; }
.input:focus, textarea:focus {
  border-color: rgba(124,58,237,.60);
  box-shadow: 0 0 0 3px rgba(124,58,237,.14);
}
textarea { resize: none; min-height: 46px; max-height: 160px; line-height: 1.5; }

/* ── Boutons ────────────────────────────────────────────────────────────────── */
.btn, .button {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(124,58,237,.95) 0%, rgba(34,197,94,.85) 100%);
  color: var(--text);
  padding: 10px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  flex-shrink: 0;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 2px 12px rgba(124,58,237,.25);
}
.btn:hover, .button:hover { opacity: .88; box-shadow: 0 4px 20px rgba(124,58,237,.35); }
.btn:active, .button:active { transform: scale(.97); }

.btn.sec, .button.secondary {
  background: rgba(14,23,41,.80);
  border: 1px solid var(--border2);
  box-shadow: none;
  color: var(--text);
}
.btn.sec:hover, .button.secondary:hover {
  border-color: var(--border2);
  background: rgba(148,163,184,.10);
  box-shadow: none;
}
.btn.danger, .button.danger {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.30);
  color: #f87171;
  box-shadow: none;
}
.btn.danger:hover, .button.danger:hover { background: rgba(239,68,68,.20); }
.btn.icon { padding: 9px 12px; font-size: 16px; border-radius: var(--radius-sm); }
.btn.sm, .button.sm { padding: 6px 13px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"],
.button:disabled, .button[aria-disabled="true"] { opacity: .35; cursor: not-allowed; transform: none !important; }

/* ── Utilitaires ────────────────────────────────────────────────────────────── */
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.small { font-size: 12px; color: var(--text2); }

.mt4{margin-top:4px} .mt8{margin-top:8px} .mt10{margin-top:10px} .mt12{margin-top:12px} .mt14{margin-top:14px}
.mb8{margin-bottom:8px} .mb10{margin-bottom:10px} .mb12{margin-bottom:12px}
.pad12{padding:12px} .pad18{padding:18px}
.maxw260{max-width:none} .maxw420{max-width:420px}
.minw140{min-width:140px} .minw0{min-width:0}
.fs22{font-size:22px} .fw700{font-weight:700} .fw800{font-weight:800} .fw900{font-weight:800}
.truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.prewrap{white-space:pre-wrap}
.flexBetween{display:flex;justify-content:space-between;gap:8px;align-items:flex-start}
.inline{display:inline}

.err {
  color: #fecaca;
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.28);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
}
.ok {
  color: #bbf7d0;
  background: rgba(34,197,94,.10);
  border: 1px solid rgba(34,197,94,.28);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
}

/* ── Page de connexion ──────────────────────────────────────────────────────── */
.loginWrap {
  max-width: 420px;
  margin: 9vh auto 0;
}
@media (max-width: 480px) { .loginWrap { margin: 4vh auto 0; } }

.loginCard {
  background: rgba(14,23,41,.80);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 32px 28px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 24px 64px rgba(0,0,0,.55),
    0 0 80px rgba(124,58,237,.08);
}
.loginBrand {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .3px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff 30%, rgba(167,139,250,.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.loginSub {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 24px;
}
.loginLinks {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.loginLinks a {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  border: 1px solid var(--border2);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: rgba(148,163,184,.05);
  transition: color .15s, background .15s, border-color .15s;
}
.loginLinks a:hover {
  color: var(--text);
  background: rgba(148,163,184,.10);
  border-color: rgba(148,163,184,.30);
}

/* ── Chat ──────────────────────────────────────────────────────────────────── */
.chatWrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: min(62vh, 540px);
  height: min(62dvh, 540px);
}
@media (max-width: 560px) { .chatWrap { height: calc(100dvh - 270px); } }

.chatList {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(8,13,24,.50);
  padding: 10px;
  scroll-behavior: smooth;
}
.chatList::-webkit-scrollbar { width: 4px; }
.chatList::-webkit-scrollbar-thumb { background: rgba(148,163,184,.20); border-radius: 4px; }

.replyBanner {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: rgba(124,58,237,.08);
  border-color: rgba(124,58,237,.25);
}
.replyTxt { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.composeBox { display: flex; flex-direction: column; gap: 7px; }
.composeRow { display: flex; gap: 7px; align-items: flex-end; }
.composeRow textarea { flex: 1; }
.composeBar { display: flex; gap: 7px; align-items: center; justify-content: space-between; }
.composeLeft { display: flex; gap: 6px; }

/* ── Messages ──────────────────────────────────────────────────────────────── */
.msg {
  max-width: 76%;
  min-width: 120px;
  width: fit-content;
  padding: 9px 12px;
  border-radius: 14px;
  margin: 4px 4px;
  line-height: 1.45;
  position: relative;
  font-size: 14px;
  word-break: break-word;
}
.msg.mine {
  margin-left: auto;
  background: rgba(124,58,237,.20);
  border: 1px solid rgba(124,58,237,.28);
  border-bottom-right-radius: 4px;
}
.msg.theirs {
  background: rgba(148,163,184,.08);
  border: 1px solid rgba(148,163,184,.14);
  border-bottom-left-radius: 4px;
}
.meta { margin-top: 5px; font-size: 11px; color: rgba(139,151,178,.70); }
.mBody a { color: #c4b5fd; text-decoration: underline; text-underline-offset: 2px; }
.mBody a:hover { color: #ddd6fe; }

.mActions { float:right; clear:none; display:inline-flex; gap:4px; align-items:flex-end; margin-left:8px; margin-bottom:-1px; opacity:0; pointer-events:none; transition:opacity .15s; }
.msg:hover .mActions, .msg:focus-within .mActions { opacity:1; pointer-events:auto; }
@media (max-width:720px) { .mActions { opacity:1; pointer-events:auto; } }

.mReply { border-left:3px solid rgba(124,58,237,.65);padding:5px 9px;margin-bottom:7px;background:rgba(14,23,41,.35);border-radius:8px; }
.mReplyUser { font-size:11px;font-weight:800;color:rgba(216,180,254,.90); }
.mReplyBody { font-size:11px;color:rgba(139,151,178,.80);white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }

.mAtts { display:flex;flex-direction:column;gap:6px;margin-bottom:7px; }
.mAtt { border:1px solid rgba(148,163,184,.14);border-radius:10px;background:rgba(14,23,41,.30);overflow:hidden; }
.mAttCap { padding:5px 9px;font-size:12px;color:rgba(139,151,178,.80);white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.mAttImg { display:block;color:inherit; }
.mAttImg img { display:block;max-width:300px;width:100%;height:auto;max-height:220px;object-fit:cover;background:var(--bg); }
.mAttVid video { display:block;max-width:300px;width:100%;height:auto;background:var(--bg); }
.mAttAud audio { display:block;width:100%; }
.mAttFile { display:flex;gap:8px;align-items:center;padding:7px 9px; }
.mAttFile .mAttCap { padding:0; }
.mReactions { display:flex;gap:5px;flex-wrap:wrap;margin-top:5px; }
.mRx { display:inline-flex;align-items:center;gap:4px;padding:3px 8px;border-radius:999px;border:1px solid rgba(148,163,184,.16);background:rgba(14,23,41,.35);font-size:11px;color:rgba(232,234,240,.80); }

/* ── Galerie ────────────────────────────────────────────────────────────────── */
.gallery, .galleryGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .gallery, .galleryGrid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px) { .gallery, .galleryGrid { grid-template-columns: 1fr; } }

.gItem {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(14,23,41,.60);
  transition: border-color .15s, transform .15s;
}
.gItem:hover { border-color: var(--border2); transform: translateY(-2px); }
.gThumb { display:block;width:100%;aspect-ratio:4/3;object-fit:cover;background:var(--surface2); }
.gBody { padding: 10px 12px 10px; }
.gName { font-weight:700;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-bottom:5px; }
.gActions { display:flex;gap:6px;flex-wrap:wrap;margin-top:8px; }
.gActions a.button, .gActions button.button { font-size:12px; }

/* ── Modal upload ────────────────────────────────────────────────────────────── */
.uploadModal { position:fixed;inset:0;z-index:50; }
.uBackdrop { position:absolute;inset:0;background:rgba(0,0,0,.55); }
.uCard {
  position:relative;max-width:660px;margin:8vh auto 0;
  background:rgba(14,23,41,.96);border:1px solid var(--border2);
  border-radius:20px;padding:18px;backdrop-filter:blur(20px);
  box-shadow:0 24px 64px rgba(0,0,0,.60);
}
@media (max-width:480px) { .uCard { margin:5vh 10px 0; } }
.uHeader { display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px; }
.uTitle { font-weight:800;font-size:15px; }
.uList { display:flex;flex-direction:column;gap:9px;max-height:50vh;overflow-y:auto;padding-right:2px; }
.uRow { border:1px solid var(--border);border-radius:var(--radius-sm);background:rgba(8,13,24,.55);padding:11px 12px; }
.uTop { display:flex;align-items:baseline;justify-content:space-between;gap:8px; }
.uName { font-weight:700;font-size:13px;overflow:hidden;text-overflow:ellipsis;max-width:82%;white-space:nowrap; }
.uPct { font-weight:800;font-size:12px;color:var(--text2);flex-shrink:0; }
.uBar { margin-top:8px;height:6px;border-radius:999px;background:rgba(148,163,184,.10);overflow:hidden; }
.uFill { height:100%;width:0%;background:linear-gradient(90deg,var(--brand),var(--brand2));transition:width .2s; }
.uMeta { margin-top:6px; }
.uRow.done .uPct { color:#bbf7d0; }
.uRow.error .uPct { color:#fecaca; }
.uRow.error .uFill { background:rgba(239,68,68,.65); }
