/* ================================================================
   BeckhamCC Community — Auth Modal, Reactions, Comments, Nav Menu
   Uses site CSS variables: --bg, --surface, --border, --green,
   --text, --text-muted, --radius
   ================================================================ */

/* ── Fallback variables (if page doesn't define them) ─────────────── */
:root {
  --bcx-bg:      var(--bg,      #0d0d0d);
  --bcx-surface: var(--surface, #1a1a1a);
  --bcx-border:  var(--border,  #2a2a2a);
  --bcx-green:   var(--green,   #00e676);
  --bcx-text:    var(--text,    #f0f0f0);
  --bcx-muted:   var(--text-muted, #888);
  --bcx-radius:  var(--radius,  8px);
}

/* ── Auth Modal ────────────────────────────────────────────────────── */
#bcx-auth-modal {
  background: transparent;
  border: none;
  padding: 0;
  max-width: 100vw;
  max-height: 100dvh;
}

#bcx-auth-modal::backdrop {
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
}

.bcx-modal-box {
  background: var(--bcx-surface);
  border: 1px solid var(--bcx-border);
  border-radius: var(--bcx-radius);
  padding: 2rem;
  width: 380px;
  max-width: 95vw;
  animation: bcx-pop .18s ease;
}

@keyframes bcx-pop {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.bcx-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.bcx-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--bcx-text);
}

.bcx-modal-close {
  background: none;
  border: none;
  color: var(--bcx-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 .25rem;
  transition: color .15s;
}
.bcx-modal-close:hover { color: var(--bcx-text); }

/* Tabs */
.bcx-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--bcx-border);
  padding-bottom: .5rem;
}

.bcx-tab {
  background: none;
  border: none;
  color: var(--bcx-muted);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: 4px;
  transition: color .15s;
}
.bcx-tab:hover { color: var(--bcx-text); }
.bcx-tab.active {
  color: var(--bcx-green);
  font-weight: 600;
}

/* Form */
.bcx-form { display: flex; flex-direction: column; gap: .75rem; }

.bcx-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.bcx-field label {
  font-size: .8rem;
  color: var(--bcx-muted);
  font-weight: 500;
}

.bcx-field input[type="text"],
.bcx-field input[type="email"],
.bcx-field input[type="password"] {
  background: var(--bcx-bg);
  border: 1px solid var(--bcx-border);
  border-radius: 6px;
  color: var(--bcx-text);
  font-size: .9rem;
  padding: .55rem .75rem;
  outline: none;
  transition: border-color .15s;
}
.bcx-field input:focus { border-color: var(--bcx-green); }

.bcx-field-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--bcx-muted);
}
.bcx-field-check input[type="checkbox"] { accent-color: var(--bcx-green); }

.bcx-submit {
  background: var(--bcx-green);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 700;
  padding: .65rem;
  cursor: pointer;
  margin-top: .25rem;
  transition: opacity .15s;
}
.bcx-submit:hover { opacity: .85; }
.bcx-submit:disabled { opacity: .5; cursor: default; }

.bcx-error-msg {
  font-size: .82rem;
  color: #f66;
  min-height: 1.1em;
  text-align: center;
}

/* ── Navbar User Menu ─────────────────────────────────────────────── */
.bcx-signin-btn {
  background: transparent;
  border: 1px solid var(--bcx-green);
  color: var(--bcx-green);
  border-radius: 6px;
  padding: .35rem .8rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.bcx-signin-btn:hover {
  background: var(--bcx-green);
  color: #000;
}

.bcx-user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.bcx-user-trigger {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--bcx-text);
  font-size: .87rem;
  font-weight: 500;
  padding: .25rem .4rem;
  border-radius: 6px;
  transition: background .15s;
}
.bcx-user-trigger:hover { background: rgba(255,255,255,.06); }

.bcx-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bcx-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: var(--bcx-text);
  overflow: hidden;
}
.bcx-avatar img { width: 100%; height: 100%; object-fit: cover; }

.bcx-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bcx-surface);
  border: 1px solid var(--bcx-border);
  border-radius: var(--bcx-radius);
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
  z-index: 9999;
  overflow: hidden;
  display: none;
}
.bcx-dropdown.open { display: block; animation: bcx-pop .15s ease; }

.bcx-dropdown a,
.bcx-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: .65rem 1rem;
  font-size: .87rem;
  color: var(--bcx-text);
  cursor: pointer;
  text-decoration: none;
  transition: background .12s;
}
.bcx-dropdown a:hover,
.bcx-dropdown button:hover { background: rgba(255,255,255,.07); }

.bcx-dropdown .bcx-logout-btn { color: #f66; }

/* ── Reaction Bar ──────────────────────────────────────────────────── */
.bcx-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 0;
}

