/* ============================================
   BOOZLE — Chat & Anonymous Chat Styles
   ============================================ */

/* ---- Chat Page Layout ---- */
.chat-page {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
}

/* ---- Landing State ---- */
.chat-landing {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  background: var(--gradient-hero);
}

.chat-landing-content {
  text-align: center;
  max-width: 550px;
}

.anon-rules {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-2xl);
  text-align: left;
}

.anon-rule {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.anon-rule-icon {
  width: 72px;
  min-width: 72px;
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
}

.anon-rule h4 {
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.anon-rule p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Searching State ---- */
.chat-searching {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--gradient-hero);
}

.searching-rings {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring {
  position: absolute;
  border: 2px solid var(--accent-gold);
  border-radius: 50%;
  opacity: 0;
  animation: ringPulse 2s ease-out infinite;
}

.ring-1 { width: 80px; height: 80px; animation-delay: 0s; }
.ring-2 { width: 130px; height: 130px; animation-delay: 0.5s; }
.ring-3 { width: 180px; height: 180px; animation-delay: 1s; }

@keyframes ringPulse {
  0% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(1.2); opacity: 0; }
}

.searching-icon {
  font-size: 3rem;
  z-index: 2;
  animation: searchBob 1s ease-in-out infinite alternate;
}

@keyframes searchBob {
  from { transform: translateY(-5px); }
  to { transform: translateY(5px); }
}

/* ---- Chat Interface ---- */
.chat-interface {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--nav-height));
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.chat-stranger-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.chat-header-info h3 {
  font-size: 1rem;
  margin-bottom: 1px;
}

.chat-status {
  font-size: 0.8rem;
  color: var(--accent-teal);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-teal);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.chat-header-actions {
  display: flex;
  gap: var(--space-sm);
}

/* ---- Messages ---- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background: var(--bg-primary);
}

.chat-system-msg {
  text-align: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass);
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  color: var(--text-muted);
  align-self: center;
  max-width: 400px;
}

.chat-message {
  display: flex;
  gap: var(--space-sm);
  max-width: 75%;
  animation: msgSlide 0.3s ease;
}

@keyframes msgSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-message.received {
  align-self: flex-start;
}

.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 4px;
}

.chat-message.sent .chat-msg-avatar {
  background: var(--gradient-cta);
}

.chat-message.received .chat-msg-avatar {
  background: var(--gradient-purple);
}

.chat-msg-bubble {
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
}

.chat-message.sent .chat-msg-bubble {
  background: linear-gradient(135deg, rgba(245,166,35,0.2), rgba(232,135,42,0.15));
  border: 1px solid rgba(245,166,35,0.2);
  border-bottom-right-radius: 4px;
  color: var(--text-primary);
}

.chat-message.received .chat-msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.chat-msg-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

.chat-message.received .chat-msg-time {
  text-align: left;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  align-items: center;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ---- Chat Input ---- */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.chat-input {
  width: 100%;
  padding: 12px 48px 12px 18px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-subtle);
  border-radius: 24px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--accent-gold);
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-emoji-btn {
  position: absolute;
  right: 12px;
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.chat-emoji-btn:hover { opacity: 1; }

.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-cta);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  flex-shrink: 0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-send-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-glow-gold);
}

/* ---- Emoji Picker ---- */
.emoji-picker {
  position: absolute;
  bottom: 80px;
  right: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-width: 300px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

.emoji-grid button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.emoji-grid button:hover {
  background: var(--bg-glass-hover);
}

/* ---- Reveal Modal ---- */
.reveal-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.reveal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-3xl);
  text-align: center;
  max-width: 400px;
  animation: matchPop 0.4s ease;
}

/* ---- Secure Match Chat ---- */
.match-chat-page {
  min-height: calc(100vh - var(--nav-height));
  padding: var(--space-xl);
  background:
    radial-gradient(circle at 20% 0%, rgba(245, 166, 35, 0.12), transparent 34rem),
    linear-gradient(180deg, rgba(9, 11, 18, 0.98), var(--bg-primary));
}

.section-kicker {
  margin: 0 0 var(--space-sm);
  color: var(--accent-gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.match-chat-hero {
  width: min(1180px, 100%);
  margin: 0 auto var(--space-lg);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-lg);
  align-items: end;
}

.match-chat-hero h1 {
  margin: 0 0 var(--space-sm);
  font-size: clamp(2rem, 4vw, 4rem);
}

.match-chat-hero p {
  max-width: 680px;
  color: var(--text-secondary);
}

.match-chat-hero .section-kicker {
  color: var(--accent-gold);
}

.secure-chat-card {
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 166, 35, 0.26);
}

.secure-chat-card strong,
.secure-chat-card span {
  display: block;
}

