/* ── VARIABLES ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg: #0e0f14;
  --surface: #16181f;
  --surface2: #1e2029;
  --border: #2a2d3a;
  --accent: #6c63ff;
  --accent2: #ff6584;
  --green: #43d98c;
  --yellow: #ffd166;
  --text: #e8eaf0;
  --muted: #7b7f96;
  --radius: 14px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── LAYOUT ────────────────────────────────────── */
#app { display: flex; height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  gap: 6px;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

/* ── LOGO ───────────────────────────────────────── */
.logo {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.logo span { color: var(--accent2); }

/* ── NAV ────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  transition: all 0.2s;
  font-size: 14px;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(108,99,255,0.15); color: var(--accent); }
.nav-item .icon { width: 20px; text-align: center; font-size: 16px; }

.nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 12px 12px 4px;
  font-weight: 600;
}

/* ── CARDS ──────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 4px;
}

.page-title {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

/* ── BUTTONS ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #8079ff; transform: translateY(-1px); }
.btn-danger { background: rgba(255,101,132,0.15); color: var(--accent2); border: 1px solid rgba(255,101,132,0.3); }
.btn-danger:hover { background: rgba(255,101,132,0.25); }
.btn-success { background: rgba(67,217,140,0.15); color: var(--green); border: 1px solid rgba(67,217,140,0.3); }
.btn-success:hover { background: rgba(67,217,140,0.25); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ── FORMS ──────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--muted); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ── BADGES ─────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-viens { background: rgba(67,217,140,0.15); color: var(--green); }
.badge-viens_pas { background: rgba(255,101,132,0.15); color: var(--accent2); }
.badge-peut_etre { background: rgba(255,209,102,0.15); color: var(--yellow); }
.badge-admin { background: rgba(108,99,255,0.2); color: var(--accent); }

/* ── AUTH SCREEN ────────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  padding: 20px;
}

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}

.auth-logo {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
}
.auth-logo span { color: var(--accent2); }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.auth-toggle { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }
.auth-toggle a { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ── SORTIE LIST ─────────────────────────────────── */
.sortie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.sortie-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.sortie-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.sortie-card .meta { font-size: 13px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; flex-wrap: wrap; }
.sortie-card .meta span { display: flex; align-items: center; gap: 4px; }
.sortie-card .admin-badge { position: absolute; top: 14px; right: 14px; }

/* ── CHAT ───────────────────────────────────────── */
.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 340px;
  background: var(--surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-bubble { max-width: 75%; }
.chat-bubble.me { align-self: flex-end; }
.chat-bubble .name { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.chat-bubble.me .name { text-align: right; }
.chat-bubble .text {
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  word-break: break-word;
}
.chat-bubble.me .text { background: var(--accent); color: #fff; }
.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
}
.chat-input-row input:focus { border-color: var(--accent); }

/* ── TABS ───────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--surface2); border-radius: 10px; padding: 4px; }
.tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.2s;
}
.tab.active { background: var(--surface); color: var(--text); }

/* ── ALERTS ─────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 9px; font-size: 14px; margin-bottom: 12px; }
.alert-error { background: rgba(255,101,132,0.1); color: var(--accent2); border: 1px solid rgba(255,101,132,0.3); }
.alert-success { background: rgba(67,217,140,0.1); color: var(--green); border: 1px solid rgba(67,217,140,0.3); }

/* ── PRESENCE BUTTONS ───────────────────────────── */
.presence-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

/* ── REQUESTS LIST ──────────────────────────────── */
.request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.request-item:last-child { border-bottom: none; }

/* ── CODE CHIP ──────────────────────────────────── */
.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: monospace;
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--accent);
  cursor: pointer;
}
.code-chip:hover { border-color: var(--accent); }

/* ── SCROLLBAR ──────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── MODAL ──────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 768px) {
  #app { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    padding: 10px 12px;
    overflow-x: auto;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar .logo, .sidebar .nav-section { display: none; }
  .sidebar .nav-item { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 10px; flex-shrink: 0; }
  .main-content { padding: 16px; }
}

/* ── DIVIDER ─────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.flex-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--muted); font-size: 13px; }
