/* ==================== CHAT WIDGET SYSTEM ==================== */

/* Floating toggle button - anchored bottom-left */
.chat-toggle-btn {
  position: fixed !important;
  z-index: 9999 !important;
  /* fabalign-002: consume the shared FAB tokens (feed defines them in feed.css :root) */
  bottom: var(--fab-b1, calc(20px + env(safe-area-inset-bottom, 0px))) !important;
  left: calc(var(--fab-edge, 20px) + env(safe-area-inset-left, 0px)) !important;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--site-accent);
  color: #000;
  border: 2px solid var(--site-accent) !important;
  font-size: 1.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(var(--site-accent-rgb), 0.6);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.chat-toggle-btn:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 0 26px rgba(var(--site-accent-rgb), 0.9) !important;
}

/* Overlay layer when chat is open */
.chat-layer {
  position: fixed;
  inset: 0;
  z-index: 1150;
  display: grid;
  place-items: center;
  visibility: hidden;
  pointer-events: none;
}

.chat-layer.active {
  visibility: visible;
  pointer-events: auto;
}

.chat-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-layer.active .chat-backdrop {
  opacity: 1;
}

/* Main chat window */
.chat-container {
  position: relative;
  z-index: 1;
  width: min(80vw, 1040px);
  height: min(80dvh, 740px);
  background: rgba(13, 13, 13, 0.985);
  border: 2px solid var(--site-accent);
  border-radius: 4px;
  box-shadow: 0 0 40px rgba(var(--site-accent-rgb), 0.35), inset 0 0 24px rgba(var(--site-accent-rgb), 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.965);
  transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.chat-layer.active .chat-container {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Close button */
.chat-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--site-accent);
  border: 1px solid var(--site-accent);
  cursor: pointer;
  z-index: 5;
  transition: all 0.25s;
}

.chat-close-btn:hover {
  background: var(--site-accent);
  color: #000;
}

