/*
Theme Name: BIH Community
Theme URI: https://bangladeshiinhungary.com
Description: Threads-inspired minimal community portal for Bangladeshi In Hungary
Version: 3.3.0
Author: BIH Community
Text Domain: bih
*/

/* ============================================
   Variables
   ============================================ */
:root {
  --accent:      #006A4E;
  --accent-dark: #004f3a;
  --accent-bg:   #e6f4ef;
  --bg:          #ffffff;
  --surface:     #f9f9f9;
  --border:      #ebebeb;
  --text:        #111111;
  --muted:       #777777;
  --light:       #b0b0b0;
  --rail-w:      220px;
  --feed-max:    620px;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --radius:      12px;
  --tr:          .15s ease;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font-family: var(--font); }

/* ============================================
   App Layout
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

/* ============================================
   Left Rail
   ============================================ */
.rail {
  width: var(--rail-w);
  min-width: var(--rail-w);
  padding: 20px 12px 24px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.rail-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  transition: background var(--tr);
}
.rail-logo:hover { background: var(--surface); }

.logo-mark {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 800;
  flex-shrink: 0;
}

.logo-text { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.3; }
.logo-text small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }

.rail-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }

.rail-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 12px; border-radius: 10px;
  font-size: 15px; font-weight: 500; color: var(--text);
  transition: background var(--tr); cursor: pointer;
  border: none; background: none; width: 100%;
}
.rail-item:hover { background: var(--surface); }
.rail-item.active { font-weight: 700; }
.rail-item .rail-icon { width: 24px; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

.rail-footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  transition: background var(--tr);
}
.user-chip:hover { background: var(--surface); }
.user-chip img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-chip-name { font-size: 13px; font-weight: 700; color: var(--text); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-handle { font-size: 12px; color: var(--muted); display: block; }
.user-chip-info { min-width: 0; }

.rail-logout {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 14px; color: var(--muted);
  transition: all var(--tr); cursor: pointer;
}
.rail-logout:hover { background: var(--surface); color: #c0392b; }

/* ============================================
   Layout Body & Feed
   ============================================ */
.layout-body { flex: 1; min-width: 0; border-right: 1px solid var(--border); }

.feed-wrap { max-width: var(--feed-max); margin: 0 auto; }

.feed-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.feed-header h1 { font-size: 16px; font-weight: 700; }

/* ============================================
   Buttons (global)
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 18px; border-radius: 20px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  border: none; transition: opacity var(--tr);
  font-family: var(--font); text-decoration: none;
}
.btn:hover { opacity: .8; }
.btn-dark { background: var(--text); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-sm { padding: 5px 14px; font-size: 12px; }
.btn-full { display: flex; justify-content: center; width: 100%; padding: 13px 24px; font-size: 15px; }

/* ============================================
   ACTIVITY FEED PAGE
   ============================================ */
#buddypress .activity-list { padding: 0; }

#buddypress .activity-list li {
  list-style: none; border: none;
  border-bottom: 1px solid var(--border);
  padding: 16px; margin: 0;
  background: transparent; box-shadow: none;
  position: relative; display: block;
  transition: background var(--tr);
}
#buddypress .activity-list li:hover { background: #fafafa; }
#buddypress .activity-list li:last-child { border-bottom: none; }

/* Thread layout */
.activity-thread-inner { display: flex; gap: 12px; align-items: flex-start; }

#buddypress .activity-avatar { flex-shrink: 0; position: relative; display: flex; flex-direction: column; align-items: center; }
#buddypress .activity-avatar img,
#buddypress .activity-item .activity-avatar a img { width: 40px !important; height: 40px !important; border-radius: 50%; object-fit: cover; display: block; }

/* Thread connecting line */
.activity-has-comments .activity-avatar::after {
  content: ''; display: block; width: 2px; flex: 1;
  background: var(--border); margin-top: 6px;
  min-height: 24px; border-radius: 2px;
}

.activity-body { flex: 1; min-width: 0; }

#buddypress .activity-header p { font-size: 14px; color: var(--muted); margin: 0 0 4px; line-height: 1.4; }
#buddypress .activity-header p a { font-weight: 700; color: var(--text); }
#buddypress .activity-header p a:hover { color: var(--accent); }
#buddypress .activity-time-since a { font-size: 12px; color: var(--light) !important; font-weight: 400; }

#buddypress .activity-content { margin: 0; padding: 0; }
#buddypress .activity-content p { font-size: 15px; line-height: 1.65; color: var(--text); margin-bottom: 4px; }

/* Action row: ♡ 💬 ↗ */
.activity-actions { display: flex; align-items: center; gap: 22px; margin-top: 12px; }

.act-btn {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; color: var(--muted); cursor: pointer;
  border: none; background: none; padding: 0;
  font-family: var(--font); transition: color var(--tr);
}
.act-btn:hover { color: var(--text); }
.act-btn.liked { color: #e0405e; }
.act-btn svg { transition: transform .15s; }
.act-btn:hover svg { transform: scale(1.15); }

#buddypress .activity-meta { padding: 0; border: none; background: none; }
#buddypress .activity-meta a.button { display: none !important; }

/* Activity comments */
#buddypress .activity-comments {
  margin-top: 12px;
  padding-left: 52px;
}

#buddypress .activity-comments ul { padding: 0; }

#buddypress .activity-comments ul li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0 0; border: none; margin: 0;
  background: transparent; box-shadow: none;
}

