@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg-main: #06080d;
  --bg-card: rgba(13, 17, 26, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(99, 102, 241, 0.45);
  --accent-primary: #6366f1;
  --accent-hover: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.35);
  --danger-text: #f87171;
}

/* ==================== 4 DYNAMIC ROOM THEMES ==================== */
body.theme-emerald {
  --accent-primary: #10b981;
  --accent-hover: #059669;
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
  --border-active: rgba(16, 185, 129, 0.45);
}

body.theme-cyan {
  --accent-primary: #06b6d4;
  --accent-hover: #0891b2;
  --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #0284c7 50%, #2563eb 100%);
  --border-active: rgba(6, 182, 212, 0.45);
}

body.theme-gold {
  --accent-primary: #f59e0b;
  --accent-hover: #d97706;
  --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
  --border-active: rgba(245, 158, 11, 0.45);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .font-heading {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.03em;
}

.font-mono-num {
  font-family: 'JetBrains Mono', monospace;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease;
}

/* Ambient Backlight */
.bg-ambient {
  position: fixed;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, rgba(139, 92, 246, 0.08) 45%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.glass-surface {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
}

.brand-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 10px;
  filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.5));
  cursor: pointer;
  transition: transform 0.18s ease;
}
.brand-logo-img:active {
  transform: scale(0.9);
}

/* ==================== FULLSCREEN FOCUS MODE ==================== */
.fullscreen-focus {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  max-width: 100% !important;
  height: 100vh !important;
  height: 100dvh !important;
  border-radius: 0 !important;
  border: none !important;
  background: var(--bg-main) !important;
}

/* ==================== PERMANENT FAQ ACCORDION ==================== */
.faq-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  transition: all 0.2s ease;
}
.faq-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), padding 0.3s ease;
}
.faq-item.active .faq-answer {
  max-height: 250px;
  padding-bottom: 1rem;
}
.faq-chevron {
  transition: transform 0.25s ease;
}
.faq-item.active .faq-chevron {
  transform: rotate(180deg);
  color: var(--accent-primary);
}

/* ==================== FILE & PHOTO SHARING ==================== */
.chat-image-preview {
  max-width: 280px;
  max-height: 240px;
  object-fit: cover;
  border-radius: 0.875rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.chat-image-preview:hover {
  transform: scale(1.02);
  filter: brightness(1.08);
}

.file-attachment-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.875rem;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s ease;
}
.file-attachment-card:hover {
  border-color: var(--accent-primary);
}

/* ==================== ROYAL GOLD SOVEREIGN PINNED BANNER ==================== */
@keyframes royalGoldPulse {
  0%, 100% {
    border-color: rgba(245, 158, 11, 0.45);
    box-shadow: 0 4px 20px -2px rgba(245, 158, 11, 0.2), inset 0 1px 0 rgba(251, 191, 36, 0.2);
  }
  50% {
    border-color: rgba(251, 191, 36, 0.85);
    box-shadow: 0 4px 28px 2px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(251, 191, 36, 0.45);
  }
}

.royal-gold-banner {
  background: linear-gradient(135deg, rgba(26, 18, 4, 0.88) 0%, rgba(12, 10, 4, 0.96) 100%);
  border: 1px solid rgba(245, 158, 11, 0.55);
  animation: royalGoldPulse 3.5s ease-in-out infinite;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.2s ease;
}
.royal-gold-banner:hover {
  filter: brightness(1.08);
}

.pin-msg-trigger {
  opacity: 0.45;
  transition: all 0.2s ease;
  cursor: pointer;
}
.pin-msg-trigger:hover {
  opacity: 1;
  transform: scale(1.15);
  color: #fbbf24 !important;
}

