
/* Theme: dark slate + blue accent */

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --panel: #020617;
  --border: #334155;
  --text: #e5e7eb;
  --text-strong: #f1f5f9;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --shadow: 0 20px 40px rgba(0,0,0,0.40);
  --shadow-sm: 0 6px 16px rgba(0,0,0,0.28);

  --sidebar-width: 220px;
}

/* Reset */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { height:100%; overflow-x:hidden; }

/* Body */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  padding-left: var(--sidebar-width);
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(59,130,246,0.14), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(37,99,235,0.10), transparent 55%),
    var(--bg);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration:none; }
a:hover { color: var(--accent-2); }

.container { max-width:1200px; margin:0 auto; padding:0 20px; }

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  background: #1f2937;
  color: #fff;
  padding: 20px;
}
.sidebar h3 { color:var(--text-strong); margin-bottom:12px; font-size:1.1rem; }
.sidebar a { display:block; color:#e5e7eb; padding:8px 10px; border-radius:6px; margin-bottom:6px; text-decoration:none; transition:background .2s; }
.sidebar a:hover { background:#374151; }

/* Layout wrapper */
.layout { display:flex; flex-direction:column; min-height:100vh; }

/* Navbar */
.navbar {
  background: var(--surface);
  color: var(--text);
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  position: sticky;
  top: 0;
  z-index: 150;
}
.navbar .container { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:1rem; }
.navbar-brand { font-size:1.25rem; font-weight:800; letter-spacing:0.2px; color:var(--text-strong); }
.navbar ul, .navbar-nav { list-style:none; margin:0; padding:0; display:flex; gap:1.25rem; flex-wrap:wrap; align-items:center; }
.navbar-nav a { color:var(--text); font-weight:600; transition:color .2s ease; }
.navbar-nav a:hover { color:var(--accent); }
.nav-toggle { display:none; flex-direction:column; gap:4px; background:none; border:none; cursor:pointer; padding:4px; }
.nav-toggle-bar { display:block; width:22px; height:2px; background:var(--text); border-radius:2px; }
.nav-menu { display:flex; align-items:center; }

/* Main content */
.main-content { flex:1 0 auto; display:flex; flex-direction:column; min-height:100vh; }
.main-content > header { flex-shrink:0; }
.main-content > main.site-main { flex:1 0 auto; padding:20px; }
.main-content > footer.site-footer { flex-shrink:0; }

/* Site root / footer */
.site-footer { background:var(--surface); border-top:1px solid var(--border); padding:1.5rem 0; color:var(--muted); font-size:0.875rem; text-align:center; }
.site-footer a { color:var(--muted); }
.site-footer a:hover { color:var(--accent); }

/* Notification dropdown */
.notif-dropdown { position:relative; }
.notif-panel { display:none; position:absolute; right:0; top:28px; background:#fff; width:260px; border:1px solid #e5e7eb; border-radius:8px; box-shadow:0 5px 10px rgba(0,0,0,0.08); z-index:999; }
.notif-dropdown:hover .notif-panel { display:block; }
.notif-item { padding:10px; border-bottom:1px solid #f0f0f0; font-size:13px; color:#1e293b; }
.notif-item:last-child { border-bottom:none; }

/* Hero */
.hero { color:var(--text-strong); padding:2rem 0 2.5rem; text-align:center; }
.hero h1 { font-size:2.25rem; font-weight:800; margin-bottom:0.5rem; }
.hero p { color:var(--muted); font-size:1.1rem; margin-bottom:1.25rem; }
.hero-actions { display:flex; gap:1rem; justify-content:center; flex-wrap:wrap; }

/* Buttons */
.btn { display:inline-block; padding:0.55rem 1.2rem; border-radius:var(--radius-sm); font-weight:600; font-size:0.95rem; cursor:pointer; border:none; transition:background .2s, color .2s; text-decoration:none; }
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:var(--accent-2); color:#fff; }
.btn-secondary { background:var(--surface); color:var(--text); border:1px solid var(--border); }
.btn-secondary:hover { background:var(--border); }
.btn-outline { background:transparent; color:var(--accent); border:1px solid var(--accent); }
.btn-outline:hover { background:var(--accent); color:#fff; }

/* Cards / Panels */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:1.25rem 1.5rem; margin-bottom:1.25rem; box-shadow:var(--shadow-sm); }
.panel { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:1rem 1.25rem; }

/* Dashboard grid / stats */
.dashboard-grid, .dashboard-stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:1rem; margin-bottom:1.25rem; }
.stat-card, .card.stat { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:1rem 1.25rem; text-align:center; }
.stat-number { font-size:2rem; font-weight:800; color:var(--accent); }
.stat-label { font-size:0.85rem; color:var(--muted); margin-top:4px; }
.dashboard-section { padding:1.5rem 0; }
.admin-section { margin-top:1.25rem; padding:1rem 1.25rem; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); }
.admin-section h2 { margin-bottom:0.75rem; font-size:1.1rem; color:var(--text-strong); }

/* Feature grid */
.features { padding:2rem 0; }
.features h2 { text-align:center; font-size:1.75rem; margin-bottom:1.5rem; color:var(--text-strong); }
.feature-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:1.25rem; }
.feature-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:1.5rem; box-shadow:var(--shadow-sm); }
.feature-card h3 { color:var(--text-strong); margin-bottom:0.5rem; }
.feature-card p { color:var(--muted); margin-bottom:1rem; font-size:0.95rem; }

