/* ═══════════════════════════════════════════════════════
   CHAT — Menoris Cloud
   Name-entry + real-time message bubbles
   ═══════════════════════════════════════════════════════ */

/* ── Chat Page ──────────────────────────────────── */
.chat-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 60px);
  padding: 20px 12px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* ═══════════════════════════════════════════════════
   JOIN SCREEN
   ═══════════════════════════════════════════════════ */

.chat-join {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
}

.chat-join-card {
  background: var(--glass);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 48px 32px 36px;
  text-align: center;
  max-width: 420px;
  width: 100%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  animation: chatJoinIn 0.5s ease;
}

@keyframes chatJoinIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-join-icon {
  font-size: 56px;
  margin-bottom: 12px;
  animation: chatIconFloat 3s ease-in-out infinite;
}

@keyframes chatIconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.chat-join-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: 30px;
  color: var(--text);
  margin-bottom: 6px;
  text-shadow: 0 0 20px rgba(139,92,246,0.4);
}

.chat-join-sub {
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 24px;
  line-height: 1.5;
}

.chat-join-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 16px;
  text-align: center;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-join-input:focus {
  border-color: rgba(139,92,246,0.5);
  box-shadow: 0 0 20px rgba(139,92,246,0.15);
}

.chat-join-input::placeholder {
  color: var(--text3);
}

.chat-join-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, filter 0.2s;
}

.chat-join-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.chat-join-btn:active {
  transform: translateY(0);
}

.chat-join-error {
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 10px;
  min-height: 20px;
}

/* ═══════════════════════════════════════════════════
   CHAT WINDOW
   ═══════════════════════════════════════════════════ */

.chat-window {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  height: calc(100dvh - 100px);
  max-height: 700px;
  background: var(--glass);
  border: 1px solid var(--border2);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-back {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: 'Nunito', system-ui, sans-serif;
  transition: all 0.2s;
}

.chat-header-back:hover {
  background: var(--glass2);
  color: var(--text);
}

.chat-header-title {
  flex: 1;
  font-family: 'Luckiest Guy', cursive;
  font-size: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74,222,128,0.5);
  animation: chatDotPulse 2s ease-in-out infinite;
}

@keyframes chatDotPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(74,222,128,0.4); }
  50% { box-shadow: 0 0 14px rgba(74,222,128,0.7); }
}

.chat-header-count {
  font-size: 12px;
  color: var(--text3);
}

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

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 14px;
  text-align: center;
  gap: 10px;
  line-height: 1.6;
}

.chat-empty-icon {
  font-size: 40px;
  opacity: 0.6;
}

/* Message bubble */
.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 85%;
  animation: chatMsgIn 0.3s ease;
}

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

.chat-msg-me {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.chat-msg-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-msg-me .chat-msg-body {
  align-items: flex-end;
}

.chat-msg-name {
  font-size: 11px;
  font-weight: 700;
  padding: 0 4px;
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
}

.chat-msg-me .chat-msg-bubble {
  background: linear-gradient(135deg, rgba(108,92,231,0.3), rgba(162,155,254,0.2));
  border-color: rgba(139,92,246,0.25);
  border-bottom-right-radius: 6px;
}

.chat-msg:not(.chat-msg-me) .chat-msg-bubble {
  border-bottom-left-radius: 6px;
}

.chat-msg-time {
  font-size: 10px;
  color: var(--text3);
  padding: 0 4px;
  margin-top: 1px;
}

/* Input bar */
.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: rgba(139,92,246,0.5);
}

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

.chat-send-btn {
  padding: 12px 20px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  filter: brightness(1.15);
}

/* ═══════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .chat-join-card {
    padding: 32px 20px 28px;
    border-radius: 16px;
  }
  .chat-join-icon { font-size: 42px; }
  .chat-join-title { font-size: 24px; }
  .chat-window {
    height: calc(100dvh - 80px);
    max-height: none;
    border-radius: 12px;
  }
  .chat-msg { max-width: 90%; }
  .chat-msg-avatar { width: 28px; height: 28px; font-size: 11px; }
  .chat-msg-bubble { font-size: 13px; padding: 8px 12px; }
}
