/* ============================================================
   FAMILLYCHATBOX — Modern Design
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
  --bg-base:        #0d1117;
  --bg-panel:       #161b22;
  --bg-card:        #21262d;
  --bg-hover:       #30363d;
  --bg-input:       #1c2128;
  --border:         #30363d;
  --accent:         #58a6ff;
  --accent-hover:   #79c0ff;
  --accent-2:       #bc8cff;
  --text-primary:   #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted:     #6e7681;
  --color-online:   #3fb950;
  --color-away:     #d29922;
  --color-offline:  #da3633;
  --color-admin:    #58a6ff;
  --color-modo:     #bc8cff;
  --color-ban:      #da3633;
  --msg-own-bg:     #1f6feb;
  --msg-own-text:   #ffffff;
  --msg-other-bg:   #21262d;
  --msg-other-text: #f0f6fc;
  --scrollbar-bg:   #0d1117;
  --scrollbar-thumb:#30363d;
  --shadow-sm:      0 2px 8px rgba(0,0,0,.35);
  --shadow:         0 8px 32px rgba(0,0,0,.55);
  --radius:         12px;
  --radius-sm:      6px;
  --radius-pill:    999px;
  --transition:     .18s ease;
  --topbar-h:       56px;
  --sidebar-l:      220px;
  --sidebar-r:      300px;
}

.theme-light {
  --bg-base:        #f6f8fa;
  --bg-panel:       #ffffff;
  --bg-card:        #f0f2f5;
  --bg-hover:       #e4e8ec;
  --bg-input:       #ffffff;
  --border:         #d0d7de;
  --text-primary:   #1f2328;
  --text-secondary: #57606a;
  --text-muted:     #6e7781;
  --msg-own-bg:     #0969da;
  --msg-other-bg:   #eaeef2;
  --msg-other-text: #1f2328;
  --scrollbar-bg:   #f6f8fa;
  --scrollbar-thumb:#c8d0d8;
  --shadow-sm:      0 2px 8px rgba(0,0,0,.08);
  --shadow:         0 8px 32px rgba(0,0,0,.12);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
}
body.admin-layout {
  height: auto;
  min-height: 100%;
  overflow: auto;
}
html:has(body.admin-layout) {
  overflow: auto;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar             { width: 5px; height: 5px; }
::-webkit-scrollbar-track       { background: var(--scrollbar-bg); }
::-webkit-scrollbar-thumb       { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== APP LAYOUT ===== */
.app-layout {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: .75rem;
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  font-size: .95rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-brand svg { width: 22px; height: 22px; flex-shrink: 0; }

.topbar-search { flex: 1; max-width: 300px; }
.topbar-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .35rem .9rem;
  color: var(--text-primary);
  font-size: .85rem;
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
}
.topbar-search input:focus    { border-color: var(--accent); }
.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-left: auto;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .28rem .55rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: .95rem;
  transition: all var(--transition);
  line-height: 1;
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* User menu */
.user-menu { position: relative; }
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: .22rem .7rem .22rem .22rem;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 500;
  transition: all var(--transition);
}
.user-menu-btn:hover { background: var(--bg-hover); }
.user-menu-btn img {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 210px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 200;
}
.user-dropdown.open { display: block; }

.user-dropdown a,
.user-dropdown label,
.dropdown-item-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: .9rem;
  cursor: pointer;
  transition: background var(--transition);
}
.user-dropdown a:hover,
.user-dropdown label:hover,
.dropdown-item-btn:hover { background: var(--bg-hover); }
.dropdown-item-btn {
  width: 100%;
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
}
.user-dropdown .divider { height: 1px; background: var(--border); margin: .2rem 0; }
.user-dropdown input[type="file"] { display: none; }

/* Grade badges */
.badge-admin { color: var(--color-admin); font-size: .7rem; font-weight: 700; letter-spacing: .04em; }
.badge-modo  { color: var(--color-modo);  font-size: .7rem; font-weight: 700; letter-spacing: .04em; }
.badge-ban   { color: var(--color-ban);   font-size: .7rem; font-weight: 700; letter-spacing: .04em; }

/* Auth nav links */
.nav-link-btn {
  padding: .35rem .85rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}
.nav-link-btn.primary { background: var(--accent); color: #fff; border: none; }
.nav-link-btn.primary:hover { background: var(--accent-hover); }
.nav-link-btn.ghost { background: none; color: var(--text-secondary); border: 1px solid var(--border); }
.nav-link-btn.ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ===== LEFT SIDEBAR ===== */
.sidebar-section-header {
  padding: .4rem .9rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-secondary);
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .4rem;
}

