/* ============================================================
   style.css — SocialNet
   Design: moderne, clean, violet foncé + blanc + accents cyan
   ============================================================ */

/* ——— Variables ——————————————————————————————————————————— */
:root {
  --bg:          #0f1117;
  --bg2:         #181c27;
  --bg3:         #1e2333;
  --card:        #242840;
  --border:      #2e3354;
  --primary:     #6c63ff;
  --primary-h:   #8b85ff;
  --accent:      #00d4ff;
  --accent2:     #ff6b9d;
  --text:        #e8eaf0;
  --text-muted:  #7b82a0;
  --success:     #00e676;
  --warning:     #ffab40;
  --danger:      #ff5252;
  --radius:      14px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,.45);
  --shadow-lg:   0 8px 48px rgba(0,0,0,.6);
  --transition:  0.22s cubic-bezier(.4,0,.2,1);
  --font-body:   'Nunito', 'Segoe UI', sans-serif;
  --font-display:'Sora', 'Nunito', sans-serif;
}

/* ——— Reset & Base ——————————————————————————————————————— */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-h); }

img { max-width: 100%; height: auto; display: block; }

/* ——— Typography ————————————————————————————————————————— */
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }

/* ——— Scrollbar ——————————————————————————————————————————— */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15,17,23,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.site-header .logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.header-search {
  flex: 1;
  max-width: 320px;
  position: relative;
}

.header-search input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: .42rem 1rem .42rem 2.4rem;
  color: var(--text);
  font-size: .9rem;
  outline: none;
  transition: border-color var(--transition);
}
.header-search input:focus { border-color: var(--primary); }
.header-search .search-icon {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: .9rem; pointer-events: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  padding: .4rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .7rem;
  gap: .18rem;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  border: none;
  background: transparent;
  position: relative;
}
.nav-btn i { font-size: 1.25rem; }
.nav-btn:hover, .nav-btn.active { background: var(--bg3); color: var(--primary); }
.nav-btn .badge {
  position: absolute; top: 3px; right: 8px;
  background: var(--danger); color: #fff;
  font-size: .6rem; padding: 1px 5px;
  border-radius: 10px; line-height: 1.4;
  font-weight: 700;
}

.nav-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition);
}
.nav-avatar:hover { border-color: var(--primary); }

/* Dropdown menu */
.nav-dropdown { position: relative; }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 8px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 190px;
  box-shadow: var(--shadow-lg);
  padding: .5rem;
  z-index: 999;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu { display: block; animation: fadeDown .18s ease; }

@keyframes fadeDown {
  from { opacity:0; transform: translateY(-8px); }
  to   { opacity:1; transform: translateY(0); }
}

.nav-dropdown-menu a,
.nav-dropdown-menu button {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .9rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  width: 100%;
  background: none; border: none; cursor: pointer;
  transition: background var(--transition);
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu button:hover { background: var(--bg3); color: var(--primary); }

/* Lang switcher */
.lang-switcher { display: flex; gap: .3rem; align-items: center; }
.lang-btn {
  font-size: .75rem; font-weight: 600;
  padding: .25rem .55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  cursor: pointer; transition: all var(--transition);
}
.lang-btn:hover, .lang-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.site-main { flex: 1; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 1rem; }

/* 3 colonnes pour le feed */
.feed-layout {
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  gap: 1.25rem;
  padding: 1.25rem 0;
}
@media (max-width: 960px) {
  .feed-layout { grid-template-columns: 1fr; }
  .sidebar-left, .sidebar-right { display: none; }
}
@media (max-width: 1100px) {
  .feed-layout { grid-template-columns: 240px 1fr; }
  .sidebar-right { display: none; }
}

/* Sidebar */
.sidebar { position: sticky; top: 76px; height: fit-content; }

.sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.sidebar-card h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .75rem; }

