/* ===== Couleurs de GEBA (modifiez-les ici) ===== */
:root {
  --primary: #0f766e;
  --accent: #f59e0b;
  --bg: #f3f5f4;
  --card: #ffffff;
  --text: #17211f;
  --muted: #64736f;
  --border: #dde4e2;
  --danger: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #14b8a6;
    --bg: #0e1413;
    --card: #18211f;
    --text: #e8efed;
    --muted: #94a5a0;
    --border: #2b3835;
    --danger: #ef4444;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

h2, h3 { margin: 8px 0 12px; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--danger); font-size: .9rem; margin-bottom: 8px; }
.center { text-align: center; }
.logo { color: var(--primary); font-weight: 800; font-size: 1.6rem; letter-spacing: 2px; }

/* ===== Champs et boutons ===== */
input, textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* évite le zoom automatique sur iPhone */
}
textarea { resize: vertical; }

button { font: inherit; cursor: pointer; color: inherit; }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn.light { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); margin-bottom: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* ===== Connexion ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
}
.auth-card .btn { width: 100%; }
.demo { font-size: .8rem; color: var(--muted); border: 1px dashed var(--accent); border-radius: 8px; padding: 6px; margin-top: 10px; }
.tabs { display: flex; margin: 16px 0; border-bottom: 1px solid var(--border); }
.tabs button { flex: 1; padding: 10px; background: none; border: 0; border-bottom: 3px solid transparent; }
.tabs button.active { border-color: var(--primary); font-weight: 700; }

/* ===== Structure (téléphone d'abord) ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.content { max-width: 600px; margin: 0 auto; padding: 14px 12px 90px; }

.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 2px;
  background: none;
  border: 0;
  font-size: .72rem;
  color: var(--muted);
}
.nav button span { font-size: 1.25rem; }
.nav button.active { color: var(--primary); font-weight: 700; }
.nav em {
  position: absolute;
  top: 4px;
  left: 55%;
  min-width: 18px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-style: normal;
  font-size: .7rem;
  text-align: center;
}

/* ===== Publications, listes, messages ===== */
.avatar {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  object-fit: cover;
}
.avatar.big { width: 96px; height: 96px; font-size: 2.2rem; margin: 0 auto 8px; }
.post-text { margin: 10px 0; white-space: pre-wrap; }
.post-img { display: block; width: 100%; max-height: 480px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; }
.actions { display: flex; gap: 8px; margin-bottom: 8px; }
.actions .liked { color: var(--danger); border-color: var(--danger); }
.comment { background: var(--bg); border-radius: 10px; padding: 6px 10px; margin-bottom: 6px; font-size: .92rem; }
.comment-form input { margin: 0; }

.item { width: 100%; text-align: left; }

.chat-messages { height: 45vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 14px; background: var(--bg); align-self: flex-start; }
.bubble.me { align-self: flex-end; background: var(--primary); color: #fff; }
#chat-form input { margin: 0; flex: 1; min-width: 0; }

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90%;
  background: #222;
  color: #fff;
  padding: 10px 16px;
  border-radius: 20px;
  z-index: 20;
  font-size: .9rem;
}

/* ===== Ordinateur et tablette ===== */
@media (min-width: 800px) {
  .topbar { padding-left: 24px; }
  .nav {
    top: 57px;
    right: auto;
    width: 200px;
    flex-direction: column;
    justify-content: flex-start;
    border-top: 0;
    border-right: 1px solid var(--border);
    padding-top: 12px;
  }
  .nav button { flex: 0; flex-direction: row; gap: 12px; padding: 12px 20px; font-size: 1rem; }
  .nav em { position: static; margin-left: auto; }
  .content { padding-bottom: 24px; margin-left: max(220px, calc(50% - 300px)); margin-right: 20px; }
  .toast { bottom: 24px; }
}
