/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Syne:wght@400;600;800&display=swap');

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #181820;
  --surface: #1e1e28;
  --surface2: #252530;
  --border: #2e2e3e;
  --border2: #3a3a4e;
  --accent: #00e5ff;
  --accent2: #7c3aed;
  --accent3: #f472b6;
  --text: #e2e2f0;
  --text2: #9999bb;
  --text3: #5555770;
  --online: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 8px;
  --radius2: 12px;
  --font-mono: 'Space Mono', monospace;
  --font-ui: 'Syne', sans-serif;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --glow: 0 0 20px rgba(0,229,255,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(124,58,237,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(0,229,255,0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── SCROLLBAR ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent2); }

/* ── LINKS ──────────────────────────────────── */
a { color: var(--accent); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: 0.8; }

/* ── BUTTONS ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all .2s;
  letter-spacing: .04em;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: #33eeff; box-shadow: 0 0 20px rgba(0,229,255,0.4); }
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: .3rem .7rem; font-size: .72rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── INPUTS ─────────────────────────────────── */
input, select, textarea {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: .9rem;
  padding: .6rem .9rem;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
}
input::placeholder { color: var(--text2); opacity: .6; }
select option { background: var(--bg2); }
textarea { resize: vertical; min-height: 80px; }

/* ── LAYOUT ─────────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.logo span { color: var(--text2); }

.nav-links {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .75rem .75rem 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .75rem;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: .85rem;
  transition: all .15s;
  font-weight: 600;
}
.nav-link:hover, .nav-link.active {
  background: var(--surface);
  color: var(--text);
}
.nav-link.active { color: var(--accent); }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #000;
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .35rem;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-section {
  padding: .75rem;
  flex: 1;
  overflow-y: auto;
}

.section-label {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--text2);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .5rem .25rem .4rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .6rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}
.user-card:hover {
  background: var(--surface);
  border-color: var(--border);
}
.user-card:hover .chat-btn { opacity: 1; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
  color: var(--accent);
}
.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1rem;
}

.online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  background: var(--online);
  border-radius: 50%;
  border: 2px solid var(--bg2);
}

.user-info { flex: 1; min-width: 0; }
.user-name {
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta {
  font-size: .72rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-btn {
  opacity: 0;
  transition: opacity .15s;
}

/* ── MAIN CONTENT ───────────────────────────── */
.main-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.topbar {
  padding: .8rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg2);
  flex-shrink: 0;
}

.topbar-title {
  font-weight: 800;
  font-size: 1.05rem;
}

.topbar-meta {
  font-size: .8rem;
  color: var(--text2);
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ── LOBBY ──────────────────────────────────── */
.lobby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
  padding: 1.2rem;
  overflow-y: auto;
  align-content: start;
  flex: 1;
}

.lobby-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 1rem;
  transition: border-color .2s, box-shadow .2s;
  cursor: default;
}
.lobby-card:hover {
  border-color: var(--accent2);
  box-shadow: 0 0 20px rgba(124,58,237,0.15);
}

.lobby-card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}

.lobby-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .75rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: .65rem;
  padding: .15rem .45rem;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}
.tag-online {
  background: rgba(34,197,94,.12);
  color: var(--online);
  border-color: rgba(34,197,94,.3);
}

/* ── CHAT ───────────────────────────────────── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.messages-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.message-row {
  display: flex;
  gap: .6rem;
  align-items: flex-end;
  max-width: 680px;
  animation: msgIn .2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.message-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 3px;
  padding: .55rem .9rem;
  font-size: .88rem;
  line-height: 1.5;
  max-width: 420px;
  word-break: break-word;
}
.message-row.mine .message-bubble {
  background: rgba(0,229,255,.08);
  border-color: rgba(0,229,255,.25);
  border-radius: 12px 12px 3px 12px;
  color: var(--text);
}

.message-time {
  font-size: .65rem;
  color: var(--text2);
  flex-shrink: 0;
  padding-bottom: .1rem;
}

.chat-input-area {
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  gap: .6rem;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input-area textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  font-size: .88rem;
  padding: .6rem .9rem;
}

.char-counter {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--text2);
  text-align: right;
  padding-right: .2rem;
  margin-bottom: .2rem;
}
.char-counter.warn { color: var(--warn); }
.char-counter.danger { color: var(--danger); }

/* ── INBOX ──────────────────────────────────── */
.inbox-list {
  flex: 1;
  overflow-y: auto;
}

.inbox-item {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  color: var(--text);
}
.inbox-item:hover { background: var(--surface); }
.inbox-item.unread { background: rgba(0,229,255,.04); }

