/* =====================================================
   Wordsmithery Extra Components CSS
   Purpose: Styles for notifications, AI chat threads,
   friend button states, and message modal.
   ===================================================== */

/* ── Notification Bell ────────────────────────────── */
.notif-bell-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  background: none;
  border: none;
  border-left: 1px solid var(--border, #c9b58c);
  cursor: pointer;
  position: relative;
  font-family: var(--font-serif, 'Merriweather', serif);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink, #2b2318);
  min-width: 50px;
}
.notif-bell-btn .icon {
  width: 22px;
  height: 22px;
  display: block;
}
.notif-bell-btn svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}
.notif-bell-btn:hover {
  background: var(--bg-alt, #efe6d2);
}
.notif-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  background: var(--danger, #b3432f);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  pointer-events: none;
}

/* ── Notification Panel ───────────────────────────── */
.notif-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-height: 420px;
  background: var(--surface, #fff);
  border: 2px solid var(--border, #c8b291);
  border-radius: var(--radius-md, 12px);
  box-shadow: var(--shadow-deep, 0 8px 26px rgba(33,25,18,.28));
  z-index: 10100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #c8b291);
  background: var(--surface-soft, #fbf7ef);
}
.notif-panel-header h4 {
  margin: 0;
  font-family: var(--font-script, 'Great Vibes', cursive);
  font-size: 1.4rem;
  color: var(--accent, #9c623b);
}
.notif-read-all {
  background: none;
  border: none;
  font-size: 0.78rem;
  color: var(--accent, #9c623b);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-serif, 'Merriweather', serif);
  padding: 4px 8px;
  border-radius: var(--radius-sm, 6px);
}
.notif-read-all:hover {
  background: var(--bg-alt, #efe6d2);
}
.notif-panel-list {
  overflow-y: auto;
  flex: 1;
  max-height: 360px;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border, #c8b291);
  transition: background var(--transition-fast, 120ms);
}
.notif-item:hover {
  background: var(--bg-alt, #efe6d2);
}
.notif-item.unread {
  background: var(--highlight, #f2e6c7);
}
.notif-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}
.notif-content {
  flex: 1;
  min-width: 0;
}
.notif-title {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--ink, #2c261d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-time {
  font-size: 0.72rem;
  color: var(--ink-faint, #9b8b78);
  margin-top: 2px;
}
.notif-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--ink-muted, #6e5f4f);
  font-style: italic;
  font-size: 0.9rem;
}

/* ── Friend Button States ─────────────────────────── */
.friend-btn {
  font-family: var(--font-serif, 'Merriweather', serif);
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-pill, 999px);
  border: 2px solid var(--border-strong, #b39568);
  background: var(--surface, #fff);
  color: var(--ink, #2c261d);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition-fast, 120ms);
}
.friend-btn:hover {
  background: var(--accent, #9c623b);
  color: var(--accent-contrast, #fff9f1);
  border-color: var(--accent, #9c623b);
}
.friend-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}
.friend-btn.is-friend {
  background: var(--success, #4b7c4f);
  color: #fff;
  border-color: var(--success, #4b7c4f);
}
.friend-btn.is-friend:hover {
  background: var(--danger, #b3432f);
  border-color: var(--danger, #b3432f);
}
.friend-btn.is-pending {
  background: var(--surface-2, #e9dcc7);
  color: var(--ink-muted, #6e5f4f);
  border-color: var(--border, #c8b291);
  cursor: default;
}
.friend-btn.is-received {
  background: var(--accent, #9c623b);
  color: var(--accent-contrast, #fff9f1);
  border-color: var(--accent, #9c623b);
  animation: pulse-glow 1.5s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(156,98,59,.4); }
  50% { box-shadow: 0 0 0 6px rgba(156,98,59,0); }
}

/* ── AI Chat Thread Bar ───────────────────────────── */
.thread-bar {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-soft, #fbf7ef);
  border-bottom: 1px solid var(--border, #c8b291);
  border-radius: var(--radius-md, 12px) var(--radius-md, 12px) 0 0;
}
.thread-toggle {
  background: none;
  border: 1px solid var(--border, #c8b291);
  border-radius: var(--radius-sm, 6px);
  padding: 4px 10px;
  font-family: var(--font-serif, 'Merriweather', serif);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink, #2c261d);
  cursor: pointer;
  transition: background var(--transition-fast, 120ms);
}
.thread-toggle:hover {
  background: var(--bg-alt, #efe6d2);
}
.thread-new-btn {
  background: var(--accent, #9c623b);
  color: var(--accent-contrast, #fff9f1);
  border: none;
  border-radius: var(--radius-sm, 6px);
  padding: 4px 12px;
  font-family: var(--font-serif, 'Merriweather', serif);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: auto;
  transition: background var(--transition-fast, 120ms);
}
.thread-new-btn:hover {
  background: var(--accent-hover, #b56d40);
}

/* ── Thread Panel ─────────────────────────────────── */
.thread-panel {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #c8b291);
  border-radius: var(--radius-md, 12px);
  margin: 0 0 8px;
  overflow: hidden;
  max-height: 220px;
}
.thread-panel-header {
  padding: 8px 12px;
  background: var(--surface-soft, #fbf7ef);
  border-bottom: 1px solid var(--border, #c8b291);
  font-family: var(--font-serif, 'Merriweather', serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent, #9c623b);
}
.thread-list {
  overflow-y: auto;
  max-height: 170px;
}
.thread-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--bg-alt, #efe6d2);
  transition: background var(--transition-fast, 120ms);
}
.thread-item:hover {
  background: var(--bg-alt, #efe6d2);
}
.thread-item.active {
  background: var(--highlight, #f2e6c7);
  border-left: 3px solid var(--accent, #9c623b);
}
.thread-title {
  flex: 1;
  font-size: 0.82rem;
  color: var(--ink, #2c261d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-serif, 'Merriweather', serif);
}
.thread-delete {
  background: none;
  border: none;
  color: var(--ink-faint, #9b8b78);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color var(--transition-fast, 120ms);
}
.thread-delete:hover {
  color: var(--danger, #b3432f);
  background: rgba(179,67,47,.1);
}
.thread-empty {
  padding: 16px;
  text-align: center;
  color: var(--ink-muted, #6e5f4f);
  font-style: italic;
  font-size: 0.85rem;
}

/* ── Search result links ──────────────────────────── */
.post-result-link {
  display: block;
  padding: 4px 0;
  transition: color var(--transition-fast, 120ms);
}
.post-result-link:hover strong {
  color: var(--accent, #9c623b);
}

/* ── Reaction chip states ─────────────────────────── */
.reaction-chip.user-reacted {
  border: 2px solid var(--accent, #9c623b);
  background: var(--highlight, #f2e6c7);
}

/* ── Dark mode overrides ──────────────────────────── */
body.dark-mode .notif-panel {
  background: var(--surface, #2a2520);
  border-color: var(--border, #5a4f3e);
}
body.dark-mode .notif-item.unread {
  background: rgba(156,98,59,.15);
}
body.dark-mode .thread-panel {
  background: var(--surface, #2a2520);
  border-color: var(--border, #5a4f3e);
}
body.dark-mode .thread-bar {
  background: var(--surface-soft, #332d27);
}
body.dark-mode .thread-item.active {
  background: rgba(156,98,59,.2);
}

/* ── Mobile responsiveness ────────────────────────── */
@media (max-width: 480px) {
  .notif-panel {
    width: calc(100vw - 20px);
    right: -40px;
  }
}
