/* ============================================================
   notifications.css – dropdown + page
   ============================================================ */

/* ─── Bell button + badge ────────────────────────────────── */
.notif-btn-wrap {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
  line-height: 1;
}

/* ─── Dropdown panel ─────────────────────────────────────── */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 24px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  z-index: 9999;
  overflow: hidden;
  display: none;
}
.notif-dropdown.open { display: block; }

@media (max-width: 480px) {
  .notif-dropdown {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-dropdown-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}

.notif-read-all-btn {
  font-size: 12px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  font-family: inherit;
}
.notif-read-all-btn:hover { background: var(--primary-glow); }

.notif-dropdown-list {
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.notif-dropdown-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.notif-see-all-btn {
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 12px;
}
.notif-see-all-btn:hover { text-decoration: underline; }

/* ─── Notification item ──────────────────────────────────── */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  text-decoration: none;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-2); }
.notif-item.unread { background: color-mix(in srgb, var(--primary) 6%, var(--bg-card)); }
.notif-item.unread:hover { background: color-mix(in srgb, var(--primary) 10%, var(--bg-2)); }

.notif-unread-dot {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.notif-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-2);
  overflow: hidden;
  flex-shrink: 0;
}
.notif-avatar img { width: 100%; height: 100%; object-fit: cover; }

.notif-type-icon {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--bg-card);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

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

.notif-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
  margin-bottom: 3px;
}
.notif-text b { color: var(--text-1); font-weight: 600; }

.notif-time {
  font-size: 11px;
  color: var(--text-4);
}

/* ─── Empty state ────────────────────────────────────────── */
.notif-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-4);
  font-size: 13px;
}
.notif-empty-icon { font-size: 32px; margin-bottom: 8px; }

/* ─── Loading skeleton ───────────────────────────────────── */
.notif-skeleton {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.notif-skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-2);
  flex-shrink: 0;
  animation: shimmer 1.5s infinite;
}
.notif-skeleton-body { flex: 1; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.notif-skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: var(--bg-2);
  animation: shimmer 1.5s infinite;
}
.notif-skeleton-line.short { width: 40%; }

/* ─── Bell shake animation ──────────────────────────────── */
@keyframes bell-shake {
  0%,100% { transform: rotate(0deg); }
  15%      { transform: rotate(18deg); }
  30%      { transform: rotate(-16deg); }
  45%      { transform: rotate(12deg); }
  60%      { transform: rotate(-8deg); }
  75%      { transform: rotate(4deg); }
}
.notif-bell-shake {
  animation: bell-shake 0.55s ease;
  transform-origin: top center;
  display: inline-block;
}

/* ─── @mention links in comments ────────────────────────── */
.mention-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  padding: 0 2px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.mention-link:hover {
  background: var(--primary-glow);
  color: var(--primary-light);
  text-decoration: underline;
}

/* ─── Notification preview snippet ──────────────────────── */
.notif-preview {
  color: var(--text-4);
  font-weight: 400;
  font-style: italic;
  font-size: 0.92em;
}

/* ─── Toast container ────────────────────────────────────── */
.notif-toast-container {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
  width: calc(100vw - 40px);
}

/* ─── Individual toast ───────────────────────────────────── */
.notif-toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
  overflow: hidden;
  pointer-events: all;
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  transition: transform 0.38s cubic-bezier(0.22,1,0.36,1), opacity 0.28s ease;
}
.notif-toast.show {
  transform: translateX(0);
  opacity: 1;
}
.notif-toast.hide {
  transform: translateX(calc(100% + 32px));
  opacity: 0;
}

.notif-toast-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px 11px;
  cursor: pointer;
}
.notif-toast-inner:hover { background: var(--bg-2); }

.notif-toast-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.notif-toast-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-2);
  overflow: hidden;
}
.notif-toast-avatar img { width: 100%; height: 100%; object-fit: cover; }

.notif-toast-type-icon {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--bg-card);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

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

.notif-toast-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
  margin-bottom: 2px;
}
.notif-toast-text b { color: var(--text-1); font-weight: 600; }

.notif-toast-time {
  font-size: 11px;
  color: var(--text-4);
}

