@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ════════════════════════════════════════════════════════
   SOLID THEME — Messenger-style (WhatsApp-like)
   Dark: true blacks/dark grays  |  Light: true whites
   ════════════════════════════════════════════════════════ */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* ── Dark Mode (default) ── */
  --bg-app: #111b21;
  --bg-surface: #1f2c33;
  --bg-surface-hover: #2a3942;
  --bg-surface-active: #2a3942;
  --bg-nav: #1f2c33;
  --bg-input: #1f2c33;
  --bg-chat: #0b141a;

  --border-color: #313d45;
  --border-light: #313d45;

  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;

  --msg-outgoing: #005c4b;
  --msg-outgoing-text: #e9edef;
  --msg-incoming: #1f2c33;
  --msg-incoming-text: #e9edef;

  --accent: #00a884;
  --accent-hover: #06cf9c;
  --accent-purple: #8b5cf6;
  --accent-gold: #f59e0b;
  --accent-red: #ef4444;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-blue: #53bdeb;

  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;
}

/* ── Light Mode ── */
:root.light-mode {
  --bg-app: #efeae2;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f0f2f5;
  --bg-surface-active: #e9edef;
  --bg-nav: #ffffff;
  --bg-input: #ffffff;
  --bg-chat: #efeae2;

  --border-color: #e9edef;
  --border-light: #d1d7db;

  --text-primary: #111b21;
  --text-secondary: #667781;
  --text-muted: #8696a0;

  --msg-outgoing: #d9fdd3;
  --msg-outgoing-text: #111b21;
  --msg-incoming: #ffffff;
  --msg-incoming-text: #111b21;

  --accent: #00a884;
  --accent-hover: #06cf9c;
}

/* ── Reset ──────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ── Scrollbar ──────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }

/* ── Surface / Card Base ────────────────────────────── */
.surface {
  background: var(--bg-surface);
}

.surface-nav {
  background: var(--bg-nav);
}

/* ── Shimmer ────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer-bg {
  background: linear-gradient(90deg, var(--bg-surface-hover) 25%, var(--bg-surface-active) 50%, var(--bg-surface-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ── Inputs ─────────────────────────────────────────── */
input, textarea, select {
  font-family: var(--font-sans);
}

.input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.input:focus {
  border-color: var(--accent);
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  transition: background var(--transition-fast);
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-surface-active);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

/* ── Utilities ──────────────────────────────────────── */
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }

/* ── Banner ─────────────────────────────────────────── */
#reconnect-banner {
  position: fixed;
  top: 0; left: 0; width: 100%;
  padding: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  z-index: 9999;
  display: none;
  animation: slideDown var(--transition-fast);
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

#reconnect-banner.reconnecting { display: block; background: var(--accent-gold); color: #000; }
#reconnect-banner.connected    { display: block; background: var(--accent-emerald); color: #fff; }

/* ── Toast ──────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  max-width: 320px;
  width: calc(100% - 40px);
  pointer-events: none;
}

.toast {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  animation: toastIn var(--transition-fast);
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.toast.info    { background: #667781; }
.toast.success { background: var(--accent); }
.toast.error   { background: var(--accent-red); }
.toast.warning { background: var(--accent-gold); color: #000; }

/* ════════════════════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ── Left Sidebar Nav ───────────────────────────────── */
.app-nav {
  width: 220px;
  background: var(--bg-nav);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 20px 12px;
  z-index: 100;
  transition: width var(--transition-normal);
}

/* Hide nav sidebar when Friends or Admin tab is active (desktop only) */
@media (min-width: 769px) {
  .app-shell:has(#tab-panel-friends.active) .app-nav,
  .app-shell:has(#tab-panel-admin.active) .app-nav {
    display: none;
  }
}

.app-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 0 8px;
}

.app-nav-brand img {
  width: 32px;
  height: 32px;
}

.app-nav-brand span {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.app-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--bg-surface-active);
  color: var(--text-primary);
  font-weight: 600;
}

.nav-badge {
  position: absolute;
  right: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  border-radius: 10px;
  padding: 1px 6px;
}

.logout-btn-nav {
  margin-top: auto;
  color: var(--accent-red);
}

.logout-btn-nav:hover {
  background: rgba(239,68,68,0.08);
}

/* ── Main Content ───────────────────────────────────── */
.app-main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-chat);
}

.tab-panel {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* ── Lobby / Matchmaking ────────────────────────────── */
.tab-panel #lobby-view,
.tab-panel #matchmaking-view {
  max-width: 480px;
  margin: 40px auto;
  width: calc(100% - 32px);
  border-radius: 8px;
  background: var(--bg-surface);
  padding: 24px;
}

.tab-panel .profile-container {
  max-width: 480px;
  margin: 40px auto;
  width: calc(100% - 32px);
  padding: 0;
}

.tab-panel .profile-card {
  padding: 24px;
  border-radius: 8px;
  background: var(--bg-surface);
}

.tab-panel .friends-app-container {
  max-width: 100%;
  border: none;
  height: 100%;
}

/* ── Progress Bar ───────────────────────────────────── */
.progress-bar {
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

/* ── Mobile ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell {
    flex-direction: column-reverse;
  }

  .app-nav {
    width: 100%;
    height: 56px;
    flex-direction: row;
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--border-color);
    background: var(--bg-nav);
  }

  .app-nav-brand { display: none; }

  .app-nav-links {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    gap: 0;
  }

  .nav-link {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 0;
    font-size: 9px;
    flex: 1;
    border-radius: 0;
  }

  .nav-link.active {
    background: transparent;
    color: var(--accent);
  }

  .nav-link .nav-icon { font-size: 18px; }
  .nav-link .nav-text { display: block; }

  .nav-badge {
    top: 2px;
    right: calc(50% - 20px);
    padding: 1px 5px;
    font-size: 8px;
  }

  .app-main-content {
    height: calc(100vh - 56px);
  }
}