#nickList { flex-shrink: 0; max-height: 200px; overflow-y: auto; padding: .4rem 0; }

.nick-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .65rem;
  border-radius: var(--radius-sm);
  margin: .1rem .4rem;
  cursor: pointer;
  transition: background var(--transition);
}
.nick-item:hover { background: var(--bg-hover); }

.nick-avatar { position: relative; flex-shrink: 0; }
.nick-avatar img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.nick-status {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-panel);
}
.nick-status.online  { background: var(--color-online); }
.nick-status.away    { background: var(--color-away); }
.nick-status.offline { background: var(--color-offline); }

.nick-name {
  font-size: .85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== CHAT CONTAINER ===== */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Messages area */
#discussion {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: .75rem .9rem;
  display: flex;
  flex-direction: column;
  background-image: url("../Emoji/fond.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: scroll;
  scroll-behavior: auto;
}

/* Message wrapper */
.msg-wrapper {
  display: flex;
  flex-direction: column;
  margin-bottom: .15rem;
  animation: msgIn .18s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-wrapper.own   { align-items: flex-end; }
.msg-wrapper.other { align-items: flex-start; }
.msg-wrapper.system { align-items: center; }

/* Group header */
.msg-header {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .2rem;
  margin-top: .45rem;
}
.msg-wrapper.own .msg-header { flex-direction: row-reverse; }
.msg-header img {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.msg-header-name {
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
.msg-header-name:hover { text-decoration: underline; }
.msg-header-time {
  font-size: .68rem;
  color: var(--text-muted);
}

/* Bubble */
/* Mode bulles transparentes */
.bubbles-clear .msg-wrapper.own .msg-bubble {
  background: rgba(31,111,235,.13) !important;
  color: var(--text-primary) !important;
  border: 1px solid rgba(31,111,235,.28);
}
.bubbles-clear .msg-wrapper.other .msg-bubble {
  background: rgba(255,255,255,.07) !important;
  color: var(--text-primary) !important;
  border: 1px solid rgba(255,255,255,.12);
}
.theme-light.bubbles-clear .msg-wrapper.other .msg-bubble {
  background: rgba(0,0,0,.06) !important;
  border-color: rgba(0,0,0,.12);
}

.msg-bubble {
  position: relative;
  max-width: 68%;
  padding: .45rem .8rem;
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.5;
  word-break: break-word;
}
.msg-wrapper.own .msg-bubble {
  background: var(--msg-own-bg);
  color: var(--msg-own-text);
  border-bottom-right-radius: 3px;
}
.msg-wrapper.other .msg-bubble {
  background: var(--msg-other-bg);
  color: var(--msg-other-text);
  border-bottom-left-radius: 3px;
}
.msg-wrapper.system .msg-bubble {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-hover));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .82rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .4rem .85rem;
  max-width: 420px;
}
.msg-wrapper.system .msg-bubble img {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* Message actions */
.msg-actions {
  display: none;
  position: absolute;
  top: -22px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  flex-direction: row;
  gap: 1px;
  overflow: hidden;
  z-index: 10;
}
.msg-wrapper.own .msg-actions   { right: 0; }
.msg-wrapper.other .msg-actions { left: 0; }
.msg-bubble:hover .msg-actions  { display: flex; }

.msg-action-btn {
  background: none;
  border: none;
  padding: .22rem .45rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.4;
}
.msg-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.msg-action-btn.danger:hover { background: rgba(218,54,51,.15); color: var(--color-offline); }

/* Media in messages */
.msg-bubble img.photo {
  max-width: 100%;
  max-height: 280px;
  height: auto;
  border-radius: var(--radius-sm);
  margin-top: .3rem;
  display: block;
  cursor: zoom-in;
}
.msg-bubble video {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-top: .3rem;
}
.msg-bubble a { color: var(--accent); }
.msg-bubble a:hover { text-decoration: underline; }
.msg-wrapper.own .msg-bubble a { color: #a8d4ff; }

/* Reply preview in bubble */
.msg-reply-ref {
  background: rgba(0,0,0,.2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .2rem .5rem;
  margin-bottom: .3rem;
  font-size: .78rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Scroll-to-bottom button */
.scroll-bottom-btn {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: .35rem 1rem;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 20;
  animation: msgIn .2s ease;
  white-space: nowrap;
  font-family: inherit;
}
.scroll-bottom-btn:hover { background: var(--accent-hover); }

/* Reply preview strip */
.reply-preview {
  display: none;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: .4rem .75rem;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-size: .83rem;
  color: var(--text-secondary);
}
.reply-preview-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: .15rem .35rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  transition: color var(--transition);
  flex-shrink: 0;
}
.reply-preview-cancel:hover { color: var(--color-offline); }

/* Emoji picker */
.emoji-picker {
  display: none;
  flex-direction: column;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: .5rem .5rem .3rem;
  max-height: 190px;
  gap: .35rem;
}
.emoji-picker-search {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .3rem .6rem;
  color: var(--text-primary);
  font-size: .83rem;
  outline: none;
  width: 100%;
  font-family: inherit;
}
.emoji-picker-search:focus { border-color: var(--accent); }
.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
}
.emoji-item {
  cursor: pointer;
  padding: 3px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  line-height: 1;
}
.emoji-item:hover { background: var(--bg-hover); }
.emoji-item img { width: 26px; height: 26px; display: block; }

/* Input bar */
.input-bar {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: .5rem .6rem;
  display: flex;
  align-items: flex-end;
  gap: .3rem;
}
.input-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: .35rem;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  transition: all var(--transition);
  flex-shrink: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  text-decoration: none;
}
.input-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.input-btn.active { color: var(--accent); background: rgba(88,166,255,.12); }
.input-btn.sound-muted { color: var(--color-offline); }

#texte {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem .75rem;
  color: var(--text-primary);
  font-size: .9rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 34px;
  overflow-y: auto;
  line-height: 1.5;
  transition: border-color var(--transition);
}
#texte:focus { border-color: var(--accent); }
#texte::placeholder { color: var(--text-muted); }

.send-btn {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  padding: .35rem .7rem;
  font-size: 1rem;
  transition: all var(--transition);
  flex-shrink: 0;
  height: 34px;
  display: flex;
  align-items: center;
  font-family: inherit;
}
.send-btn:hover  { background: var(--accent-hover); transform: scale(1.05); }
.send-btn:active { transform: scale(.95); }

/* Guest/ban bar */
.guest-bar {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: .75rem;
  text-align: center;
  font-size: .88rem;
  color: var(--text-secondary);
}
.guest-bar a { color: var(--accent); text-decoration: none; }
.guest-bar a:hover { text-decoration: underline; }

/* ===== RIGHT SIDEBAR ===== */
.sidebar-right {
  width: var(--sidebar-r);
  min-width: var(--sidebar-r);
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-right-header {
  padding: .6rem 1rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.radio-player-container {
  flex-shrink: 0;
  overflow: hidden;
}
#lecteurAZURA {
  width: 100%;
  height: 160px;
  border: none;
  display: block;
}

/* Song info strip */
.song-info-strip {
  padding: .6rem .9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  min-height: 58px;
}
.song-info-strip .song-artist { font-size: .75rem; color: var(--text-secondary); }
.song-info-strip .song-title  { font-size: .88rem; font-weight: 600; margin-top: .1rem; line-height: 1.3; }
.song-info-strip .song-onair  { font-size: .72rem; color: var(--accent); margin-top: .1rem; }

/* Dedi marquee */
.dedi-marquee {
  flex-shrink: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding: .35rem 0;
  background: var(--bg-base);
}
.dedi-marquee > div {
  display: inline-block;
  padding-right: 2em;
  padding-left: 100%;
  white-space: nowrap;
  animation: defilement 70s infinite linear;
  font-size: .78rem;
  color: var(--text-secondary);
}
@keyframes defilement {
  from { transform: translate3d(0,0,0); }
  to   { transform: translate3d(-100%,0,0); }
}

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-base);
  overflow: auto;
}
.auth-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo h1 { font-size: 1.3rem; font-weight: 700; color: var(--accent); margin-bottom: .3rem; }
.auth-logo p  { color: var(--text-secondary); font-size: .88rem; }

.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--text-secondary);
}
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .58rem .8rem;
  color: var(--text-primary);
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,.12);
}
.form-control::placeholder { color: var(--text-muted); }

