/* ---- Design tokens ----
   Background:  #0B0B12  (near-black, cool)
   Surface:     #15151F
   Line:        #26263A
   Text:        #F1F0F6
   Text-dim:    #8C8AA0
   Accent A:    #FF3D77  (signal magenta — "live" cue)
   Accent B:    #35E7C6  (signal cyan — secondary cue)
   Display font: Space Grotesk / Body font: Inter
------------------------------------------------ */

* { box-sizing: border-box; }

:root {
  --bg: #0B0B12;
  --surface: #15151F;
  --surface-2: #1B1B28;
  --line: #26263A;
  --text: #F1F0F6;
  --text-dim: #8C8AA0;
  --accent: #FF3D77;
  --accent-2: #35E7C6;
  --radius: 14px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100%;
  overflow-x: hidden;
  width: 100%;
}

.hidden { display: none !important; }

/* ---------- Auth page ---------- */

.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  pointer-events: none;
}
.glow-orb-a { background: var(--accent); top: -160px; left: -120px; }
.glow-orb-b { background: var(--accent-2); bottom: -180px; right: -140px; }

.auth-card {
  position: relative;
  z-index: 1;
  width: calc(100% - 32px);
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px 32px;
  box-shadow: 0 40px 80px -30px rgba(0,0,0,0.6);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 28px;
}
.brand.small { font-size: 1rem; margin-bottom: 24px; }
.brand-mark {
  color: var(--accent);
  font-size: 0.6rem;
  filter: drop-shadow(0 0 6px var(--accent));
}
.brand-dot { color: var(--accent-2); }

.seo-heading {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.3;
}
.seo-copy {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0 0 22px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 9px 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab.active {
  background: var(--bg);
  color: var(--text);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.82rem; color: var(--text-dim); }
.field input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus { border-color: var(--accent); }

.hint { font-size: 0.78rem; color: var(--text-dim); margin: -6px 0 0; }

.remember { border: none; padding: 0; margin: 0; }
.remember legend { font-size: 0.82rem; color: var(--text-dim); padding: 0 0 8px; }
.remember { display: flex; flex-direction: column; }
.remember > .pill:first-of-type { margin-top: 0; }

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  padding: 4px 0;
  cursor: pointer;
  color: var(--text-dim);
}
.pill input { accent-color: var(--accent); }
.pill input:checked + span { color: var(--text); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #FF7A9E);
  color: #14040B;
  border: none;
  border-radius: 10px;
  padding: 12px 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(255, 61, 119, 0.6);
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -8px rgba(255, 61, 119, 0.75); }
.btn-primary:active { transform: translateY(0); }

.form-msg { min-height: 18px; font-size: 0.8rem; color: var(--accent); margin: 0; }

/* ---------- App / rooms page ---------- */

.app-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  overflow: hidden;
}

.room-rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
}

.room-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; flex: 1; }

.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.room-item:hover { background: var(--surface-2); color: var(--text); }
.room-item.active {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}
.room-item.active .room-dot { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.room-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex-shrink: 0; }

.rail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.me { font-weight: 600; color: var(--text); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }

.chat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  flex-shrink: 0;
}
.room-title { font-weight: 700; font-size: 1.05rem; }
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  margin-left: auto;
  animation: pulse 1.6s ease-in-out infinite;
}
.live-label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg { display: flex; flex-direction: column; max-width: 62%; align-self: flex-start; }
.msg.own { align-self: flex-end; align-items: flex-end; }
.msg-meta { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 3px; }
.msg-bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 9px 13px;
  font-size: 0.92rem;
  line-height: 1.4;
  word-break: break-word;
}
.msg.own .msg-bubble { background: linear-gradient(135deg, var(--accent), #C22B5B); border-color: transparent; color: #16050B; }
.msg-bubble img { max-width: 220px; max-height: 260px; object-fit: cover; border-radius: 10px; display: block; margin-top: 4px; }

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  position: relative;
  flex-shrink: 0;
}
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 40px; height: 40px;
  font-size: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.icon-btn:hover { border-color: var(--accent); }

#message-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  outline: none;
}
#message-input:focus { border-color: var(--accent); }

.send-btn { padding: 11px 20px; }

.emoji-panel {
  position: absolute;
  bottom: 60px;
  left: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  width: 260px;
  box-shadow: 0 20px 40px -20px rgba(0,0,0,0.7);
}
.emoji-panel button {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
}
.emoji-panel button:hover { background: var(--surface-2); }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .app-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100dvh; }
  .room-rail {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 12px;
    flex-shrink: 0;
  }
  .room-rail .brand, .rail-footer { display: none; }
  .room-list { flex-direction: row; margin-top: 0; }
  .room-item { white-space: nowrap; flex-shrink: 0; }
  .msg { max-width: 82%; }
  .chat-header { padding: 14px 16px; }
  .messages { padding: 14px 16px; }
  .composer { padding: 10px 12px; gap: 6px; }
  .icon-btn { width: 36px; height: 36px; font-size: 0.95rem; flex-shrink: 0; }
  .send-btn { padding: 10px 14px; font-size: 0.85rem; flex-shrink: 0; }
  #message-input { font-size: 16px; /* prevents iOS auto-zoom on focus */ }
  .emoji-panel { left: 12px; right: 12px; width: auto; bottom: 56px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .pulse-dot { animation: none; }
  .btn-primary { transition: none; }
}