#buddypress .activity-comments ul li:hover { background: transparent; }

#buddypress .activity-comments .acomment-avatar img { width: 28px !important; height: 28px !important; border-radius: 50%; }

#buddypress .activity-comments .acomment-meta { font-size: 13px; color: var(--muted); }
#buddypress .activity-comments .acomment-meta a { font-weight: 700; color: var(--text); }
#buddypress .activity-comments .acomment-content { font-size: 14px; line-height: 1.55; margin-top: 2px; }

/* Comment form */
#buddypress .ac-reply-content textarea {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 14px; font-family: var(--font);
  background: var(--surface); resize: none;
  transition: border-color var(--tr), background var(--tr);
}
#buddypress .ac-reply-content textarea:focus {
  outline: none; border-color: var(--text); background: var(--bg);
}

/* Post composer */
#buddypress #whats-new-form,
#buddypress .whats-new-form-header {
  border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; padding: 16px;
  background: transparent; box-shadow: none;
}

#buddypress #whats-new-form textarea,
#buddypress #whats-new {
  border: none !important; border-radius: 0 !important;
  background: transparent !important; padding: 6px 0 !important;
  font-size: 16px !important; font-family: var(--font) !important;
  color: var(--text) !important; resize: none !important;
  min-height: 56px !important; box-shadow: none !important; width: 100% !important;
}
#buddypress #whats-new-form textarea:focus { outline: none !important; }
#buddypress #whats-new-form textarea::placeholder { color: var(--light); }

#buddypress #aw-whats-new-submit,
#buddypress #whats-new-submit {
  padding: 7px 20px !important; background: var(--text) !important;
  color: #fff !important; border: none !important; border-radius: 20px !important;
  font-size: 14px !important; font-weight: 700 !important;
  cursor: pointer !important; font-family: var(--font) !important;
  transition: opacity var(--tr) !important; box-shadow: none !important;
}
#buddypress #aw-whats-new-submit:hover { opacity: .8 !important; }

/* Activity tabs */
#buddypress div.item-list-tabs ul,
#buddypress .activity-type-tabs ul,
#buddypress #subnav ul {
  display: flex; gap: 0; flex-wrap: nowrap;
  overflow-x: auto; padding: 0; margin: 0;
  border-bottom: 1px solid var(--border); scrollbar-width: none;
}
#buddypress div.item-list-tabs ul::-webkit-scrollbar,
#buddypress .activity-type-tabs ul::-webkit-scrollbar { display: none; }

#buddypress div.item-list-tabs ul li a,
#buddypress .activity-type-tabs ul li a,
#buddypress #subnav ul li a {
  display: block; padding: 12px 16px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all var(--tr); white-space: nowrap;
}
#buddypress div.item-list-tabs ul li.selected a,
#buddypress div.item-list-tabs ul li a:hover,
#buddypress .activity-type-tabs ul li.selected a,
#buddypress .activity-type-tabs ul li a:hover,
#buddypress #subnav ul li.current a {
  color: var(--text); font-weight: 700;
  border-bottom-color: var(--text); background: none;
}

/* ============================================
   MEMBER PROFILE PAGE
   ============================================ */

/* Cover photo */
#buddypress #cover-image-container,
#buddypress #header-cover-image {
  position: relative;
  height: 180px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #006A4E 100%);
  overflow: hidden;
}