/* Alerts */
.alert { padding:0.75rem 1rem; border-radius:var(--radius-sm); margin-bottom:1rem; font-size:0.95rem; }
.alert-success { background:rgba(34,197,94,0.12); border:1px solid var(--success); color:var(--success); }
.alert-error   { background:rgba(239,68,68,0.12);  border:1px solid var(--danger);  color:var(--danger); }

/* Forms */
/* Base input reset - ensures all inputs render correctly */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  box-sizing: border-box;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
textarea,
select {
  display: block;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  line-height: 1.5;
  min-height: 2.5rem;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

textarea { min-height: 100px; resize: vertical; }

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  display: inline;
  accent-color: var(--accent);
}

.form-control { background:var(--panel); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text); padding:0.5rem 0.75rem; font-size:0.95rem; width:100%; display:block; min-height:2.5rem; }
.form-control:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(59,130,246,0.15); }
.toolbar { display:flex; gap:0.75rem; align-items:center; }

/* Misc */
.muted { color:var(--muted); font-size:0.9rem; }

/* Play-GSO embed */
body.play-gso-embed .site-main { padding:0; flex:1 1 auto; }
body.play-gso-embed .play-gso-shell { width:100%; height:100%; }
body.play-gso-embed #root { width:100%; height:100%; border:0; display:block; }
@media (max-width:1023px) {
  body.play-gso-embed header, body.play-gso-embed .site-footer { display:none; }
  body.play-gso-embed .site-main { height:100vh; }
}

/* Mobile */
@media (max-width:768px) {
  body { padding-left:0; }
  .sidebar { position:relative; width:100%; height:auto; }
  .nav-toggle { display:flex; }
  .nav-menu { display:none; width:100%; flex-direction:column; align-items:flex-start; padding:0.75rem 0; gap:0; }
  .nav-menu.is-open { display:flex; }
  .navbar-nav { flex-direction:column; gap:0; width:100%; }
  .navbar-nav li { width:100%; }
  .navbar-nav a { display:block; padding:0.5rem 0; }
}

/* =====================================================
   Sidebar mobile toggle button
   ===================================================== */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 250;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 8px;
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: flex;
  }

  /* Sidebar hidden by default on mobile, shown when .sidebar-open */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    position: fixed !important;
    width: var(--sidebar-width) !important;
    height: 100vh !important;
    z-index: 240;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  /* Offset body top so toggle button doesn't overlap content */
  body {
    padding-top: 48px;
  }
}

/* =====================================================
   Auth pages
   ===================================================== */
.auth-section {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 3rem 1rem;
}

/* The container inside auth-section should center the form */
.auth-section .container {
  display: flex;
  justify-content: center;
  width: 100%;
}

.auth-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow);
}

.auth-form h2 {
  color: var(--text-strong);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.auth-footer {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.sso-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* =====================================================
   Form groups / rows
   ===================================================== */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted-2);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 1rem;
}

.form-row label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

/* =====================================================
   Key-value display (profile page)
   ===================================================== */
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  align-items: start;
}

.kv .k {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 4px 0;
}

.kv .v {
  color: var(--text);
  padding: 4px 0;
  word-break: break-word;
}

/* =====================================================
   Two-column grid
   ===================================================== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

/* =====================================================
   Badges & Pills
   ===================================================== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--border);
  color: var(--text);
}

.badge.success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-muted   { background: var(--border); color: var(--muted); }
.badge-warn    { background: rgba(245,158,11,0.15); color: #f59e0b; }
.alert-info    { background: rgba(59,130,246,0.12); border: 1px solid var(--accent); color: var(--accent); padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--border);
  color: var(--muted);
  text-transform: capitalize;
}

/* =====================================================
   Utility
   ===================================================== */
