/* ==========================================================================
   AŞIK VESTEL // DISCORD WEB-TO-DISCORD LIVE CHAT BRIDGE STYLES
   ========================================================================== */

.chat-wrapper {
  max-width: 1040px;
  margin: 100px auto 40px;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  min-height: 580px;
}

.chat-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(12px);
}

/* Chat Header */
.chat-header {
  padding: 1rem 1.5rem;
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.chat-channel-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-channel-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: var(--accent-fuchsia);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
}

.chat-channel-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-channel-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-pure);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-channel-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.chat-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-emerald);
}

.chat-status-pill.offline {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.25);
  color: var(--accent-rose);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: chatPulse 2s infinite;
}

.chat-status-pill.offline .pulse-dot {
  background: var(--accent-rose);
  box-shadow: none;
  animation: none;
}

@keyframes chatPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Chat Channel Navigation Switcher */
.chat-channel-nav {
  display: flex;
  align-items: center;
  background: rgba(15, 18, 26, 0.8);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  gap: 4px;
}

.chat-channel-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
}

.chat-channel-btn:hover:not(.active) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.chat-channel-btn.active {
  background: rgba(168, 85, 247, 0.18);
  color: #ffffff;
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 2px 12px rgba(168, 85, 247, 0.25);
}

.chat-channel-btn .channel-hash {
  color: var(--accent-fuchsia);
  font-weight: 800;
  font-size: 0.95rem;
}

.chat-channel-btn.active .channel-hash {
  color: #f0abfc;
}

.chat-channel-btn .channel-guild-tag {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-tertiary);
  margin-left: 2px;
}

.chat-channel-btn.active .channel-guild-tag {
  background: rgba(168, 85, 247, 0.35);
  color: #fae8ff;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* User Identity Bar */
.chat-user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 6px;
  background: var(--bg-surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}

.chat-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Main View & Gate Utilities */
.chat-main-view {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.chat-main-view.hidden,
.chat-gate.hidden {
  display: none !important;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Message Item */
.chat-msg-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.25s ease;
  position: relative;
}

.chat-msg-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.chat-msg-highlight {
  animation: chatMsgFlash 2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes chatMsgFlash {
  0% {
    background: rgba(168, 85, 247, 0.3);
  }
  100% {
    background: transparent;
  }
}

/* Reply Banner (Discord style) */
.chat-reply-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-left: 24px;
  margin-bottom: 2px;
  cursor: pointer;
  user-select: none;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.chat-reply-banner:hover {
  color: var(--text-pure);
}

.chat-reply-banner:hover .chat-reply-author {
  text-decoration: underline;
}

.chat-reply-icon {
  flex-shrink: 0;
  opacity: 0.7;
  color: var(--accent-fuchsia);
  transform: rotate(0deg);
}

.chat-reply-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.chat-reply-author {
  font-weight: 600;
  color: var(--accent-fuchsia);
  flex-shrink: 0;
  font-size: 0.82rem;
}

.chat-reply-content {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.chat-reply-badge {
  font-size: 0.85em;
  margin-right: 2px;
}

.chat-msg-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.chat-msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-surface-3);
  border: 1px solid var(--border-subtle);
}

.chat-msg-content-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-msg-author {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-pure);
}

.chat-badge {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.chat-badge.webhook {
  background: rgba(168, 85, 247, 0.2);
  color: var(--accent-fuchsia);
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.chat-badge.bot {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.chat-msg-time {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.chat-msg-text {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
  white-space: pre-wrap;
}

.chat-msg-text a {
  color: var(--accent-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
.chat-msg-text a:hover {
  color: #7dd3fc;
}

/* Discord-style Mention Highlight */
.chat-mention {
  display: inline-flex;
  align-items: center;
  background: rgba(168, 85, 247, 0.2);
  color: #f0abfc;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(168, 85, 247, 0.35);
  font-size: 0.9em;
  line-height: 1.3;
  margin: 0 2px;
  user-select: none;
  transition: all 0.15s ease;
}

.chat-mention:hover {
  background: rgba(168, 85, 247, 0.35);
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

/* Media & GIF Embedding */
.chat-media-grid,
.chat-msg-attachments {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
}

.chat-media-card {
  display: inline-block;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-surface-3);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  max-width: 420px;
  max-height: 340px;
}

.chat-media-card:hover {
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 12px rgba(168, 85, 247, 0.2);
  transform: translateY(-1px);
}

.chat-embedded-media,
.chat-attachment-img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: inherit;
}

/* Discord Stickers */
.chat-stickers-grid {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-sticker-wrap {
  display: inline-block;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chat-sticker-wrap:hover {
  transform: scale(1.08);
}

.chat-sticker-img {
  display: block;
  max-width: 160px;
  max-height: 160px;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
}

/* GIFV Badge & Styling */
.chat-media-gifv {
  position: relative;
}

.chat-gif-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Input Bar */
.chat-input-bar {
  padding: 1rem 1.25rem;
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-input-field {
  flex: 1;
  background: var(--bg-surface-3);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: none;
  height: 48px;
  min-height: 48px;
  max-height: 120px;
}

.chat-input-field:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.chat-send-btn {
  height: 48px;
  padding: 0 1.25rem;
  background: var(--gradient-btn-primary);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--gradient-btn-primary-hover);
  transform: translateY(-1px);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  padding: 0 4px;
}

/* Gated Access Screen */
.chat-gate {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  background: radial-gradient(circle at 50% 35%, rgba(124, 58, 237, 0.08) 0%, transparent 70%);
}

.chat-gate-card {
  max-width: 480px;
  width: 100%;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
}

.chat-gate-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 101, 242, 0.12);
  border: 1px solid rgba(88, 101, 242, 0.35);
  color: #5865F2;
}

.chat-gate-icon-wrap.denied {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
  color: var(--accent-rose);
}

.chat-gate-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-pure);
  margin: 0;
}

.chat-gate-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.chat-gate-desc strong {
  color: var(--text-pure);
}

.chat-gate-alert {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fca5a5;
  font-size: 0.8rem;
  font-weight: 500;
}

.chat-gate-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  flex-direction: column;
}

.btn-discord {
  background: #5865F2;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.92rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
}

.btn-discord:hover {
  background: #4752C4;
  transform: translateY(-1px);
}

.btn-outline-gate {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-outline-gate:hover {
  background: var(--bg-surface-3);
  color: var(--text-pure);
  border-color: var(--border-strong);
}

.chat-badge.av2 {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent-emerald);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Floating Chat Quick Toggle (for all site pages) */
.floating-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gradient-btn-primary);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.45);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 990;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

.floating-chat-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 12px 30px rgba(168, 85, 247, 0.6);
}

@media (max-width: 768px) {
  .chat-wrapper {
    margin-top: 80px;
    height: calc(100vh - 100px);
    padding: 0 0.5rem;
  }
  .chat-header {
    padding: 0.75rem 1rem;
  }
  .chat-channel-desc {
    display: none;
  }
}