#buddypress #header-cover-image img {
  width: 100%; height: 100%; object-fit: cover;
}

/* Profile header card */
#buddypress #item-header {
  padding: 0;
  border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; background: transparent;
  box-shadow: none; margin: 0;
}

#buddypress #item-header-content {
  padding: 0 16px 20px;
}

/* Avatar overlapping cover */
#buddypress #item-header #item-header-avatar {
  margin-top: -44px;
  display: inline-block;
  position: relative;
  z-index: 2;
}

#buddypress #item-header #item-header-avatar img,
#buddypress #item-header #item-header-avatar a img {
  width: 86px !important; height: 86px !important;
  border-radius: 50%; object-fit: cover;
  border: 4px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

/* Edit cover / avatar buttons */
#buddypress #item-header .cover-image-add-button,
#buddypress #item-header .bp-user-buttons {
  float: right; margin-top: 12px;
}

/* Profile info */
#buddypress #item-header #item-header-content h2 {
  font-size: 1.25rem; font-weight: 800;
  color: var(--text); margin: 10px 0 2px;
}

#buddypress #item-header-content .profile-handle {
  font-size: 14px; color: var(--muted); margin-bottom: 10px;
}

#buddypress #item-header-content #item-meta {
  font-size: 14px; color: var(--muted); margin-bottom: 12px;
}

/* Profile stats row */
.profile-stats {
  display: flex; gap: 20px; font-size: 14px;
  color: var(--muted); margin-top: 10px;
}
.profile-stats a { color: var(--muted); }
.profile-stats a:hover { color: var(--text); }
.profile-stats strong { color: var(--text); font-weight: 700; }

/* Profile action buttons */
#buddypress #item-header .generic-button a,
#buddypress #item-header .friendship-button,
#buddypress #item-header .send-message-button {
  display: inline-flex !important;
  align-items: center !important;
  padding: 8px 18px !important;
  background: var(--text) !important;
  color: #fff !important; border: none !important;
  border-radius: 20px !important; font-size: 13px !important;
  font-weight: 700 !important; cursor: pointer !important;
  margin-right: 8px; margin-top: 10px;
  font-family: var(--font) !important;
  transition: opacity var(--tr) !important;
}
#buddypress #item-header .generic-button a:hover { opacity: .8 !important; }

#buddypress #item-header .pending a,
#buddypress #item-header .remove_friend a,
#buddypress #item-header .friendship-button.is_friend a {
  background: transparent !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

/* Profile object nav */
#buddypress #object-nav { border-bottom: 1px solid var(--border); }
#buddypress #object-nav ul { display: flex; gap: 0; padding: 0; margin: 0; overflow-x: auto; scrollbar-width: none; }
#buddypress #object-nav ul::-webkit-scrollbar { display: none; }
#buddypress #object-nav ul li a {
  display: block; padding: 12px 18px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all var(--tr); white-space: nowrap; border-radius: 0; background: none;
}
#buddypress #object-nav ul li.current a,
#buddypress #object-nav ul li a:hover {
  color: var(--text); font-weight: 700; border-bottom-color: var(--text); background: none;
}

/* Profile sub-nav */
#buddypress #subnav { border-bottom: 1px solid var(--border); }

/* ============================================
   MEMBERS DIRECTORY PAGE
   ============================================ */

/* Search bar */
#buddypress #members-dir-search,
#buddypress #groups-dir-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

#buddypress #members-dir-search form,
#buddypress #groups-dir-search form {
  display: flex; gap: 8px;
}

#buddypress #members-dir-search input[type=text],
#buddypress #groups-dir-search input[type=text] {
  flex: 1; padding: 9px 14px;
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 14px; background: var(--surface);
  font-family: var(--font);
}

#buddypress #members-dir-search input[type=text]:focus,
#buddypress #groups-dir-search input[type=text]:focus {
  outline: none; border-color: var(--text); background: var(--bg);
}

#buddypress #members-dir-search input[type=submit],
#buddypress #groups-dir-search input[type=submit] {
  padding: 9px 18px !important; border-radius: 20px !important;
  background: var(--text) !important; color: #fff !important;
  border: none !important; font-weight: 700 !important;
  font-size: 14px !important; cursor: pointer !important;
}

/* Members/Groups list */
#buddypress ul.item-list { padding: 0; }