.btn-primary {
  display: block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .62rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  margin-top: .5rem;
  text-align: center;
  text-decoration: none;
}
.btn-primary:hover { background: var(--accent-hover); }

.auth-link { text-align: center; margin-top: 1rem; font-size: .85rem; color: var(--text-secondary); }
.auth-link a { color: var(--accent); text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

.alert {
  padding: .55rem .8rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  margin-bottom: 1rem;
}
.alert-danger {
  background: rgba(218,54,51,.1);
  border: 1px solid rgba(218,54,51,.3);
  color: #ff7b72;
}
.alert-success {
  background: rgba(63,185,80,.1);
  border: 1px solid rgba(63,185,80,.3);
  color: #56d364;
}
.auth-radio-player {
  width: 100%;
  max-width: 420px;
  margin-top: .75rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* ===== ADMIN PAGES ===== */
.admin-page {
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.admin-content { flex: 1; padding: 1.5rem; max-width: 1200px; width: 100%; margin: 0 auto; }
.admin-content h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 1.25rem; }

/* Data table */
.data-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg-panel); }
.data-table th {
  background: var(--bg-card);
  padding: .55rem .9rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: .875rem;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .25rem .5rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1.4;
}
.btn-icon:hover        { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon.danger       { border-color: rgba(218,54,51,.5); color: var(--color-offline); }
.btn-icon.danger:hover { background: rgba(218,54,51,.12); }
.btn-icon.success      { border-color: rgba(63,185,80,.5); color: var(--color-online); }
.btn-icon.success:hover{ background: rgba(63,185,80,.12); }
.btn-icon.info         { border-color: rgba(88,166,255,.5); color: var(--color-admin); }
.btn-icon.info:hover   { background: rgba(88,166,255,.12); }

.search-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.search-bar input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .8rem;
  color: var(--text-primary);
  font-size: .875rem;
  font-family: inherit;
  outline: none;
  width: 260px;
  transition: border-color var(--transition);
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--text-muted); }

