/* ============================================================
   보드게임 LFG — Styles
   ============================================================ */

:root {
  --bg:          #0f1117;
  --surface:     #1a1d27;
  --card:        #22253a;
  --card-hover:  #2a2e48;
  --border:      #2e3350;
  --primary:     #7c6ff7;
  --primary-h:   #6c5fe6;
  --primary-dim: rgba(124,111,247,.15);
  --text:        #e8eaf2;
  --text-sec:    #8892b0;
  --text-muted:  #4a5578;
  --success:     #22c55e;
  --danger:      #ef4444;

  --cat-boardgame_cafe: #3b82f6;
  --cat-private:        #22c55e;
  --cat-tabletop_sim:   #a855f7;
  --cat-bga:            #f59e0b;
  --cat-steam:          #ef4444;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Loading ───────────────────────────────────────────────── */
.loading-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth ──────────────────────────────────────────────────── */
#view-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #1b1d38 0%, var(--bg) 70%);
}
.auth-wrap { width: 100%; max-width: 440px; padding: 24px; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 52px 40px;
  text-align: center;
}
.auth-logo { font-size: 60px; margin-bottom: 16px; }
.auth-title { font-size: 30px; font-weight: 700; margin-bottom: 8px; }
.auth-sub { color: var(--text-sec); margin-bottom: 32px; }
.auth-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 36px;
}
.auth-cats span {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-sec);
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  background: #fff;
  color: #1f1f1f;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow .2s;
  font-family: inherit;
}
.btn-google:hover { box-shadow: 0 4px 16px rgba(0,0,0,.4); }

/* ── Header ────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-l, .header-r {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo { font-size: 18px; font-weight: 700; }
.user-info { display: flex; align-items: center; gap: 10px; }
.u-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
}
.u-name { font-size: 13px; color: var(--text-sec); font-weight: 500; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--text-sec); }
.btn-ghost:hover { background: var(--card); color: var(--text); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

/* ── Category Nav ──────────────────────────────────────────── */
.cat-nav {
  display: flex;
  gap: 8px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-sec);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
  white-space: nowrap;
}
.cat-tab:hover { border-color: var(--primary); color: var(--text); }
.cat-tab.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Room List ─────────────────────────────────────────────── */
.content { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.rooms-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.rooms-title { font-size: 20px; font-weight: 600; }
.rooms-badge {
  background: var(--card);
  color: var(--text-sec);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
}
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

/* ── Room Card ─────────────────────────────────────────────── */
.room-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.room-card:hover {
  background: var(--card-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
}
.rc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.rc-title { font-size: 16px; font-weight: 600; line-height: 1.35; }

/* Category badges */
.cbadge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.cb-boardgame_cafe { background: rgba(59,130,246,.15);  color: #60a5fa; }
.cb-private        { background: rgba(34,197,94,.15);   color: #4ade80; }
.cb-tabletop_sim   { background: rgba(168,85,247,.15);  color: #c084fc; }
.cb-bga            { background: rgba(245,158,11,.15);  color: #fbbf24; }
.cb-steam          { background: rgba(239,68,68,.15);   color: #f87171; }

.rc-game { font-size: 13px; color: var(--primary); font-weight: 500; }
.rc-desc {
  font-size: 13px;
  color: var(--text-sec);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.rc-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.rc-host { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.rc-host img { width: 18px; height: 18px; border-radius: 50%; }
.rc-players { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.rc-players.open  { color: var(--success); }
.rc-players.full  { color: var(--danger); }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 24px;
  color: var(--text-sec);
}
.empty-icon { font-size: 52px; margin-bottom: 16px; }
.empty-text { font-size: 15px; line-height: 1.8; }

/* ── Room View ─────────────────────────────────────────────── */
.room-layout {
  display: flex;
  height: calc(100vh - 65px);
}
.room-side {
  width: 320px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.info-card, .members-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}
.r-title { font-size: 20px; font-weight: 700; margin: 10px 0 4px; line-height: 1.3; }
.r-game  { font-size: 13px; color: var(--primary); font-weight: 500; margin-bottom: 10px; }
.r-desc  { font-size: 13px; color: var(--text-sec); margin-bottom: 14px; line-height: 1.6; }
.r-meta {
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}
.r-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}
.meta-k { font-size: 12px; color: var(--text-muted); }
.meta-v { font-size: 13px; font-weight: 500; }

.members-heading { font-size: 13px; font-weight: 600; color: var(--text-sec); margin-bottom: 12px; }
.members-list { display: flex; flex-direction: column; gap: 6px; }
.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
}
.member-item.is-host { background: var(--primary-dim); }
.m-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.m-name { font-size: 13px; font-weight: 500; flex: 1; }
.host-tag {
  font-size: 10px;
  background: var(--primary-dim);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

/* ── Chat ──────────────────────────────────────────────────── */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}
.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 72%;
}
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.system { max-width: 100%; align-self: center; }

.c-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 2px;
}
.c-body { display: flex; flex-direction: column; gap: 4px; }
.mine .c-body { align-items: flex-end; }
.c-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.c-name { font-size: 12px; font-weight: 600; color: var(--text-sec); }
.c-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.mine .c-bubble {
  background: var(--primary-dim);
  border-color: var(--primary);
  border-radius: 14px 4px 14px 14px;
}
.c-sys {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
}
.chat-bar {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.chat-input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 16px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .18s;
}
.chat-input:focus { border-color: var(--primary); }
.chat-input::placeholder { color: var(--text-muted); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 24px;
  backdrop-filter: blur(6px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 17px; font-weight: 600; }
.modal-x {
  background: none; border: none;
  color: var(--text-sec); cursor: pointer;
  font-size: 15px; padding: 4px 8px;
  border-radius: 6px; transition: background .18s;
}
.modal-x:hover { background: var(--card); }
.modal-body {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 60vh;
  overflow-y: auto;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; font-weight: 500; color: var(--text-sec); }
.input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .18s;
  width: 100%;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--text-muted); }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238892b0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
select.input option { background: var(--card); }
.textarea { resize: vertical; min-height: 88px; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .room-layout { flex-direction: column; height: auto; min-height: calc(100vh - 65px); }
  .room-side { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .chat-panel { height: 60vh; }
  .room-grid { grid-template-columns: 1fr; }
  .header { padding: 12px 16px; }
  .u-name { display: none; }
  .auth-card { padding: 36px 24px; }
  .content { padding: 20px 16px; }
  .chat-msg { max-width: 90%; }
}