#buddypress ul.item-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border: none;
  border-bottom: 1px solid var(--border);
  margin: 0; background: transparent; box-shadow: none;
  list-style: none; transition: background var(--tr);
}
#buddypress ul.item-list li:hover { background: var(--surface); }
#buddypress ul.item-list li:last-child { border-bottom: none; }

#buddypress ul.item-list .item-avatar img {
  width: 46px !important; height: 46px !important;
  border-radius: 50%; object-fit: cover;
}

#buddypress ul.groups-list .item-avatar img { border-radius: 10px; }

#buddypress ul.item-list .item { flex: 1; min-width: 0; }
#buddypress ul.item-list .item-title a { font-weight: 700; font-size: 15px; color: var(--text); display: block; }
#buddypress ul.item-list .item-title a:hover { color: var(--accent); }
#buddypress ul.item-list .item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
#buddypress ul.item-list .item-desc { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#buddypress ul.item-list .action { flex-shrink: 0; }

/* ============================================
   GROUPS DIRECTORY PAGE
   ============================================ */

/* Create Group button in feed header */
.groups-create-btn { font-size: 13px; font-weight: 700; }

/* Group cover placeholder */
#buddypress .groups-list .item-avatar { flex-shrink: 0; }
#buddypress .groups-list .item-avatar img { width: 52px !important; height: 52px !important; border-radius: 10px; }

#buddypress .groups-list .group-privacy {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted); margin-top: 4px;
  background: var(--surface); padding: 2px 8px; border-radius: 10px;
  border: 1px solid var(--border);
}

/* ============================================
   SINGLE GROUP PAGE
   ============================================ */

/* Group cover */
#buddypress #cover-image-container,
#buddypress .group-cover,
#buddypress #group-cover-image {
  height: 160px;
  background: linear-gradient(135deg, #1a1a2e 0%, #006A4E 100%);
  position: relative; overflow: hidden;
}

#buddypress #cover-image-container img { width: 100%; height: 100%; object-fit: cover; }

/* Group item header */
#buddypress #item-header.group-header {
  padding: 0; border: none; border-bottom: 1px solid var(--border);
}

#buddypress #item-header.group-header #item-header-avatar {
  margin-top: -36px; margin-left: 16px;
  display: inline-block; position: relative; z-index: 2;
}

#buddypress #item-header.group-header #item-header-avatar img {
  width: 72px !important; height: 72px !important;
  border-radius: 12px; border: 4px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

#buddypress #item-header.group-header #item-header-content {
  padding: 10px 16px 18px;
}

#buddypress #item-header.group-header h2 {
  font-size: 1.2rem; font-weight: 800; margin-bottom: 4px;
}

#buddypress #item-header.group-header #item-meta {
  font-size: 13px; color: var(--muted); margin-bottom: 10px; line-height: 1.6;
}

/* Group stats */
.group-stats {
  display: flex; gap: 20px; font-size: 13px;
  color: var(--muted); margin-top: 8px;
}
.group-stats strong { color: var(--text); font-weight: 700; }

/* ============================================
   NOTIFICATIONS PAGE
   ============================================ */

#buddypress #notifications-loop { padding: 0; }

#buddypress table.notifications { width: 100%; border-collapse: collapse; }

#buddypress table.notifications thead { display: none; }

#buddypress table.notifications td,
#buddypress table.notifications tr {
  border: none !important;
  background: transparent;
}

#buddypress table.notifications tbody tr {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border) !important;
  transition: background var(--tr);
}
#buddypress table.notifications tbody tr:hover { background: var(--surface); }
#buddypress table.notifications tbody tr:last-child { border-bottom: none !important; }

#buddypress table.notifications td.notification-description {
  flex: 1;
  font-size: 14px;
  color: var(--text);
}

#buddypress table.notifications td.notification-description a { color: var(--accent); font-weight: 600; }

#buddypress table.notifications td.notification-since {
  font-size: 12px; color: var(--light); white-space: nowrap;
}

#buddypress table.notifications td.notification-actions { flex-shrink: 0; }

/* Unread row */
#buddypress table.notifications tbody tr.unread { background: #f0f7ff; }

/* Notification icon dots */
#buddypress table.notifications tbody tr::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); flex-shrink: 0;
}
#buddypress table.notifications tbody tr.unread::before { background: var(--accent); }