/* Header */
.chat-header {
  /* djchip-001 (2026-11-17): 6rem clears the button column
     (chat-max right:54px + 32px = 86px; old 3.5rem = 56px overlapped) */
  padding: 1rem 6rem 1rem 1rem;
  background: color-mix(in srgb, var(--site-accent) 9%, #0d0d0d);
  border-bottom: 1px solid var(--site-accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-header h3 {
  color: var(--site-accent);
  font-size: 1.5rem;
  letter-spacing: 2px;
}

.chat-status {
  color: var(--site-accent);
  font-size: 0.85rem;
  animation: blink calc(var(--pulse-tempo, 4s) * 0.75) infinite;
}

/* Tab navigation */
.chat-tabs {
  display: flex;
  background: color-mix(in srgb, var(--site-accent) 8%, #0d0d0d);
  border-bottom: 1px solid var(--site-accent);
  flex-shrink: 0;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem;
  background: transparent;
  color: var(--site-accent);
  border: none;
  border-right: 1px solid var(--site-accent);
  font-family: 'VT323', monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s;
  min-width: 88px;
  white-space: nowrap;
}

.tab-btn:last-child { border-right: none; }
.tab-btn.active {
  background: var(--site-accent);
  color: #000;
  box-shadow: 0 0 15px rgba(var(--site-accent-rgb), 0.4);
}

/* Tab content area */
.chat-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-pane {
  display: none;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.tab-pane.active { 
  display: flex; 
}

/* Messages scroll area */
.messages-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  background: rgba(0, 10, 0, 0.7);
  scrollbar-width: thin;
  scrollbar-color: var(--site-accent) #0a0a0a;
}

.messages-container::-webkit-scrollbar { 
  width: 8px; 
}
.messages-container::-webkit-scrollbar-track { 
  background: #0a0a0a; 
}
.messages-container::-webkit-scrollbar-thumb {
  background: var(--site-accent);
  border-radius: 4px;
}

/* Individual message */
.message {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-left: 2px solid var(--site-accent);
  background: color-mix(in srgb, var(--site-accent) 4%, #0d0d0d);
  word-break: break-word;
  position: relative;
}

.message.system {
  border-left-color: var(--site-accent);
  background: color-mix(in srgb, var(--site-accent) 3%, #0d0d0d);
}

.message .timestamp { 
  color: var(--text-muted); 
  font-size: 0.8rem; 
  margin-right: 0.5rem; 
}

.message .sender { 
  color: var(--site-accent); 
  font-weight: bold; 
  margin-right: 0.5rem; 
}

.message .msg-text { 
  color: var(--text-primary); 
  letter-spacing: 0.5px; 
}

/* Message actions (likes/pins) */
.msg-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.msg-like {
  background: transparent;
  border: none;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  color: #666;
  font-size: 1.2rem;
  border-radius: 50%;
  transition: all 0.15s ease;
}

.msg-like:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.msg-like.is-liked {
  color: #ff3860;
}

.msg-pin {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #888;
  cursor: pointer;
  border-radius: 4px;
}

.message.pinned {
  background: rgba(var(--site-accent-rgb), 0.05);
  border-left-color: var(--site-accent);
}

.message.pinned .msg-pin {
  background: var(--site-accent);
  color: #000;
}

/* Pinned messages strip at top of public chat */
.pinned-strip {
  display: flex;
  gap: 8px;
  padding: 8px 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--site-accent);
  overflow-x: auto;
  flex-wrap: nowrap;
  max-height: 180px;
}

.pinned-item {
  min-width: 120px;
  max-width: 300px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--site-accent) 6%, #0d0d0d);
  border: 1px solid var(--site-accent);
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.15s;
}

.pinned-item:hover {
  transform: translateY(-2px);
}

/* Chat input form */
.chat-input-form {
  display: flex;
  padding: 1rem;
  background: color-mix(in srgb, var(--site-accent) 8%, #0d0d0d);
  border-top: 1px solid var(--site-accent);
  gap: 0.5rem;
  flex-shrink: 0;
}

.chat-input-form input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem;
  background: var(--bg-secondary);
  color: var(--site-accent);
  border: 1px solid var(--site-accent);
  font-family: 'VT323', monospace;
  font-size: 1rem;
}

.chat-input-form button {
  padding: 0.75rem 1.5rem;
  background: var(--site-accent);
  color: #000;
  border: 1px solid var(--site-accent);
  font-family: 'VT323', monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s;
}

.chat-input-form button:hover {
  background: #000;
  color: var(--site-accent);
}

/* DJ dropdown for staff-only private contacts */
.private-dj-dropdown {
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--site-accent) 8%, #0d0d0d);
  border-bottom: 1px solid var(--site-accent);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.private-dj-dropdown[hidden] {
  display: none !important;
}

.private-dj-dropdown label {
  color: var(--site-accent);
  font-size: 0.9rem;
}

.private-dj-dropdown select {
  flex: 1;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  color: var(--site-accent);
  border: 1px solid var(--site-accent);
  font-family: 'VT323', monospace;
  cursor: pointer;
}

/* Private chat user search panel */
.private-user-panel {
  background: color-mix(in srgb, var(--site-accent) 8%, #0d0d0d);
  border-bottom: 1px solid var(--site-accent);
}

.private-search-box {
  padding: 0.75rem;
  border-bottom: 1px solid var(--site-accent);
}

.private-search-box input {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--bg-secondary);
  color: var(--site-accent);
  border: 1px solid var(--site-accent);
  font-family: 'VT323', monospace;
  font-size: 1rem;
}

/* userlist-001 (2026-11-17): the 320px cage is gone. The style.css
   2540/2795 generations already intended flex:1 fill — but this file
   loaded after them and its max-height:320px re-caged the list
   (exactly 3.2 user rows = guillotined 4th user). Modern law wins:
   fill the column, scroll internally, min-height:0 lets it shrink. */
.private-user-list {
  max-height: none;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--site-accent) #0a0a0a;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(0, 204, 0, 0.2);
}

.user-item:hover {
  background: rgba(var(--site-accent-rgb), 0.15);
}

.user-item.active {
  background: rgba(var(--site-accent-rgb), 0.25);
  border-left: 3px solid var(--site-accent);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #111;
  border: 2px solid var(--site-accent);
}

.user-name {
  color: var(--site-accent);
  font-size: 1.05rem;
}


/* ==================== PROFILE / AUTH TAB ==================== */

/* Tab bar needs to scroll now that there are five tabs */
.chat-tabs {
  overflow-x: auto;
  scrollbar-width: none;              /* ← ADDED */
}
.chat-tabs::-webkit-scrollbar {       /* ← ADDED */
  display: none;
}

#tab-profile {
  overflow-y: auto;
  padding: 16px;
  gap: 14px;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}

.profile-title {
  margin: 0;
  color: var(--site-accent);
  font-size: 1.4rem;
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--site-accent);
}

/* --- login / register switch --- */
.auth-toggle {
  display: flex;
  border: 1px solid var(--site-accent);
}

.auth-mode {
  flex: 1;
  padding: 0.6rem;
  background: transparent;
  color: var(--site-accent);
  border: none;
  border-right: 1px solid var(--site-accent);
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.25s;
}

.auth-mode:last-child { border-right: none; }
.auth-mode:hover { background: rgba(var(--site-accent-rgb), 0.12); }
.auth-mode.active {
  background: var(--site-accent);
  color: #000;
  box-shadow: 0 0 15px rgba(var(--site-accent-rgb), 0.4);
}

/* --- forms --- */
.auth-form {
  display: none;
  flex-direction: column;
  gap: 0.9rem;
}
.auth-form.active { display: flex; }

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--site-accent);
  font-size: 1.15rem;
  letter-spacing: 1px;
}
.auth-form label span { color: #777; font-size: 0.9rem; }

.auth-form input,
.auth-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem;
  background: var(--bg-secondary);
  color: var(--site-accent);
  border: 1px solid var(--site-accent);
  border-radius: 0;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  letter-spacing: 1px;
}
.auth-form input:focus,
.auth-form textarea:focus {
  outline: none;
  box-shadow: 0 0 10px rgba(var(--site-accent-rgb), 0.5);
}
.auth-form input::placeholder,
.auth-form textarea::placeholder { color: #444; }

.auth-form button[type="submit"],
.logout-btn {
  padding: 0.75rem 1.5rem;
  background: var(--site-accent);
  color: #000;
  border: 1px solid var(--site-accent);
  font-family: 'VT323', monospace;
  font-size: 1.05rem;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.25s;
}
.auth-form button[type="submit"]:hover:not(:disabled),
.logout-btn:hover:not(:disabled) {
  background: #000;
  color: var(--site-accent);
  box-shadow: 0 0 15px var(--site-accent);
}
.auth-form button[type="submit"]:disabled,
.logout-btn:disabled { opacity: 0.5; cursor: wait; }

/* --- password change fieldset --- */
/* Without this the <fieldset> renders with default browser chrome
   (grey groove border, light background) inside the dark theme. */
.pw-fieldset {                                    /* ← ADDED */
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem;
  border: 1px dashed rgba(var(--site-accent-rgb), 0.5);
}
.pw-fieldset legend {                             /* ← ADDED */
  padding: 0 0.4rem;
  color: var(--site-accent);
  font-size: 1rem;
  letter-spacing: 1px;
}
.pw-fieldset legend span {                        /* ← ADDED */
  color: #777;
  font-size: 0.85rem;
}

/* --- logged-in header --- */
.profile-header { text-align: center; }
.profile-avatar { font-size: 44px; line-height: 1; display: block; }
.profile-header h2 {
  margin: 0.4rem 0 0.2rem;
  color: var(--site-accent);
  font-size: 1.6rem;
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--site-accent);
}
.profile-meta {                                   /* ← ADDED */
  margin: 0;
  color: #777;
  font-size: 0.95rem;
}