.btn-sm        { padding: 0.3rem 0.75rem; font-size: 0.85rem; }
.hide-sm       { display: block; }
.row-between   { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.section-title { font-size: 1.3rem; font-weight: 700; color: var(--text-strong); margin-bottom: 1rem; }
.dashboard-header { margin-bottom: 1.5rem; }
.dashboard-header h1 { font-size: 1.75rem; color: var(--text-strong); }
.page-header   { margin-bottom: 1.25rem; }
.page-head     { margin-bottom: 1.5rem; }
.page-head h1  { font-size: 1.75rem; color: var(--text-strong); margin-bottom: 0.25rem; }
.page-section  { padding: 2rem 0; }
.dot           { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.notice        { background: rgba(59,130,246,0.08); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 0.75rem 1rem; color: var(--text); font-size: 0.9rem; margin-bottom: 1rem; }

@media (max-width: 600px) { .hide-sm { display: none; } }

/* =====================================================
   Card sub-elements
   ===================================================== */
.card-header {
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-strong);
}

.card-body { padding: 0; }

/* =====================================================
   Tables
   ===================================================== */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255,255,255,0.02); }

/* =====================================================
   Breadcrumbs
   ===================================================== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--muted-2); }

/* =====================================================
   Toolbar
   ===================================================== */
.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.page-link {
  display: inline-block;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.875rem;
  transition: background 0.15s;
}

.page-link:hover, .page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* =====================================================
   Shop
   ===================================================== */
.shop-section { padding: 1.5rem 0; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.2s;
}

.product-card:hover { border-color: var(--accent); }

.product-card img {
  width: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover;
  max-height: 180px;
}

.product-image-placeholder {
  width: 100%;
  height: 140px;
  background: var(--panel);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.product-card h3 { color: var(--text-strong); font-size: 1rem; }

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

/* =====================================================
   Stats grid (dashboard extras)
   ===================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-strong);
}

/* =====================================================
   Forum
   ===================================================== */
.forum-section { padding: 1.5rem 0; }

.forum-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-list { display: flex; flex-direction: column; gap: 0.75rem; }

.category-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.category-row:hover { border-color: var(--accent); }

.category-main { flex: 1; min-width: 0; }
.category-title { font-weight: 600; color: var(--text-strong); }
.category-meta  { font-size: 0.85rem; color: var(--muted); margin-top: 3px; }

/* Thread list */
.thread-list { display: flex; flex-direction: column; gap: 0; }

.thread-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid rgba(51,65,85,0.5);
}

.thread-row:last-child { border-bottom: none; }

.thread-main  { flex: 1; min-width: 0; }
.thread-title { font-weight: 600; color: var(--text-strong); }
.thread-title a { color: var(--text-strong); }
.thread-title a:hover { color: var(--accent); }
.thread-title-lg { font-size: 1.2rem; font-weight: 700; color: var(--text-strong); }
.thread-meta  { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }
.thread-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.thread-replies { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.thread-top   { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.thread-header { margin-bottom: 1.5rem; }

/* Topic table */
.topic-table { width: 100%; border-collapse: collapse; }
.topic-table-head th { padding: 8px 12px; text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.topic-item td { padding: 10px 12px; border-bottom: 1px solid rgba(51,65,85,0.4); vertical-align: middle; }
.topic-item:last-child td { border-bottom: none; }
.topic-item:hover td { background: rgba(255,255,255,0.02); }
.topic-main { }
.topic-title { font-weight: 600; color: var(--text-strong); }
.topic-title a { color: var(--text-strong); }
.topic-title a:hover { color: var(--accent); }
.topic-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topic-meta { font-size: 0.8rem; color: var(--muted); margin-top: 3px; }
.topic-stats { text-align: center; font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.topic-last  { font-size: 0.8rem; color: var(--muted); }

/* Posts */
.post {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.post:last-child { border-bottom: none; }
.post-avatar { flex-shrink: 0; }

.avatar-img {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
}

.avatar-fallback {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.post-content { flex: 1; min-width: 0; }
.post-meta    { font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-body    { color: var(--text); line-height: 1.7; }
.post-actions { margin-top: 8px; display: flex; gap: 8px; }
.reply-box    { margin-top: 1.5rem; }

/* =====================================================
   Error page
   ===================================================== */
.error-section  { display: flex; align-items: center; justify-content: center; min-height: 60vh; text-align: center; padding: 2rem; }
.error-content  { max-width: 480px; }
.error-content h1 { font-size: 4rem; font-weight: 900; color: var(--accent); margin-bottom: 0.5rem; }
.error-content p  { color: var(--muted); margin-bottom: 1.25rem; }
.error-actions  { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* =====================================================
   Admin layout
   ===================================================== */
.admin-shell {
  display: flex;
  min-height: calc(100vh - 60px);
}

.admin-sidebar {
  width: 200px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  flex-shrink: 0;
}

.admin-sidebar a {
  display: block;
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
  background: rgba(59,130,246,0.1);
  color: var(--accent);
}

.admin-content {
  flex: 1;
  padding: 1.5rem;
  min-width: 0;
}