/* ==================== HIGH-SPEED FULL SPECTRUM NEON CHROMA (1.5s LOOP) ==================== */
@keyframes highSpeedChromaBorder {
  0%   { border-color: #ff0055; box-shadow: 0 0 20px rgba(255, 0, 85, 0.6), inset 0 0 8px rgba(255, 0, 85, 0.25); }
  14%  { border-color: #ff7700; box-shadow: 0 0 20px rgba(255, 119, 0, 0.6), inset 0 0 8px rgba(255, 119, 0, 0.25); }
  28%  { border-color: #ffee00; box-shadow: 0 0 20px rgba(255, 238, 0, 0.6), inset 0 0 8px rgba(255, 238, 0, 0.25); }
  42%  { border-color: #00ff66; box-shadow: 0 0 20px rgba(0, 255, 102, 0.6), inset 0 0 8px rgba(0, 255, 102, 0.25); }
  57%  { border-color: #00e5ff; box-shadow: 0 0 20px rgba(0, 229, 255, 0.6), inset 0 0 8px rgba(0, 229, 255, 0.25); }
  71%  { border-color: #7b00ff; box-shadow: 0 0 20px rgba(123, 0, 255, 0.6), inset 0 0 8px rgba(123, 0, 255, 0.25); }
  85%  { border-color: #ff00dd; box-shadow: 0 0 20px rgba(255, 0, 221, 0.6), inset 0 0 8px rgba(255, 0, 221, 0.25); }
  100% { border-color: #ff0055; box-shadow: 0 0 20px rgba(255, 0, 85, 0.6), inset 0 0 8px rgba(255, 0, 85, 0.25); }
}

@keyframes highSpeedChromaText {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.admin-neon-badge {
  animation: highSpeedChromaBorder 1.5s linear infinite !important;
  background: rgba(0, 0, 0, 0.75);
  border: 1.5px solid #ff0055;
}

.admin-neon-text {
  background: linear-gradient(90deg, #ff0055, #ff7700, #ffee00, #00ff66, #00e5ff, #7b00ff, #ff00dd, #ff0055);
  background-size: 200% auto;
  color: transparent !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  animation: highSpeedChromaText 1.5s linear infinite !important;
  font-weight: 800;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.admin-bubble-glow {
  animation: highSpeedChromaBorder 1.5s linear infinite !important;
  background: linear-gradient(135deg, rgba(20, 15, 38, 0.95) 0%, rgba(10, 15, 28, 0.98) 100%) !important;
  border: 1.5px solid #ff0055 !important;
  color: #ffffff !important;
}

/* ==================== SECRET WHISPER IN-APP NOTIFICATION POPUP ==================== */
@keyframes whisperSlideIn {
  from {
    transform: translateY(-24px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.whisper-popup-card {
  animation: whisperSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  background: linear-gradient(135deg, rgba(28, 15, 45, 0.95) 0%, rgba(12, 10, 25, 0.98) 100%);
  border: 1.5px solid rgba(168, 85, 247, 0.5);
  box-shadow: 0 16px 40px -4px rgba(168, 85, 247, 0.35), 0 0 20px rgba(168, 85, 247, 0.2);
  backdrop-filter: blur(20px);
}

/* Custom Interactive Dropdowns */
.custom-dropdown-container {
  position: relative;
  width: 100%;
}
.custom-dropdown-trigger {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.custom-dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
}
.custom-dropdown-trigger.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.custom-dropdown-trigger i {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-dropdown-trigger.active i {
  transform: rotate(180deg);
}
.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #0f1422;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.875rem;
  padding: 0.375rem;
  z-index: 60;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.8);
  max-height: 220px;
  overflow-y: auto;
  display: none;
  animation: dropIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.custom-dropdown-menu.show {
  display: block;
}
.custom-dropdown-item {
  padding: 0.75rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}
.custom-dropdown-item:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #ffffff;
}
.custom-dropdown-item.selected {
  background: var(--accent-primary);
  color: #ffffff;
  font-weight: 600;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.btn-primary {
  background: var(--accent-gradient);
  color: white;
  font-weight: 600;
  padding: 0.875rem 1.75rem;
  border-radius: 0.875rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px -2px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px -4px rgba(99, 102, 241, 0.6);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 0.875rem 1.5rem;
  border-radius: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger-outline {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
  padding: 0.45rem 0.85rem;
  border-radius: 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.2s ease;
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
}

.btn-danger-solid {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: 0.75rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}

/* Dialog Modals */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 7, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: fadeInOverlay 0.2s ease forwards;
}
.dialog-card {
  background: #0d111a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  max-width: 480px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  animation: scaleInModal 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleInModal {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.qr-fade-out {
  animation: fadeOutQr 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}
@keyframes fadeOutQr {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.9); }
}

/* Inputs */
.input-premium {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
}
.input-premium:focus {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Chat Messages */
.bubble {
  padding: 0.75rem 1rem;
  border-radius: 1.125rem;
  max-width: 82%;
  word-break: break-word;
  line-height: 1.5;
  font-size: 0.9375rem;
  animation: fadeUpMsg 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.msg-mine {
  align-items: flex-end;
}
.msg-mine .bubble {
  background: var(--accent-gradient);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.msg-peer {
  align-items: flex-start;
}
.msg-peer .bubble {
  background: #151a26;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

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

/* Slot Badges */
.slot-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
}
.slot-occupied {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}
.slot-empty {
  background: rgba(255, 255, 255, 0.02);
  border-style: dashed;
  opacity: 0.55;
}

/* QR Canvas */
#qrcode img, #qrcode canvas {
  margin: 0 auto;
  border-radius: 0.75rem;
  border: 4px solid #ffffff;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

@media (max-width: 768px) {
  .chat-viewport-mobile {
    height: calc(100dvh - 60px) !important;
  }
  .bubble {
    max-width: 90%;
  }
}