.bcx-reaction-btn {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--bcx-surface);
  border: 1px solid var(--bcx-border);
  border-radius: 24px;
  padding: .35rem .75rem;
  cursor: pointer;
  font-size: .9rem;
  color: var(--bcx-text);
  transition: border-color .15s, background .15s, transform .1s;
  user-select: none;
}
.bcx-reaction-btn:hover {
  background: rgba(255,255,255,.06);
  transform: scale(1.05);
}
.bcx-reaction-btn.active {
  border-color: var(--bcx-green);
  color: var(--bcx-green);
}
.bcx-reaction-btn .bcx-rxn-count {
  font-size: .82rem;
  font-weight: 600;
  min-width: .8ch;
}

/* ── Comment Section ──────────────────────────────────────────────── */
.bcx-comments {
  margin-top: 2rem;
}

.bcx-comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.25rem;
}

.bcx-comments-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--bcx-text);
}

.bcx-sort-select {
  background: var(--bcx-surface);
  border: 1px solid var(--bcx-border);
  border-radius: 6px;
  color: var(--bcx-text);
  font-size: .82rem;
  padding: .3rem .55rem;
  cursor: pointer;
  outline: none;
}

/* Compose */
.bcx-compose {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.bcx-compose-avatar {
  flex-shrink: 0;
}

.bcx-compose-body { flex: 1; }

.bcx-comment-textarea {
  width: 100%;
  background: var(--bcx-surface);
  border: 1px solid var(--bcx-border);
  border-radius: 8px;
  color: var(--bcx-text);
  font-size: .9rem;
  padding: .65rem .85rem;
  resize: vertical;
  min-height: 70px;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
  font-family: inherit;
}
.bcx-comment-textarea:focus { border-color: var(--bcx-green); }

.bcx-compose-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: .5rem;
}

.bcx-btn-submit-comment {
  background: var(--bcx-green);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 700;
  padding: .45rem 1rem;
  cursor: pointer;
  transition: opacity .15s;
}
.bcx-btn-submit-comment:hover { opacity: .85; }
.bcx-btn-submit-comment:disabled { opacity: .5; cursor: default; }

.bcx-btn-cancel {
  background: none;
  border: 1px solid var(--bcx-border);
  border-radius: 6px;
  color: var(--bcx-muted);
  font-size: .85rem;
  padding: .45rem .8rem;
  cursor: pointer;
}

/* Comment list */
.bcx-comment-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bcx-comment-item {
  display: flex;
  gap: .75rem;
}

.bcx-comment-right { flex: 1; min-width: 0; }

.bcx-comment-meta {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .3rem;
}

.bcx-comment-username {
  font-size: .87rem;
  font-weight: 600;
  color: var(--bcx-text);
}

.bcx-comment-time {
  font-size: .78rem;
  color: var(--bcx-muted);
}

.bcx-comment-body {
  font-size: .88rem;
  color: var(--bcx-text);
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}

.bcx-comment-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .45rem;
}

.bcx-action-btn {
  background: none;
  border: none;
  font-size: .8rem;
  color: var(--bcx-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: .25rem;
  transition: color .15s;
}
.bcx-action-btn:hover { color: var(--bcx-text); }
.bcx-action-btn.liked { color: var(--bcx-green); }

/* Replies */
.bcx-replies {
  margin-top: .75rem;
  padding-left: 1rem;
  border-left: 2px solid var(--bcx-border);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.bcx-toggle-replies {
  background: none;
  border: none;
  color: var(--bcx-green);
  font-size: .82rem;
  cursor: pointer;
  padding: .25rem 0;
  margin-top: .4rem;
}
.bcx-toggle-replies:hover { text-decoration: underline; }

/* Inline reply compose */
.bcx-reply-compose {
  margin-top: .6rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

/* Load more */
.bcx-load-more {
  text-align: center;
  margin-top: 1.25rem;
}

.bcx-btn-load-more {
  background: none;
  border: 1px solid var(--bcx-border);
  border-radius: 20px;
  color: var(--bcx-muted);
  font-size: .85rem;
  padding: .5rem 1.5rem;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.bcx-btn-load-more:hover { border-color: var(--bcx-text); color: var(--bcx-text); }

/* Empty state */
.bcx-empty {
  text-align: center;
  color: var(--bcx-muted);
  font-size: .9rem;
  padding: 2rem 0;
}

/* Spinner */
.bcx-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--bcx-border);
  border-top-color: var(--bcx-green);
  border-radius: 50%;
  display: inline-block;
  animation: bcx-spin .6s linear infinite;
}
@keyframes bcx-spin { to { transform: rotate(360deg); } }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .bcx-modal-box { padding: 1.5rem 1.25rem; width: 100%; }
  #bcx-auth-modal { align-items: flex-end; }
  .bcx-modal-box { border-radius: var(--bcx-radius) var(--bcx-radius) 0 0; }
}