/* Mark all read button */
#buddypress #notifications-bulk-management {
  padding: 10px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center;
}

/* ============================================
   MESSAGES PAGE
   ============================================ */

/* Messages 2-col layout */
#buddypress #message-threads {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 58px);
  overflow: hidden;
}

/* Thread list (left col) */
#buddypress #message-threads-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 0;
}

#buddypress #message-threads-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--tr); list-style: none;
}
#buddypress #message-threads-list li:hover,
#buddypress #message-threads-list li.selected { background: var(--surface); }

#buddypress #message-threads-list .thread-from img {
  width: 42px !important; height: 42px !important;
  border-radius: 50%; object-fit: cover;
}

#buddypress #message-threads-list .thread-info { flex: 1; min-width: 0; }
#buddypress #message-threads-list .thread-from a { font-weight: 700; font-size: 14px; color: var(--text); }
#buddypress #message-threads-list .thread-excerpt { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
#buddypress #message-threads-list .thread-date { font-size: 11px; color: var(--light); white-space: nowrap; margin-top: 2px; }

#buddypress #message-threads-list li.unread .thread-from a { color: var(--text); }
#buddypress #message-threads-list li.unread .thread-excerpt { color: var(--text); font-weight: 600; }

/* Thread conversation (right col) */
#buddypress #message-thread {
  display: flex; flex-direction: column; overflow: hidden;
}

/* Thread header */
#buddypress #message-thread #message-thread-info {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
}

#buddypress #message-thread #message-thread-info h2 { font-size: 15px; font-weight: 700; }

/* Messages scroll area */
#buddypress #message-thread ul.message-list {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
}

#buddypress ul.message-list li { list-style: none; display: flex; gap: 10px; align-items: flex-end; }

#buddypress ul.message-list li.me { flex-direction: row-reverse; }

#buddypress ul.message-list .message-sender img {
  width: 32px !important; height: 32px !important;
  border-radius: 50%; object-fit: cover;
}

/* Message bubble */
#buddypress ul.message-list .message-content {
  max-width: 70%; padding: 10px 14px;
  border-radius: 18px; font-size: 14px; line-height: 1.55;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text);
}

#buddypress ul.message-list li.me .message-content {
  background: var(--text); color: #fff;
  border-color: var(--text); border-radius: 18px 18px 4px 18px;
}

#buddypress ul.message-list li:not(.me) .message-content {
  border-radius: 18px 18px 18px 4px;
}

#buddypress ul.message-list .message-meta {
  font-size: 11px; color: var(--light); margin-top: 4px;
  text-align: right;
}

/* Reply form */
#buddypress #send-reply {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

#buddypress #send-reply #message-subject-container { display: none; }

#buddypress #send-reply textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 24px;
  font-family: var(--font); font-size: 14px;
  resize: none; min-height: 44px; max-height: 140px;
  background: var(--surface); transition: all var(--tr);
}
#buddypress #send-reply textarea:focus {
  outline: none; border-color: var(--text); background: var(--bg);
}

#buddypress #send-reply input[type=submit] {
  padding: 9px 20px !important; border-radius: 20px !important;
  background: var(--text) !important; color: #fff !important;
  border: none !important; font-weight: 700 !important;
  font-size: 14px !important; margin-top: 8px; float: right;
}

/* New message form */
#buddypress #compose-message { padding: 20px 16px; }
#buddypress #compose-message label { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; }

/* ============================================
   REGISTER PAGE
   ============================================ */

.auth-wrap {
  min-height: calc(100vh - 58px);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
}

.auth-card {
  width: 100%; max-width: 420px;
}

.auth-logo {
  width: 44px; height: 44px;
  background: var(--accent); border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 800;
  margin-bottom: 20px;
}

.auth-card h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.auth-card .auth-sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; }
.auth-card .auth-alt { font-size: 14px; color: var(--muted); margin-top: 20px; text-align: center; }
.auth-card .auth-alt a { color: var(--text); font-weight: 700; }

/* BuddyPress register form */
#buddypress #register-page { padding: 0; }
#buddypress #register-page h2 { display: none; }

#buddypress .register-section {
  background: transparent !important;
  border: none !important; padding: 0 !important;
  margin-bottom: 20px !important; border-radius: 0 !important;
}

#buddypress .register-section h3 {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

#buddypress #register-page .field-group { margin-bottom: 16px; }