.logout-btn {
  background: transparent;
  color: #ff5577;
  border-color: #ff5577;
}
.logout-btn:hover:not(:disabled) {
  background: #ff5577;
  color: #000;
  box-shadow: 0 0 15px #ff5577;
}

/* --- status text --- */
.form-status {
  margin: 0;
  min-height: 1.1em;
  font-size: 1rem;
  letter-spacing: 1px;
}
.form-status.success { color: #00ff00; }
.form-status.error   { color: #ff5577; }
.form-status.info    { color: #d7b8ff; }

/* --- checkbox rows --- */
/* Keeps the box inline with its label instead of stretching full width */
.checkbox-label {                                 /* ← ADDED */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {          /* ← ADDED */
  accent-color: var(--site-accent);
  width: auto;
  margin: 0;
}

/* --- avatar upload --- */
.avatar-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.avatar-section input[type="file"] {
  font-size: 0.9rem;
  color: #aaa;
}
.field-hint {                                     /* ← ADDED */
  color: #777;
  font-size: 0.8rem;
}
.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--site-accent);
  display: block;
  margin: 0 auto 0.5rem;
}

/* --- gender radios --- */
.gender-fieldset {
  border: 1px solid #333;
  border-radius: 4px;
  padding: 1rem;
  margin: 1rem 0;
}
.gender-fieldset legend {
  color: var(--site-accent);
  font-size: 0.9rem;
  padding: 0 0.5rem;
}
.radio-label {
  display: inline-block;
  margin-right: 1rem;
  cursor: pointer;
  color: #ddd;
  font-size: 0.95rem;
}
.radio-label input[type="radio"] {
  accent-color: var(--site-accent);
  margin-right: 0.35rem;
}

@media (max-width: 520px) {
  #tab-profile { padding: 12px; }
  .tab-btn { min-width: 74px; font-size: 0.9rem; }
}
/* ==========================================================================
   notstamps-001 — public chat timestamps retired (decree 2026-11-17)
   Scope: #tab-public only. Pinned strip unaffected (it reads textContent,
   display:none does not blank it). News / song-req / private keep clocks.
   Restore: delete this block. Backup: chat.css.bak.pre-notstamps-<ts>
   ========================================================================== */
#tab-public .message .timestamp {
  display: none;
}

/* ==========================================================================
   navtheme-001-r2 — chat washes ride --site-accent (decree 2026-11-17)
   Family-kill: EVERY rgba(0,20|30,0,X) converted, tint% = alpha*10.
   Inventory printed in deploy receipt. Scrollbar track #0a0a0a and
   .form-status.success (#00ff00, semantic) exempt.
   Restore: chat.css.bak.pre-navtheme2-<ts>

   notstamps-002 — pinned strip clocks retired (decree 2026-11-17)
   ========================================================================== */
.pinned-time {
  display: none;
}

/* namhide-001 — signed-in users don't type their name */
#chat-name-input[hidden]{display:none!important;}
/* genderhide-001 — gender picked at registration, not in profile */
#settings-form .gender-fieldset{display:none;}

/* ===== chatmaxcss-001 (2026-11-17): chat-max sibling law on chat.css surfaces ===== */
/* .chat-close-btn stature (chat.css:81): 32x32, 1px accent; max stacks beside at right:54px */
#chat-max {
  position: absolute;
  top: 12px;
  right: 54px;
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--site-accent);
  border: 1px solid var(--site-accent);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  transition: all 0.25s;
}
#chat-max:hover { background: var(--site-accent); color: #000; }