.sidebar-menu { list-style: none; }
.sidebar-menu li a {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--text); font-size: .93rem;
  transition: background var(--transition), color var(--transition);
}
.sidebar-menu li a:hover, .sidebar-menu li a.active {
  background: var(--bg3); color: var(--primary);
}
.sidebar-menu li a i { width: 20px; text-align: center; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-body { padding: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: 30px;
  font-family: var(--font-body);
  font-size: .9rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); color: #fff; transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: var(--bg3); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.15); }
.btn-success { background: var(--success); color: #000; font-weight: 700; }
.btn-sm { padding: .35rem .85rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   FORMULAIRES
   ============================================================ */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .4rem; font-weight: 600; }

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: .95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,.18);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b82a0' fill='none' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-check { display: flex; align-items: center; gap: .5rem; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }

.input-group { position: relative; }
.input-group .input-icon {
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
}
.input-group .form-control { padding-left: 2.5rem; }
.input-group .input-icon-right {
  position: absolute; right: .9rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer;
}

/* Erreur champ */
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: .8rem; color: var(--danger); margin-top: .25rem; }
.valid-feedback   { font-size: .8rem; color: var(--success); margin-top: .25rem; }

/* Alerts */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .9rem;
  display: flex; align-items: center; gap: .6rem;
}
.alert-danger  { background: rgba(255,82,82,.12); border: 1px solid rgba(255,82,82,.3); color: #ff8a8a; }
.alert-success { background: rgba(0,230,118,.12); border: 1px solid rgba(0,230,118,.3); color: #6effa8; }
.alert-info    { background: rgba(0,212,255,.1);  border: 1px solid rgba(0,212,255,.3); color: #80e8ff; }
.alert-warning { background: rgba(255,171,64,.1); border: 1px solid rgba(255,171,64,.3); color: #ffc87a; }

/* ============================================================
   POST (MUR)
   ============================================================ */
.post-composer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1.25rem;
}
.post-composer-top {
  display: flex; align-items: center; gap: .85rem; margin-bottom: .85rem;
}
.post-composer-top .avatar { flex-shrink: 0; }
.post-composer-textarea {
  flex: 1;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: .65rem 1.1rem;
  color: var(--text); font-size: .95rem;
  outline: none; resize: none;
  font-family: var(--font-body);
  transition: border-color var(--transition), height .2s;
  overflow: hidden;
  min-height: 44px;
}
.post-composer-textarea:focus { border-color: var(--primary); }
.post-composer-actions {
  display: flex; align-items: center; gap: .5rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.post-action-btn {
  display: flex; align-items: center; gap: .35rem;
  padding: .4rem .8rem;
  border-radius: 8px;
  background: none; border: none;
  color: var(--text-muted); font-size: .85rem; font-weight: 600;
  cursor: pointer; transition: background var(--transition), color var(--transition);
}
.post-action-btn:hover { background: var(--bg3); color: var(--primary); }
.post-action-btn.photo  i { color: #4CAF50; }
.post-action-btn.video  i { color: #FF5722; }
.post-action-btn.link   i { color: var(--accent); }

.post-composer-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: .75rem;
}

/* Post card */
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.1rem;
  overflow: hidden;
}
.post-header {
  display: flex; align-items: center; gap: .85rem;
  padding: 1rem 1.1rem .75rem;
}
.post-header .post-info { flex: 1; }
.post-header .post-author { font-weight: 700; font-size: .95rem; }
.post-header .post-meta {
  font-size: .78rem; color: var(--text-muted);
  display: flex; gap: .4rem; align-items: center;
}
.post-header .post-options {
  margin-left: auto;
  background: none; border: none;
  color: var(--text-muted); font-size: 1.1rem;
  cursor: pointer; padding: .3rem; border-radius: 6px;
  transition: background var(--transition);
}
.post-header .post-options:hover { background: var(--bg3); color: var(--text); }

.post-content { padding: 0 1.1rem .85rem; font-size: .96rem; line-height: 1.65; }
.post-content a { color: var(--accent); }

.post-media { width: 100%; }
.post-media img { width: 100%; max-height: 520px; object-fit: contain; background: #000; cursor: pointer; transition: filter var(--transition); }
.post-media img:hover { filter: brightness(.92); }
.post-media video { width: 100%; }

.post-stats {
  padding: .5rem 1.1rem;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .82rem; color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.post-reactions-display { display: flex; gap: .2rem; align-items: center; }
.post-reactions-display span { font-size: 1rem; }

.post-actions {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
}
.post-action {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .65rem;
  background: none; border: none;
  color: var(--text-muted); font-size: .88rem; font-weight: 600;
  cursor: pointer; transition: background var(--transition), color var(--transition);
  position: relative;
}
.post-action:hover { background: var(--bg3); color: var(--primary); }
.post-action.liked { color: var(--primary); }

/* Reaction picker */
.reaction-picker {
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%) scale(.85);
  transform-origin: bottom center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: .5rem .8rem .8rem; /* padding bas extra = pont invisible */
  display: flex; gap: .25rem;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
  z-index: 100;
  /* Empêcher le crop à gauche sur le premier bouton */
  min-width: max-content;
  white-space: nowrap;
}
/* Pont invisible entre le bouton et le picker pour garder le hover */
.reaction-picker::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 12px;
  transform: translateY(100%);
}
.post-action:hover .reaction-picker,
.reaction-picker:hover,
.reaction-picker.visible {
  opacity: 1; pointer-events: all;
  transform: translateX(-50%) scale(1);
}
.reaction-emoji {
  font-size: 1.45rem;
  cursor: pointer;
  padding: .25rem .3rem;
  border-radius: 50%;
  transition: transform .18s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.reaction-emoji:hover { transform: scale(1.45); }

/* Commentaires */
.comments-section { padding: 0 1.1rem 1rem; display: none; }
.comments-section.open { display: block; }
.comment-input-row { display: flex; gap: .6rem; align-items: center; margin-bottom: .75rem; }
.comment-input {
  flex: 1; background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: 22px; padding: .5rem 1rem;
  color: var(--text); font-family: var(--font-body);
  outline: none; font-size: .9rem;
  transition: border-color var(--transition);
}
.comment-input:focus { border-color: var(--primary); }
.comment {
  display: flex; gap: .6rem; margin-bottom: .6rem;
}
.comment .comment-bubble {
  background: var(--bg3); border-radius: 14px;
  padding: .55rem .9rem; font-size: .88rem;
  flex: 1;
}
.comment .comment-author { font-weight: 700; font-size: .82rem; margin-bottom: .15rem; }
.comment .comment-time { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; }

/* ============================================================
   AVATARS
   ============================================================ */
.avatar {
  border-radius: 50%; object-fit: cover;
  flex-shrink: 0; display: block;
  background: var(--border);
}
.avatar-xs { width: 28px;  height: 28px; }
.avatar-sm { width: 36px;  height: 36px; }
.avatar-md { width: 48px;  height: 48px; }
.avatar-lg { width: 72px;  height: 72px; }
.avatar-xl { width: 100px; height: 100px; border: 3px solid var(--card); }
.avatar-xxl{ width: 140px; height: 140px; border: 4px solid var(--card); }

.avatar-online { position: relative; }
.avatar-online::after {
  content: ''; position: absolute; bottom: 2px; right: 2px;
  width: 10px; height: 10px; background: var(--success);
  border-radius: 50%; border: 2px solid var(--bg);
}

/* ============================================================
   CHAT
   ============================================================ */
.chat-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - 62px);
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}
@media (max-width: 700px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .chat-sidebar.show { display: flex; }
}

.chat-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-list { flex: 1; overflow-y: auto; }
.chat-list-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.chat-list-item:hover { background: var(--bg3); }
.chat-list-item.active { background: var(--bg3); border-left: 3px solid var(--primary); }
.chat-list-item .chat-info { flex: 1; min-width: 0; }
.chat-list-item .chat-name { font-weight: 600; font-size: .9rem; }
.chat-list-item .chat-preview {
  font-size: .78rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-list-item .chat-time { font-size: .72rem; color: var(--text-muted); }
.unread-count {
  background: var(--primary); color: #fff;
  border-radius: 12px; padding: 1px 7px;
  font-size: .7rem; font-weight: 700;
}

.chat-main {
  display: flex; flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  min-width: 0;
  width: 100%;
}
.chat-header {
  padding: .85rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .85rem;
  background: var(--bg2);
}
.chat-messages {
  flex: 1; overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: .6rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.message { display: flex; gap: .5rem; max-width: 70%; min-width: 0; }
.message.sent { flex-direction: row-reverse; margin-left: auto; max-width: 70%; }
.message-bubble {
  padding: .6rem 1rem;
  border-radius: 18px;
  font-size: .9rem; line-height: 1.5;
  word-break: break-word;
  max-width: 100%;
  overflow-wrap: break-word;
}
.message.received .message-bubble {
  background: var(--card); border-bottom-left-radius: 4px;
}
.message.sent .message-bubble {
  background: var(--primary); color: #fff; border-bottom-right-radius: 4px;
}
.message-time { font-size: .7rem; color: var(--text-muted); margin-top: .2rem; text-align: right; }
.message.received .message-time { text-align: left; }

.chat-input-area {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; gap: .75rem; align-items: center;
  background: var(--bg2);
}
.chat-input {
  flex: 1; background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 25px; padding: .6rem 1.1rem;
  color: var(--text); font-family: var(--font-body); font-size: .93rem;
  outline: none; transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--primary); }
.chat-send-btn {
  width: 42px; height: 42px;
  background: var(--primary); border: none;
  border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--primary-h); transform: scale(1.06); }

/* ============================================================
   AUTH PAGES (login / register)
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 60% 40%, rgba(108,99,255,.15) 0%, transparent 60%),
              radial-gradient(ellipse at 10% 80%, rgba(0,212,255,.08) 0%, transparent 50%),
              var(--bg);
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center;
  font-family: var(--font-display);
  font-size: 2rem; font-weight: 800; margin-bottom: .3rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 2rem; font-size: .95rem; }
.auth-divider {
  text-align: center; position: relative;
  margin: 1.25rem 0; color: var(--text-muted); font-size: .82rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 43%; height: 1px; background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

/* Captcha honeypot + timing */
.hp-field { display: none !important; }

/* ============================================================
   PROFIL
   ============================================================ */
.profile-cover {
  height: 220px; background: linear-gradient(135deg, var(--primary), var(--accent2));
  position: relative; border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
.profile-cover img { width:100%; height:100%; object-fit:cover; }
.profile-cover-edit {
  position: absolute; bottom: .75rem; right: .75rem;
}
.profile-info-bar {
  background: var(--card); border: 1px solid var(--border);
  padding: 0 1.5rem 1.25rem;
  border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  position: relative;
}
.profile-avatar-wrap {
  position: absolute; top: -48px; left: 1.5rem;
}
.profile-avatar-wrap img {
  width: 96px; height: 96px;
  border: 4px solid var(--card); border-radius: 50%;
  object-fit: cover; display: block;
}
.profile-actions { margin-left: auto; display: flex; gap: .5rem; }
.profile-name-row {
  padding-top: 56px;
  display: flex; align-items: flex-end; justify-content: space-between;
}
.profile-name { font-size: 1.5rem; font-weight: 800; }
.profile-username { color: var(--text-muted); font-size: .9rem; }
.profile-bio { color: var(--text-muted); font-size: .9rem; margin-top: .35rem; }
.profile-stats {
  display: flex; gap: 1.5rem; margin-top: .85rem;
}
.profile-stat { text-align: center; cursor: pointer; }
.profile-stat .stat-val { font-weight: 800; font-size: 1.1rem; display: block; }
.profile-stat .stat-lbl { font-size: .78rem; color: var(--text-muted); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
}
.footer-links {
  display: flex; flex-wrap: wrap;
  justify-content: center; gap: .3rem 1rem;
  margin-bottom: .7rem;
}
.footer-links a { color: var(--text-muted); transition: color var(--transition); }
.footer-links a:hover { color: var(--primary); }

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; animation: fadeIn .2s ease; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .22s ease;
}
@keyframes slideUp {
  from { opacity:0; transform: translateY(30px); }
  to   { opacity:1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity:0; } to { opacity:1; }
}
.modal-header {
  padding: 1.2rem 1.4rem .9rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.3rem; cursor: pointer; padding: .2rem .4rem;
  border-radius: 6px; transition: background var(--transition);
}
.modal-close:hover { background: var(--bg3); }
.modal-body { padding: 1.4rem; }
.modal-footer {
  padding: .9rem 1.4rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .6rem;
}

/* ============================================================
   NOTIFICATIONS PANEL
   ============================================================ */
.notif-panel {
  position: fixed; right: 1rem; top: 70px;
  width: 340px; max-height: 500px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 1500; display: none;
}
.notif-panel.show { display: block; animation: fadeDown .18s ease; }
.notif-item {
  display: flex; gap: .75rem; align-items: center;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.notif-item:hover { background: var(--bg3); }
.notif-item.unread { background: rgba(108,99,255,.07); }
.notif-item.unread::before {
  content: ''; display: block;
  width: 7px; height: 7px; min-width: 7px;
  background: var(--primary); border-radius: 50%;
}
.notif-text { font-size: .85rem; flex: 1; }
.notif-text strong { color: var(--text); }
.notif-time { font-size: .72rem; color: var(--text-muted); }

/* ============================================================
   UTILITAIRES
   ============================================================ */
.text-muted   { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-center  { text-align: center; }
.text-sm      { font-size: .82rem; }
.fw-bold      { font-weight: 700; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-1        { gap: .5rem; }
.gap-2        { gap: 1rem; }
.mt-1         { margin-top: .5rem; }
.mt-2         { margin-top: 1rem; }
.mt-3         { margin-top: 1.5rem; }
.mb-1         { margin-bottom: .5rem; }
.mb-2         { margin-bottom: 1rem; }
.p-2          { padding: 1rem; }
.divider      { height: 1px; background: var(--border); margin: .75rem 0; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Toast */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999; display: flex; flex-direction: column; gap: .5rem;
}
.toast {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: .75rem 1.1rem;
  font-size: .9rem; min-width: 220px; max-width: 320px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: .6rem;
  animation: toastIn .3s ease;
}
@keyframes toastIn {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

/* Progress bar */
.progress { background: var(--bg3); border-radius: 10px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 10px; transition: width .4s; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem; border-radius: 20px;
  font-size: .72rem; font-weight: 700;
}
.badge-primary { background: rgba(108,99,255,.2); color: var(--primary); }
.badge-success { background: rgba(0,230,118,.15); color: var(--success); }
.badge-danger  { background: rgba(255,82,82,.15);  color: var(--danger); }
.badge-warning { background: rgba(255,171,64,.15); color: var(--warning); }


/* ============================================================
   NAVIGATION MOBILE BAS D'ÉCRAN
   ============================================================ */
.mobile-bottom-nav {
  display: none; /* caché sur desktop */
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(24,28,39,.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 1001;
    padding: .4rem 0 calc(.4rem + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: center;
    min-height: 58px;
  }
  .mob-nav-btn {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    color: var(--text-muted); text-decoration: none;
    font-size: .62rem; font-weight: 600;
    padding: .25rem .5rem;
    border-radius: 10px;
    transition: color var(--transition);
    position: relative;
    min-width: 52px;
  }
  .mob-nav-btn i { font-size: 1.3rem; }
  .mob-nav-btn.active { color: var(--primary); }
  .mob-nav-btn.active i { font-weight: 700; }
  .mob-badge {
    position: absolute; top: 0; right: 6px;
    background: var(--danger); color: #fff;
    font-size: .55rem; padding: 1px 4px;
    border-radius: 10px; font-weight: 700;
  }

  /* Simplifier la nav header sur mobile - garder notif + avatar */
  .header-nav { gap: .15rem; }
  .header-nav .nav-btn:not(#notifToggle) { display: none; }

  /* Pousser le contenu principal au-dessus de la nav */
  /* calc: 64px nav + env() safe area iPhone + 8px marge */
  .site-main {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 8px) !important;
  }
  .chat-layout { height: calc(100vh - 52px - 64px); }

  /* Footer site aussi poussé au-dessus de la nav */
  .site-footer {
    margin-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ============================================================
   FIXES MOBILE — PAGES SPÉCIFIQUES
   ============================================================ */
@media (max-width: 768px) {

  /* ——— Page Explore ——————————————————————————————————————— */
  /* Grille sidebar+contenu → 1 colonne */
  .explore-layout,
  [style*="grid-template-columns:280px 1fr"],
  [style*="grid-template-columns: 280px 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Cacher sidebar explore sur mobile */
  .explore-sidebar { display: none !important; }

  /* ——— Page Profil ———————————————————————————————————————— */
  /* Grille info+feed → 1 colonne */
  [style*="grid-template-columns:280px 1fr"],
  [style*="grid-template-columns: 280px 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Sidebar "À propos" avant le feed */
  .profile-about-sidebar { order: -1; }

  /* ——— Page Admin ————————————————————————————————————————— */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ——— Page Chat ————————————————————————————————————————— */
  .chat-layout {
    grid-template-columns: 1fr !important;
    height: calc(100vh - 56px - 64px);
  }
  /* Sur mobile chat, montrer sidebar par défaut */
  .chat-sidebar {
    display: flex !important;
    position: relative !important;
    transform: none !important;
    height: calc(100vh - 56px - 64px);
    width: 100%;
  }
  /* Cacher la zone de chat principale si pas de conversation sélectionnée */
  .chat-main { display: none; }
  .chat-main.active { display: flex; }

  /* ——— Page Amis ————————————————————————————————————————— */
  /* Grille cartes amis — 2 par ligne */
  .friends-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ——— Page Groupes ——————————————————————————————————————— */
  /* Grille groupes — 1 colonne sur petit mobile */
  [style*="grid-template-columns:repeat(auto-fill,minmax(260px"] {
    grid-template-columns: 1fr !important;
  }

  /* ——— Profil — grille vue groupe ———————————————————————— */
  [style*="grid-template-columns:1fr 280px"],
  [style*="grid-template-columns: 1fr 280px"] {
    grid-template-columns: 1fr !important;
  }

  /* ——— Onglets profil — scroll horizontal ———————————————— */
  .profile-tabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: .25rem;
  }
  .profile-tabs::-webkit-scrollbar { display: none; }
  .profile-tabs .btn { white-space: nowrap; flex-shrink: 0; }

  /* ——— Padding contenu général ——————————————————————————— */
  .container { padding: 0 .5rem !important; }

  /* Réduire padding-top des pages */
  [style*="padding-top:1.25rem"],
  [style*="padding-top: 1.25rem"] { padding-top: .75rem !important; }
  [style*="padding-top:1.5rem"],
  [style*="padding-top: 1.5rem"]  { padding-top: .75rem !important; }
}

@media (max-width: 480px) {
  /* Grille photos profil — 3 colonnes serrées */
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3,1fr)"] {
    grid-template-columns: repeat(3,1fr) !important;
    gap: .15rem !important;
  }

  /* Amis — 2 colonnes compactes */
  [style*="grid-template-columns:repeat(auto-fill,minmax(200px"] {
    grid-template-columns: repeat(2,1fr) !important;
  }

  /* Suggestions profil — 2 colonnes */
  [style*="grid-template-columns:repeat(auto-fill,minmax(180px"] {
    grid-template-columns: repeat(2,1fr) !important;
  }

  /* Stat grid admin */
  [style*="grid-template-columns:repeat(auto-fill,minmax(190px"] {
    grid-template-columns: repeat(2,1fr) !important;
  }

  /* Post card — réduire encore */
  .post-header { gap: .5rem; padding: .65rem .75rem .5rem; }
  .post-content { padding: 0 .75rem .65rem; }
  .post-stats { padding: .35rem .75rem; }
  .comments-section { padding: 0 .75rem .75rem; }

  /* Boutons onglets profil plus petits */
  .btn-sm { padding: .3rem .65rem; font-size: .78rem; }
}

/* ============================================================
   RESPONSIVE MOBILE
   ============================================================ */

/* ——— Tablette (max 768px) ——————————————————————————————— */
@media (max-width: 768px) {
  .site-header { padding: 0 .75rem; gap: .5rem; height: 56px; }
  .site-header .logo { font-size: 1.2rem; }
  .header-search { max-width: 160px; }
  .header-search input { font-size: .82rem; padding: .35rem .75rem .35rem 2rem; }

  /* Cacher les labels texte nav, garder icônes */
  .nav-btn span { display: none; }
  .nav-btn { min-width: 38px; padding: .35rem .4rem; }
  .nav-btn i { font-size: 1.2rem; }

  /* Cacher sélecteur langue sur tablette */
  .lang-switcher { display: none; }

  .feed-layout {
    grid-template-columns: 1fr;
    padding: .75rem 0;
    gap: .75rem;
  }
  .sidebar-left, .sidebar-right { display: none; }
  .container { padding: 0 .6rem; }
}

/* ——— Mobile (max 480px) ————————————————————————————————— */
@media (max-width: 480px) {
  /* Header compact */
  .site-header { padding: 0 .6rem; gap: .35rem; height: 52px; }
  .site-header .logo { font-size: 1.1rem; }
  .header-search { max-width: 130px; }
  .header-search input { font-size: .8rem; }

  /* Nav encore plus compact */
  .nav-btn { min-width: 34px; padding: .3rem .35rem; }
  .nav-btn i { font-size: 1.15rem; }

  /* Auth */
  .auth-card { padding: 1.5rem 1rem; }
  .auth-logo { font-size: 1.6rem; }

  /* Compositeur de post */
  .post-composer { padding: .85rem .75rem; }
  .post-composer-top { gap: .6rem; }
  .post-composer-textarea { font-size: .9rem; }
  .post-composer-actions { gap: .2rem; flex-wrap: nowrap; }
  .post-action-btn span { display: none; }
  .post-action-btn { padding: .35rem .55rem; }

  /* Post card */
  .post-card { border-radius: 10px; }
  .post-header { padding: .75rem .85rem .6rem; gap: .6rem; }
  .post-header .post-author { font-size: .88rem; }
  .post-content { padding: 0 .85rem .75rem; font-size: .9rem; }
  .post-stats { padding: .4rem .85rem; }

  /* Actions J'aime/Commenter/Partager — texte plus court */
  .post-actions { grid-template-columns: repeat(3,1fr); }
  .post-action { padding: .55rem .3rem; font-size: .78rem; gap: .3rem; }
  .post-action i { font-size: .95rem; }

  /* Commentaires */
  .comments-section { padding: 0 .85rem .85rem; }

  /* Profil */
  .profile-cover { height: 140px; }
  .profile-name { font-size: 1.2rem; }
  .profile-name-row { padding-top: 48px; flex-direction: column; align-items: flex-start; gap: .6rem; }
  .profile-actions { margin-left: 0; }
  .profile-stats { gap: 1rem; }

  /* Chat */
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { position: fixed; left: 0; top: 52px; bottom: 0; width: 85vw; z-index: 500;
                   transform: translateX(-100%); transition: transform .3s; }
  .chat-sidebar.show { transform: translateX(0); }

  /* Modal */
  .modal { border-radius: 16px 16px 0 0; position: fixed; bottom: 0; left: 0; right: 0;
           max-width: 100%; max-height: 92vh; margin: 0; }
  .modal-overlay { align-items: flex-end; }

  /* Sidebar card compacte */
  .sidebar-card { padding: .75rem; }

  /* Feed layout sans gap latéral */
  .container { padding: 0 .4rem; }
  .feed-layout { gap: .6rem; padding: .6rem 0; }

  /* Toast mobile */
  .toast-container { bottom: .75rem; right: .4rem; left: .4rem; }
  .toast { min-width: unset; max-width: 100%; }

  /* Groupes — grille adaptée */
  .groups-grid { grid-template-columns: 1fr 1fr !important; }

  /* Admin responsive */
  .admin-layout { grid-template-columns: 1fr; }
}

/* ——— Très petit (max 360px) ————————————————————————————— */
@media (max-width: 360px) {
  .site-header .logo { font-size: 1rem; }
  .header-search { display: none; }
  .post-action { font-size: .72rem; padding: .5rem .25rem; }
}

/* ——— Menu options post ——————————————————————————————————— */
.post-menu-btn {
  display: flex; align-items: center; gap: .5rem;
  width: 100%; padding: .55rem .9rem;
  background: transparent; border: none;
  color: var(--text); cursor: pointer;
  font-size: .88rem; border-radius: 8px;
  transition: background var(--transition), color var(--transition);
  text-align: left; font-family: var(--font-body);
}
.post-menu-btn:hover { background: var(--bg3); color: var(--primary); }
.post-menu-danger { color: var(--danger) !important; }
.post-menu-danger:hover { background: rgba(255,82,82,.1); color: var(--danger) !important; }

/* Premier bouton action (J'aime) — aligner le picker à gauche */
.post-actions .post-action:first-child .reaction-picker {
  left: 0;
  transform: translateX(0) scale(.85);
  transform-origin: bottom left;
}
.post-actions .post-action:first-child:hover .reaction-picker {
  transform: translateX(0) scale(1);
}

/* ——— Profile grid mobile ——————————————————————————————————— */
@media (max-width: 768px) {
  .profile-content-grid {
    grid-template-columns: 1fr !important;
  }
  .explore-layout {
    grid-template-columns: 1fr !important;
  }
  /* Sur explore mobile, montrer une barre de recherche compacte en haut */
  .explore-sidebar {
    display: none !important;
  }
  /* Ajouter padding mobile chat */
  .chat-input-area { padding: .6rem .75rem; }
  /* Note: chat-messages padding géré dans le bloc chat mobile */
}

.explore-mobile-search { display: none; }
@media (max-width: 768px) {
  .explore-mobile-search { display: block !important; }
}
/* chatInputBar caché par défaut, affiché seulement sur mobile via @media */
#chatInputBar { display: none; }

/* ——— Chat mobile ——————————————————————————————————————————— */
@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: 1fr !important;
    height: calc(100vh - 56px - 64px) !important;
    overflow: hidden !important;
    position: relative !important;
  }
  .chat-sidebar {
    display: flex !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    transform: translateX(0) !important;
    transition: transform .28s !important;
    z-index: 2 !important;
    flex-direction: column !important;
  }
  .chat-sidebar.hidden { transform: translateX(-100%) !important; }
  .chat-main {
    position: absolute !important;
    inset: 0 !important;
    display: none !important;
    flex-direction: column !important;
    z-index: 2 !important;
    overflow: hidden !important;
  }
  .chat-main.active { display: flex !important; }
  .chat-header { flex-shrink: 0 !important; }
  .chat-messages {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 140px !important;
  }
  .chat-input-area { display: none !important; }
  .mob-chat-back { display: block !important; }
  #chatInputBar {
    display: flex !important;
    position: fixed !important;
    bottom: 72px !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1002 !important;
    background: var(--bg2) !important;
    border-top: 1px solid var(--border) !important;
    padding: .6rem .75rem !important;
    gap: .75rem !important;
    align-items: center !important;
    min-height: 56px !important;
  }
  /* Footer caché sur mobile */
  .site-footer { display: none !important; }
}

/* Desktop: chatInputBar caché, chat-input-area visible */
@media (min-width: 769px) {
  #chatInputBar { display: none !important; }
  .chat-input-area { display: flex !important; }
  .chat-main { min-width: 0; overflow: hidden; }
  .chat-messages { min-width: 0; overflow-x: hidden; }
  .message, .message.sent { max-width: 70%; }
}

/* Typing dots */
.typing-dots {
  display: flex; align-items: center; gap: 4px;
  background: var(--card);
  padding: .5rem .8rem;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%; display: block;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}