/* Chess Home – Social/Live layer styles.
 *
 * Covers:
 *   .presence-dot / .is-online   — green dot on avatars
 *   .club-online-chip            — "N online" chip on club cards
 *   .rx-row / .rx-btn            — six-emoji reactions
 *   .comment-item.nested         — one-level threaded replies
 *   .site-search / .search-drop  — header search bar + live dropdown
 *   .playme-dialog               — Play-me modal
 *
 * Palette intentionally reuses --accent* + --border* variables from
 * style.css / zine.css so a theme change stays consistent.
 */

/* ---------- Presence ---------------------------------------------------- */
.avatar-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.avatar-wrap .presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 2px var(--bg, #fff);
  transition: background 120ms ease;
  pointer-events: none;
}
.avatar-wrap.is-online .presence-dot {
  background: #22c55e;  /* Tailwind green-500 */
}
/* "🎙 in room" pill — floats above the avatar on hover. */
.avatar-wrap[data-in-room]::after {
  content: attr(data-in-room);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(20, 20, 30, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 5;
}
.avatar-wrap:hover[data-in-room]::after,
.avatar-wrap:focus-within[data-in-room]::after {
  opacity: 1;
}

/* ---------- "N online" chip on club cards ------------------------------- */
.club-online-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted, #64748b);
}
.club-online-chip .online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;  /* offline gray */
  display: inline-block;
}
[data-club-online-wrap].has-online .online-dot,
.club-online-chip.has-online .online-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