.notif-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-4);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  margin-top: -2px;
  transition: color 0.15s, background 0.15s;
}
.notif-toast-close:hover { color: var(--text-1); background: var(--bg-3); }

/* ─── Progress bar ───────────────────────────────────────── */
.notif-toast-progress {
  height: 3px;
  background: var(--border-subtle);
  overflow: hidden;
}

@keyframes notif-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

.notif-toast-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--primary);
  animation: notif-progress linear forwards;
  transform-origin: left;
}

/* ─── Mobile: toast en bas pleine largeur ────────────────── */
@media (max-width: 480px) {
  .notif-toast-container {
    bottom: 72px; /* au dessus de la bottom nav */
    right: 12px;
    left: 12px;
    width: auto;
  }

  /* Sur mobile, glissement depuis le bas pour éviter le clipping overflow-x */
  .notif-toast {
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.22,1,0.36,1), opacity 0.28s ease;
  }
  .notif-toast.show {
    transform: translateY(0);
    opacity: 1;
  }
  .notif-toast.hide {
    transform: translateY(120%);
    opacity: 0;
  }
}

/* ─── Notifications PAGE ─────────────────────────────────── */
.notifs-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
}
.notifs-page-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-1);
}

.notifs-filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.notifs-filter-tab {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.notifs-filter-tab.active,
.notifs-filter-tab:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.notifs-page-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notif-page-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  margin-bottom: 4px;
}
.notif-page-item:hover { background: var(--bg-2); }
.notif-page-item.unread {
  background: color-mix(in srgb, var(--primary) 7%, var(--bg-card));
  border-color: color-mix(in srgb, var(--primary) 20%, var(--border));
}
.notif-page-item.unread:hover { background: color-mix(in srgb, var(--primary) 12%, var(--bg-2)); }

.notif-page-unread-bar {
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--primary);
}

.notif-page-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  color: var(--text-2);
  overflow: hidden;
  flex-shrink: 0;
}
.notif-page-avatar img { width: 100%; height: 100%; object-fit: cover; }

.notif-page-body { flex: 1; min-width: 0; }
.notif-page-text { font-size: 14px; color: var(--text-2); line-height: 1.5; margin-bottom: 4px; }
.notif-page-text b { color: var(--text-1); font-weight: 600; }
.notif-page-time { font-size: 12px; color: var(--text-4); }

.notif-page-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-4);
}
.notif-page-empty-icon { font-size: 48px; margin-bottom: 12px; }
.notif-page-empty-title { font-size: 18px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.notif-page-empty-text { font-size: 14px; line-height: 1.5; }

/* ============================================================
   SHARED TOPBAR SEARCH RESULTS (topbar-search.js)
   ============================================================ */

/* Labels de section dans les résultats */
.search-results-label {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-4);
  border-bottom: 1px solid var(--border-subtle);
}

/* Message d'état (hint @, aucun résultat) */
.search-type-hint,
.search-no-result {
  padding: 14px;
  text-align: center;
  color: var(--text-4);
  font-size: 13px;
  line-height: 1.4;
}
.search-no-result strong { color: var(--text-2); }

/* Item générique */
.search-result-item {
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-card-hover); }

.search-result-emoji { font-size: 18px; flex-shrink: 0; }

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
}

.search-result-meta {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 2px;
}

/* Item utilisateur (avec avatar circulaire) */
.search-result-user { align-items: center; }

.search-result-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}
.search-result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   MENU ⋮ DROPDOWN (topbar-search.js)
   ============================================================ */

.menu-btn-wrap {
  position: relative;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 9998;
  overflow: hidden;
  display: none;
  animation: menuFadeIn 0.15s ease;
}
.menu-dropdown.open { display: block; }

@media (max-width: 480px) {
  .menu-dropdown {
    position: fixed;
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}

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

.menu-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}
.menu-dd-item:hover {
  background: var(--bg-2);
  color: var(--text-1);
}

.menu-dd-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.menu-dd-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.menu-dd-logout {
  color: var(--error);
}
.menu-dd-logout:hover {
  background: var(--error-glow);
  color: var(--error);
}

/* Bouton ⋮ actif */
#menu-btn.active {
  background: var(--bg-card);
  border-color: rgba(255,255,255,0.12);
  color: var(--primary);
}