.secure-chat-card strong {
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.secure-chat-card span {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
}

.match-chat-shell {
  width: min(1180px, 100%);
  height: min(760px, calc(100vh - 180px));
  min-height: 620px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(15, 18, 28, 0.92);
  box-shadow: var(--shadow-lg);
}

.match-sidebar {
  min-width: 0;
  padding: var(--space-lg);
  border-right: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.035);
  overflow-y: auto;
}

.match-sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.match-sidebar-head h2 {
  margin: 0 0 2px;
  font-size: 1.25rem;
}

.match-sidebar-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.match-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.match-thread {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: center;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.match-thread.blocked {
  opacity: 0.68;
}

.safety-badge {
  align-self: center;
  border: 1px solid rgba(255, 77, 106, 0.28);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--accent-rose);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.safety-warning {
  border: 1px solid rgba(255, 77, 106, 0.22);
  color: #ffb3bf;
}

.chat-header-actions .danger-action {
  color: var(--accent-rose);
}

.match-thread:hover,
.match-thread.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(245, 166, 35, 0.28);
}

.match-thread:hover {
  transform: translateX(3px);
}

.match-thread img,
.match-active-avatar,
.new-match-avatar img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.match-thread-body {
  min-width: 0;
  display: block;
}

.match-thread-body strong,
.match-thread-body small,
.match-thread-body span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-thread-body strong {
  font-size: 0.95rem;
}

.match-thread-body small {
  color: var(--text-muted);
  font-size: 0.76rem;
  margin: 2px 0;
}

.match-thread-body span {
  color: var(--text-secondary);
  font-size: 0.84rem;
}

.match-thread em {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold);
  color: #111;
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 800;
}

.new-matches-header {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-md);
}

.new-match-bubble {
  flex: 0 0 72px;
  display: grid;
  gap: 6px;
  justify-items: center;
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
  font-size: 0.76rem;
}

.new-match-avatar {
  display: block;
  padding: 3px;
  border-radius: 50%;
  border: 2px solid rgba(245, 166, 35, 0.65);
}

.match-chat-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.match-chat-header {
  background: rgba(16, 24, 40, 0.88);
}

.secure-chat-pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(18, 183, 106, 0.34);
  background: rgba(18, 183, 106, 0.12);
  color: #86efac;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.chat-tool-btn {
  min-width: 72px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.chat-tool-btn:hover {
  border-color: rgba(245, 166, 35, 0.38);
}

.media-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: 0 var(--space-xl);
  background: var(--bg-card);
}

.media-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin-top: var(--space-sm);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.22);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.media-pill button {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  cursor: pointer;
}

.chat-msg-bubble p {
  margin: 0;
}

.chat-attachments {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.chat-attachments img,
.chat-attachments video {
  width: min(260px, 62vw);
  max-height: 280px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  object-fit: cover;
  background: #050608;
}

.chat-lead {
  max-width: 520px;
  margin: var(--space-md) auto var(--space-xl);
  color: var(--text-secondary);
  font-size: 1.04rem;
  line-height: 1.65;
}

.chat-landing-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: center;
}

.chat-landing-actions p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.chat-header-actions .danger {
  color: var(--accent-rose);
}

.reveal-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-xl);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .chat-header { padding: var(--space-sm) var(--space-md); }
  .chat-messages { padding: var(--space-md); }
  .chat-input-bar { padding: var(--space-sm) var(--space-md); }
  .chat-header-actions .btn { padding: 6px 10px; font-size: 0.8rem; }

  .emoji-picker {
    right: var(--space-md);
    left: var(--space-md);
    max-width: none;
  }
}

@media (max-width: 900px) {
  .match-chat-page {
    padding: var(--space-md);
  }

  .match-chat-hero {
    grid-template-columns: 1fr;
  }

  .secure-chat-card {
    padding: var(--space-md);
  }

  .match-chat-shell {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .match-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    max-height: none;
  }

  .match-chat-panel {
    height: min(70svh, 520px);
    min-height: 420px;
  }

  .match-chat-header .chat-header-actions {
    gap: 6px;
  }

  .secure-chat-pill {
    display: none;
    height: 28px;
    padding: 0 9px;
  }

  .chat-tool-btn {
    min-width: 58px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .media-preview-row {
    padding: 0 var(--space-md);
  }
}

@media (max-width: 520px) {
  .match-chat-hero h1 {
    font-size: 2rem;
  }

  .match-sidebar,
  .chat-header {
    padding: var(--space-md);
  }

  .match-chat-panel {
    height: min(68svh, 500px);
    min-height: 360px;
  }

  .chat-header {
    align-items: flex-start;
    gap: var(--space-sm);
    display: grid;
    grid-template-columns: 1fr;
  }

  .chat-header-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .chat-tool-btn {
    flex: 1 1 92px;
    min-width: 0;
  }

  .chat-message {
    max-width: 92%;
  }

  .reveal-card {
    width: min(92vw, 400px);
    padding: var(--space-xl);
  }
}