/* ---------- Reactions --------------------------------------------------- */
.rx-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  padding: 4px 12px 6px;
  position: relative;
  border-top: 1px dashed var(--border, #e5e7eb);
  margin-top: 4px;
}
.rx-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--bg-elev, #fff);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  transition: background 100ms ease, border-color 100ms ease, transform 60ms ease;
  color: var(--text, #1f2937);
}
.rx-btn:hover {
  background: var(--accent-soft, #eff6ff);
  border-color: var(--accent, #3b82f6);
}
.rx-btn:active { transform: scale(0.95); }
.rx-btn.is-mine {
  background: var(--accent-soft, #eff6ff);
  border-color: var(--accent, #3b82f6);
  color: var(--accent, #1d4ed8);
  font-weight: 600;
}
.rx-btn.is-zero .rx-count { display: none; }
.rx-emoji { font-size: 13px; line-height: 1; }
.rx-count { font-variant-numeric: tabular-nums; min-width: 6px; font-size: 11px; }

/* --- Compact reaction row for comments (collapsed by default) --- */
.rx-row--compact {
  display: none;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px 0 2px;
  border-top: none;
  margin-top: 0;
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--bg-elev, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 6px 8px;
  z-index: 10;
}
.rx-row--compact.is-open { display: flex; }
.rx-row--compact .rx-btn {
  padding: 3px 6px;
  font-size: 12px;
}
.rx-row--compact .rx-emoji { font-size: 13px; }
.rx-row--compact .rx-hover { display: none; }

/* Trigger button for compact picker */
.rx-trigger {
  background: transparent;
  border: 0;
  padding: 0 4px;
  font: inherit;
  font-size: 12px;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  position: relative;
}
.rx-trigger:hover { color: var(--accent, #3b82f6); }
.rx-trigger .rx-trigger-icon { font-size: 14px; }

/* Wrapper keeps picker positioned relative to trigger */
.rx-trigger-wrap { position: relative; display: inline-block; }

.rx-hover {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 12px;
  right: 12px;
  max-width: 420px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(20, 20, 30, 0.96);
  color: #f8fafc;
  font-size: 12px;
  z-index: 8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}
.rx-hover-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.rx-hover-emoji { font-size: 14px; }
.rx-hover-count { font-weight: 700; min-width: 18px; }
.rx-hover-users { color: #cbd5e1; }

/* ---------- Threaded replies ------------------------------------------- */

/* Scrollable comment list container */
.comment-list {
  max-height: 360px;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-right: 4px;
  margin-bottom: 8px;
}
.comment-list::-webkit-scrollbar {
  width: 6px;
}
.comment-list::-webkit-scrollbar-track {
  background: var(--border, #e5e7eb);
  border-radius: 3px;
}
.comment-list::-webkit-scrollbar-thumb {
  background: var(--text-muted, #94a3b8);
  border-radius: 3px;
}
.comment-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent, #3b82f6);
}

.comment-item .comment-body { padding: 2px 0 4px; }
.comment-item .comment-actions {
  padding: 2px 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.comment-item .comment-reply-btn {
  background: transparent;
  border: 0;
  color: var(--text-muted, #64748b);
  font: inherit;
  font-size: 12px;
  padding: 0;
  cursor: pointer;
}
.comment-item .comment-reply-btn:hover { color: var(--accent, #3b82f6); }

.comment-item .comment-children:empty { display: none; }
.comment-item.nested {
  margin-left: 24px;
  padding-left: 12px;
  border-left: 3px solid var(--border, #e5e7eb);
  margin-top: 6px;
}
.comment-form-nested {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.comment-form-nested input[name="body"] {
  flex: 1;
}

/* ---------- Header search bar + dropdown ------------------------------- */
.site-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 12px;
  flex: 1;
  max-width: 460px;
}
.site-search .site-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.65;
  font-size: 12px;
}
.site-search input[type="search"] {
  width: 100%;
  padding: 7px 12px 7px 30px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  background: var(--bg-elev, #fff);
  color: var(--text, #1f2937);
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
.site-search input[type="search"]:focus {
  outline: none;
  border-color: var(--accent, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.search-drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-elev, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  padding: 6px 0;
  z-index: 40;
  max-height: 60vh;
  overflow-y: auto;
}
.search-drop-section { padding: 4px 0; border-bottom: 1px solid var(--border, #e5e7eb); }
.search-drop-section:last-child { border-bottom: 0; }
.search-drop-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #64748b);
  padding: 4px 12px 2px;
  font-weight: 700;
}
.search-drop-hit {
  display: block;
  padding: 6px 12px;
  color: var(--text, #1f2937);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
}
.search-drop-hit:hover { background: var(--accent-soft, #eff6ff); }
.search-drop-hit strong { font-weight: 600; }
.search-drop-empty { padding: 10px 12px; font-size: 13px; }
.search-drop-footer {
  padding: 6px 12px;
  text-align: center;
  font-size: 12px;
  border-top: 1px solid var(--border, #e5e7eb);
}

/* Full search results page. */
.search-page .page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-inline {
  display: flex;
  gap: 6px;
  align-items: center;
}
.search-inline input[type="search"] {
  padding: 7px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  font: inherit;
  min-width: 260px;
}
.search-section {
  background: var(--bg-elev, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.search-section-title { margin: 0 0 8px; font-size: 15px; }
.search-list { list-style: none; padding: 0; margin: 0; }
.search-hit {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border, #f1f5f9);
  align-items: flex-start;
}
.search-hit:first-child { border-top: 0; }
.search-hit-body { flex: 1; min-width: 0; }

/* ---------- Heart like button (Instagram/Twitter style) ---------------- */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  padding: 8px;
  border-radius: var(--radius-sm, 6px);
  transition: background 0.1s ease, color 0.1s ease;
}
.like-btn:hover {
  background: var(--bg-hover, #f1f5f9);
  color: var(--text, #1f2937);
}
.like-btn .like-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s ease;
}
.like-btn[data-liked="false"] .like-icon {
  color: var(--text-muted, #64748b);
}
.post-actions .like-btn[data-liked="true"],
.post-actions .like-btn.on {
  color: #e0245e;
}
.post-actions .like-btn[data-liked="true"] .like-icon,
.post-actions .like-btn.on .like-icon {
  color: #e0245e;
}
.post-actions .like-btn[data-liked="true"]:hover,
.post-actions .like-btn.on:hover {
  background: rgba(224, 36, 94, 0.1);
  color: #e0245e;
}
.like-btn .like-count-inline {
  font-variant-numeric: tabular-nums;
  min-width: 12px;
}
.like-btn .like-count-inline:empty,
.like-btn .like-count-inline[data-count="0"] {
  display: none;
}

/* Heart pop animation */
.like-btn.pop {
  animation: heart-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.like-btn.pop .like-icon {
  animation: heart-icon-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes heart-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes heart-icon-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* Double-tap heart overlay (Instagram-style) */
.double-tap-heart {
  position: fixed;
  font-size: 64px;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%) scale(0);
  animation: double-tap-heart-anim 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  filter: drop-shadow(0 2px 8px rgba(224, 36, 94, 0.4));
}
@keyframes double-tap-heart-anim {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  15% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0;
  }
}

/* ---------- Play-me modal ---------------------------------------------- */
.playme-mini {
  background: transparent;
  border: 0;
  padding: 0 4px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 100ms ease, transform 100ms ease;
}
.playme-mini:hover { opacity: 1; transform: scale(1.15); }

.profile-cta-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.playme-btn {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.playme-dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  width: min(420px, 92vw);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}
.playme-dialog::backdrop { background: rgba(15, 23, 42, 0.5); }
.playme-body { padding: 18px 20px 20px; }
.playme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.playme-title { font-size: 16px; font-weight: 700; }
.playme-close {
  background: transparent; border: 0; font: inherit; font-size: 16px;
  cursor: pointer; color: var(--text-muted, #64748b);
}
.playme-linkrow {
  display: flex;
  gap: 6px;
  margin: 10px 0;
}
.playme-link {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12.5px;
}