#buddypress #register-page label {
  font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block;
}

#buddypress #register-page input[type=text],
#buddypress #register-page input[type=email],
#buddypress #register-page input[type=password] {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: var(--font);
  background: var(--surface); color: var(--text);
  transition: all var(--tr);
}

#buddypress #register-page input:focus {
  outline: none; border-color: var(--text); background: var(--bg);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

#buddypress #register-page .field-visibility-settings { display: none; }

#buddypress #register-page #signup_submit {
  width: 100%; padding: 13px !important;
  background: var(--text) !important; color: #fff !important;
  border: none !important; border-radius: 10px !important;
  font-size: 15px !important; font-weight: 700 !important;
  cursor: pointer !important; font-family: var(--font) !important;
  margin-top: 8px;
}

#buddypress #register-page .bp-feedback { margin-bottom: 16px; border-radius: 10px; }

/* ============================================
   LOGIN PAGE (custom page template)
   ============================================ */

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px; background: var(--bg);
}

.login-card { width: 100%; max-width: 400px; }

.login-card .auth-logo { margin-bottom: 24px; }
.login-card h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.login-card .auth-sub { font-size: 14px; color: var(--muted); margin-bottom: 28px; }

.login-form-row { margin-bottom: 14px; }
.login-form-row label { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; }
.login-form-row input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: var(--font);
  background: var(--surface); color: var(--text);
  transition: all var(--tr);
}
.login-form-row input:focus {
  outline: none; border-color: var(--text); background: var(--bg);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

.login-submit {
  width: 100%; padding: 13px;
  background: var(--text); color: #fff;
  border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700;
  cursor: pointer; font-family: var(--font);
  transition: opacity var(--tr); margin-top: 4px;
}
.login-submit:hover { opacity: .85; }

.login-links {
  display: flex; justify-content: space-between;
  font-size: 13px; margin-top: 16px;
}
.login-links a { color: var(--muted); }
.login-links a:hover { color: var(--text); }

.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--light); font-size: 13px; margin: 20px 0;
}
.login-divider::before,
.login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.login-register-link {
  display: flex; justify-content: center; align-items: center;
  gap: 8px; padding: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text);
  transition: background var(--tr); text-align: center;
}
.login-register-link:hover { background: var(--surface); }

/* ============================================
   SETTINGS / ACCOUNT PAGE
   ============================================ */

#buddypress #settings-form,
#buddypress .bp-settings-form { padding: 0; }

.settings-section {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.settings-section-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin-bottom: 16px;
}

#buddypress .bp-setting label {
  font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; color: var(--text);
}

#buddypress .bp-setting input[type=text],
#buddypress .bp-setting input[type=email],
#buddypress .bp-setting input[type=password],
#buddypress .bp-setting textarea,
#buddypress .bp-setting select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 15px; font-family: var(--font);
  background: var(--surface); margin-bottom: 14px;
  transition: all var(--tr);
}

#buddypress .bp-setting input:focus,
#buddypress .bp-setting textarea:focus {
  outline: none; border-color: var(--text); background: var(--bg);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

#buddypress div.save-changes input[type=submit],
#buddypress .bp-settings-submit {
  padding: 10px 24px !important;
  background: var(--text) !important; color: #fff !important;
  border: none !important; border-radius: 20px !important;
  font-size: 14px !important; font-weight: 700 !important;
  cursor: pointer !important; font-family: var(--font) !important;
  transition: opacity var(--tr) !important;
  margin-top: 8px;
}

/* Avatar change button */
#buddypress #avatar-upload-buttons a,
#buddypress .bp-avatar-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--border); color: var(--text);
  transition: background var(--tr);
}
#buddypress #avatar-upload-buttons a:hover { background: var(--surface); }

/* ============================================
   Global BP Buttons
   ============================================ */
#buddypress a.button,
#buddypress input[type=submit],
#buddypress button.submit {
  display: inline-flex !important; align-items: center;
  padding: 7px 18px !important; background: var(--text) !important;
  color: #fff !important; border: none !important; border-radius: 20px !important;
  font-size: 13px !important; font-weight: 700 !important;
  cursor: pointer !important; font-family: var(--font) !important;
  transition: opacity var(--tr) !important;
  text-decoration: none !important; box-shadow: none !important;
}
#buddypress a.button:hover { opacity: .8 !important; }
#buddypress a.button.secondary,
#buddypress a.button.pending {
  background: transparent !important; color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