.inbox-info { flex: 1; min-width: 0; }
.inbox-name {
  font-weight: 700;
  font-size: .9rem;
  margin-bottom: .15rem;
}
.inbox-preview {
  font-size: .8rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-right {
  text-align: right;
  flex-shrink: 0;
}
.inbox-time {
  font-size: .7rem;
  color: var(--text2);
  margin-bottom: .3rem;
}
.unread-count {
  background: var(--accent);
  color: #000;
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .4rem;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  display: inline-block;
}

/* ── ENTRY PAGE ─────────────────────────────── */
.entry-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.entry-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent), var(--accent3));
}

.entry-logo {
  text-align: center;
  margin-bottom: 1.8rem;
}
.entry-logo h1 {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--accent);
  letter-spacing: .1em;
  font-weight: 700;
}
.entry-logo p {
  color: var(--text2);
  font-size: .85rem;
  margin-top: .25rem;
}

.form-group {
  margin-bottom: 1rem;
}
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: .35rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.captcha-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .5rem;
}
.captcha-question {
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--accent);
  font-weight: 700;
}
.captcha-input {
  width: 80px;
  flex-shrink: 0;
  text-align: center;
  font-family: var(--font-mono);
}

.error-msg {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  border-radius: var(--radius);
  padding: .6rem .9rem;
  font-size: .83rem;
  margin-bottom: 1rem;
  display: none;
}
.error-msg.show { display: block; }

.entry-btn {
  width: 100%;
  justify-content: center;
  padding: .75rem;
  font-size: .9rem;
  margin-top: .5rem;
}

.entry-note {
  text-align: center;
  font-size: .75rem;
  color: var(--text2);
  margin-top: 1rem;
}

/* ── EMPTY STATES ───────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: var(--text2);
  text-align: center;
  flex: 1;
  gap: .75rem;
}
.empty-state svg { opacity: .3; }
.empty-state p { font-size: .9rem; }

/* ── TOAST ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-size: .82rem;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease;
  max-width: 280px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── LOADING ────────────────────────────────── */
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text2);
  gap: .75rem;
  font-size: .85rem;
}

/* ── CHAT HEADER ────────────────────────────── */
.chat-header-user {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.chat-header-status {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  color: var(--online);
}

.typing-indicator {
  font-size: .75rem;
  color: var(--text2);
  font-style: italic;
  padding: .25rem 1.2rem;
  height: 22px;
}

/* ── RESPONSIVE ─────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: left .3s;
    box-shadow: var(--shadow);
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 99;
  }
  .sidebar-overlay.show { display: block; }
  .topbar { padding: .7rem .9rem; }
  .lobby-grid { grid-template-columns: 1fr 1fr; padding: .75rem; gap: .5rem; }
  .menu-toggle { display: flex !important; }
  .form-row { grid-template-columns: 1fr; }
  .entry-card { padding: 1.8rem 1.2rem; }
}

@media (max-width: 480px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .message-bubble { max-width: 85vw; }
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
  padding: .4rem .5rem;
  cursor: pointer;
  font-size: 1.1rem;
}

/* ── MISC ───────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: .5rem 0;
}

.my-user-strip {
  padding: .75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-shrink: 0;
}
.my-user-name {
  font-size: .85rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.my-user-sub { font-size: .7rem; color: var(--online); }

/* ── COUNTRY AUTO-DETECT ─────────────────────── */
.country-detect-row {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.country-detect-display {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .9rem;
  font-size: .88rem;
  min-height: 42px;
}

/* ── LOBBY SEARCH & FILTERS ──────────────────── */
.lobby-search-bar {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: .55rem;
  flex-shrink: 0;
}
.lobby-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.lobby-search-input-wrap svg {
  position: absolute;
  left: .75rem;
  color: var(--text2);
  pointer-events: none;
  flex-shrink: 0;
}
.lobby-search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .82rem;
  padding: .55rem .9rem .55rem 2.25rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.lobby-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,229,255,.08);
}
.lobby-search-input::placeholder { color: var(--text2); opacity: .5; }
.lobby-filters {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.filter-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: .3rem .65rem;
  outline: none;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  flex: 1;
  min-width: 90px;
}
.filter-select:focus, .filter-select.active {
  border-color: var(--accent2);
  color: var(--text);
}
.filter-select option { background: var(--surface); }
.lobby-filter-results {
  font-family: var(--font-mono);
  font-size: .67rem;
  color: var(--text2);
  padding: .3rem .1rem 0;
}
.lobby-filter-results span { color: var(--accent); }

/* ── LOBBY CARD BIO (fake user status line) ──────── */
.lobby-card-bio {
  font-size: .75rem;
  color: var(--text2);
  line-height: 1.4;
  margin: .1rem 0 .4rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