/* ===== MODALS ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow);
}
.modal-box h3 { margin-bottom: 1rem; font-size: 1.05rem; }
.modal-box textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  color: var(--text-primary);
  font-size: .9rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  min-height: 90px;
  transition: border-color var(--transition);
}
.modal-box textarea:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem 1rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: .875rem;
  transition: all var(--transition);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-accent {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: .5rem 1.2rem;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-accent:hover { background: var(--accent-hover); }

/* ===== LIGHTBOX ===== */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

/* ===== CONTEXT MENU ===== */
.ctx-menu {
  position: fixed;
  z-index: 3000;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 155px;
  padding: .2rem 0;
  overflow: hidden;
}
.ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: .46rem .9rem;
  font-size: .87rem;
  font-family: inherit;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}
.ctx-item:hover     { background: var(--bg-hover); }
.ctx-danger:hover   { color: var(--color-offline); }
.ctx-success:hover  { color: var(--color-online); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-size: .875rem;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease;
  max-width: 300px;
  pointer-events: all;
}
.toast.success { border-color: rgba(63,185,80,.4); color: #56d364; }
.toast.danger  { border-color: rgba(218,54,51,.4); color: #ff7b72; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== CONFS PAGE ===== */
.conf-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.conf-card h3 { font-size: .95rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.conf-preview {
  width: 200px;
  height: 115px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: .75rem;
  display: block;
}
.conf-card input[type="text"],
.conf-card input[type="file"] {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .8rem;
  color: var(--text-primary);
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.conf-card input[type="text"]:focus { border-color: var(--accent); }
.conf-card label { display: block; font-size: .82rem; color: var(--text-secondary); margin-bottom: .35rem; }

/* ===== SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skel-line    { height: 12px; margin-bottom: 6px; }
.skel-line.w60 { width: 60%; }
.skel-line.w80 { width: 80%; }
.skel-line.w40 { width: 40%; }
.skel-avatar  { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; }

/* Skeleton wrapper */
.skel-msg { display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .75rem; }
.skel-body { flex: 1; }

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
  :root { --sidebar-r: 260px; }
}
/* Bouton radio mobile — caché sur desktop */
.mobile-radio-btn { display: none; }

@media (max-width: 768px) {
  :root { --sidebar-l: 0px; --sidebar-r: 0px; }

  /* Layout fixe : discussion scrolle en interne, input toujours visible */
  html, body { overflow: hidden; height: 100%; }
  .app-layout { height: calc(100dvh - var(--topbar-h)); }
  #discussion { min-height: 0; }
  .msg-bubble { max-width: 88%; }
  .topbar-search { display: none; }
  .input-bar { position: relative; z-index: 10; }

  /* Bouton radio visible sur mobile */
  .mobile-radio-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
  }
  .mobile-radio-btn.active { color: var(--accent); border-color: var(--accent); }

  /* Sidebar droite en overlay sur mobile */
  .sidebar-right {
    display: none;
    position: fixed;
    top: var(--topbar-h);
    right: 0;
    width: 88vw;
    max-width: 320px;
    height: calc(100dvh - var(--topbar-h));
    z-index: 500;
    box-shadow: -6px 0 24px rgba(0,0,0,.55);
    overflow-y: auto;
  }
  .sidebar-right.open { display: flex; }

  /* Fond semi-transparent derrière le panel */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--topbar-h);
    background: rgba(0,0,0,.45);
    z-index: 499;
  }
  .sidebar-overlay.open { display: block; }
}