/* ============================================
   Pagination
   ============================================ */
#buddypress .pagination { padding: 16px; border-top: 1px solid var(--border); }
#buddypress .pagination .pagination-links { display: flex; gap: 4px; justify-content: center; }
#buddypress .pagination-links a,
#buddypress .pagination-links span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: 8px; border: 1px solid var(--border);
  font-size: 13px; color: var(--text); transition: all var(--tr); font-weight: 500;
}
#buddypress .pagination-links a:hover,
#buddypress .pagination-links .current { background: var(--text); color: #fff; border-color: var(--text); }

/* ============================================
   Notices
   ============================================ */
#buddypress div.bp-feedback,
#buddypress div.bp-template-notice {
  padding: 12px 16px; border-radius: 0; margin: 0;
  font-size: 14px; border: none; border-bottom: 1px solid var(--border);
}
#buddypress div.bp-feedback.success { background: #edfdf5; color: #0a6b3e; }
#buddypress div.bp-feedback.error   { background: #fff1f0; color: #c0392b; }
#buddypress div.bp-template-notice  { background: var(--accent-bg); color: var(--accent); }

/* ============================================
   Forms (global)
   ============================================ */
input[type=text], input[type=email], input[type=password],
input[type=search], input[type=url], input[type=tel],
textarea, select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  font-family: var(--font); font-size: 15px; color: var(--text);
  background: var(--surface); transition: all var(--tr);
  appearance: none; -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--text); background: var(--bg);
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-row { margin-bottom: 16px; }

/* ============================================
   GUEST / FRONT PAGE
   ============================================ */
.guest-layout { min-height: 100vh; display: flex; flex-direction: column; }

.guest-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; border-bottom: 1px solid var(--border);
}

.hero {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 64px 24px; text-align: center;
}
.hero-inner { max-width: 480px; }

.hero-logo {
  width: 52px; height: 52px; background: var(--accent);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 800; margin: 0 auto 24px;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3rem); font-weight: 800;
  line-height: 1.1; letter-spacing: -1px; margin-bottom: 14px;
}

.hero p { font-size: 1.05rem; color: var(--muted); line-height: 1.7; margin-bottom: 36px; }

.hero-cta { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto; }
.btn-full { display: flex; align-items: center; justify-content: center; width: 100%; padding: 13px 24px; border-radius: 10px; font-size: 15px; font-weight: 700; font-family: var(--font); cursor: pointer; border: none; transition: opacity var(--tr); }
.btn-full:hover { opacity: .85; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border) !important; }
.btn-outline:hover { background: var(--surface); }

.hero-divider { display: flex; align-items: center; gap: 12px; color: var(--light); font-size: 13px; }
.hero-divider::before, .hero-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.hero-stats { display: flex; justify-content: center; gap: 36px; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.stat-num { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }
.stat-lbl { font-size: 13px; color: var(--muted); margin-top: 2px; }

.guest-footer { padding: 20px 24px; text-align: center; font-size: 12px; color: var(--light); border-top: 1px solid var(--border); }

/* ============================================
   Mobile Bottom Nav
   ============================================ */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: 56px; background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); z-index: 100; align-items: stretch;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: 10px; gap: 3px; transition: color var(--tr);
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--text); }

/* ============================================
   Misc / Utility
   ============================================ */
.page-content { padding: 20px 16px; }
.page-content h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 16px; }
.page-content p { font-size: 15px; line-height: 1.7; color: var(--muted); margin-bottom: 1em; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1000px) {
  .rail { width: 72px; min-width: 72px; padding: 20px 8px; align-items: center; }
  .rail-logo { padding: 10px; }
  .logo-text { display: none; }
  .rail-item { justify-content: center; padding: 12px; gap: 0; }
  .rail-item span:not(.rail-icon) { display: none; }
  .user-chip-info { display: none; }
  .user-chip { padding: 8px; }
  .rail-logout { justify-content: center; padding: 10px; gap: 0; }
  .rail-logout span:not(.rail-icon) { display: none; }
}

@media (max-width: 768px) {
  #buddypress #message-threads {
    grid-template-columns: 1fr;
  }
  #buddypress #message-threads-list { display: none; }
}

@media (max-width: 640px) {
  .rail { display: none; }
  .bottom-nav { display: flex; }
  body { padding-bottom: 56px; }
  .layout-body { border-right: none; }
}



/* ============================================
   BP NOUVEAU OVERRIDES v4 — exact HTML targeting
   ============================================ */

/* ── ACTIVITY COMPOSER: correct IDs ── */
/* form contains #whats-new-avatar + #whats-new-content directly */
#buddypress form#whats-new-form.activity-form {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  gap: 12px !important;
  padding: 14px 16px !important;
  border: none !important;
  background: transparent !important;
}
/* Avatar - ID is #whats-new-avatar, not a class */
#buddypress #whats-new-avatar {
  flex: 0 0 40px !important;
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  padding: 0 !important;
  margin: 0 !important;
}
#buddypress #whats-new-avatar img,
#buddypress #whats-new-avatar a img {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
}
/* Content side */
#buddypress #whats-new-content {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  width: auto !important;
  padding: 0 !important;
}
#buddypress #whats-new-textarea {
  width: 100% !important;
  padding: 0 !important;
}
#buddypress #whats-new-textarea textarea,
#buddypress #whats-new {
  width: 100% !important;
  border: none !important;
  background: transparent !important;
  resize: none !important;
  font-family: var(--font) !important;
  font-size: 16px !important;
  color: var(--text) !important;
  padding: 6px 0 !important;
  min-height: 44px !important;
  box-shadow: none !important;
  outline: none !important;
}

/* ── MEMBERS LIST: correct structure ── */
/* li > div.list-wrap > [div.item-avatar + div.item > div.item-block > [h2 + p + ul.action]] */
#buddypress ul.item-list li {
  display: block !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  float: none !important;
  transition: background .15s !important;
}
#buddypress ul.item-list li:hover { background: var(--surface) !important; }
#buddypress ul.item-list li:last-child { border-bottom: none !important; }

/* list-wrap is the actual flex container */
#buddypress ul.item-list li .list-wrap {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  width: 100% !important;
}

/* Avatar */
#buddypress ul.item-list .item-avatar {
  flex: 0 0 48px !important;
  width: 48px !important;
  height: 48px !important;
  padding: 0 !important;
  margin: 0 !important;
  float: none !important;
}
#buddypress ul.item-list .item-avatar img,
#buddypress ul.item-list .item-avatar a img {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
  float: none !important;
}

/* Item takes remaining space */
#buddypress ul.item-list .item {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  padding: 0 !important;
  float: none !important;
}

/* item-block: CSS grid with name/meta on left, button on right */
#buddypress ul.item-list .item-block {
  display: grid !important;
  grid-template-areas: "name action" "meta action" !important;
  grid-template-columns: 1fr auto !important;
  align-items: center !important;
  column-gap: 12px !important;
  row-gap: 2px !important;
  padding: 0 !important;
}
#buddypress ul.item-list .item-block h2.list-title { grid-area: name !important; margin: 0 !important; font-size: 15px !important; font-weight: 700 !important; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
#buddypress ul.item-list .item-block h2.list-title a { color: var(--text) !important; font-weight: 700 !important; }
#buddypress ul.item-list .item-block p.item-meta,
#buddypress ul.item-list .item-block .last-activity { grid-area: meta !important; font-size: 12px !important; color: var(--muted) !important; margin: 0 !important; padding: 0 !important; white-space: nowrap !important; }
#buddypress ul.item-list .item-block ul.action,
#buddypress ul.item-list .item-block ul.members-meta.action { grid-area: action !important; list-style: none !important; padding: 0 !important; margin: 0 !important; }

/* Buttons inside member cards — BP uses <button> not <a> */
#buddypress ul.item-list .item-block button.friendship-button,
#buddypress ul.item-list .item-block button.add,
#buddypress ul.item-list .item-block .generic-button button,
#buddypress ul.item-list .item-block ul.action a,
#buddypress ul.item-list .item-block ul.action button {
  display: inline-flex !important;
  align-items: center !important;
  padding: 7px 16px !important;
  border: 1px solid var(--border) !important;
  border-radius: 20px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  background: transparent !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  font-family: var(--font) !important;
  box-shadow: none !important;
  transition: background .15s !important;
}
#buddypress ul.item-list .item-block ul.action button:hover { background: var(--surface) !important; }
#buddypress ul.item-list .item-block ul.action button.is_friend { background: var(--surface) !important; }
