/* =====================================================================
   Capitalism Game  —  Design System
   Themes:  [data-theme="dark"]  (default)  |  [data-theme="light"]
   ===================================================================== */

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

/* ── Tokens — dark (default) ─────────────────────────────────────────────── */
:root {
  --bg-1:        #08091a;
  --bg-2:        #0d1130;
  --glow-a:      rgba(99, 102, 241, 0.20);
  --glow-b:      rgba(139, 92, 246, 0.14);
  --surface:     rgba(255, 255, 255, 0.045);
  --surface-2:   rgba(255, 255, 255, 0.075);
  --border:      rgba(255, 255, 255, 0.09);
  --border-h:    rgba(255, 255, 255, 0.18);
  --text:        #eaecf8;
  --text-soft:   #b8bcda;
  --muted:       #5d6199;
  --accent:      #6366f1;
  --accent-h:    #4f52dc;
  --accent-soft: rgba(99, 102, 241, 0.20);
  --error:       #f87171;
  --success:     #34d399;
  --warn:        #fbbf24;
  --radius:      12px;
  --radius-lg:   22px;
  --shadow:      0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 24px 72px rgba(0, 0, 0, 0.55);
  --trans:       180ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Tokens — light ──────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-1:        #eef0fc;
  --bg-2:        #e2e6f8;
  --glow-a:      rgba(99, 102, 241, 0.12);
  --glow-b:      rgba(139, 92, 246, 0.07);
  --surface:     rgba(255, 255, 255, 0.82);
  --surface-2:   rgba(240, 242, 255, 0.92);
  --border:      rgba(99, 102, 241, 0.14);
  --border-h:    rgba(99, 102, 241, 0.30);
  --text:        #1a1b2e;
  --text-soft:   #3d4068;
  --muted:       #8285b8;
  --accent:      #4f52dc;
  --accent-h:    #3e41c8;
  --accent-soft: rgba(79, 82, 220, 0.16);
  --error:       #dc2626;
  --success:     #059669;
  --warn:        #d97706;
  --shadow:      0 8px 32px rgba(99, 102, 241, 0.12);
  --shadow-lg:   0 24px 72px rgba(99, 102, 241, 0.20);
}

/* ── Base & background ───────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  background:      linear-gradient(145deg, var(--bg-1) 0%, var(--bg-2) 100%);
  color:           var(--text);
  font-family:     'Inter', system-ui, -apple-system, sans-serif;
  font-size:       15px;
  line-height:     1.6;
  min-height:      100vh;
  display:         flex;
  align-items:     center;
  justify-content: center;
  padding:         1.5rem;
  position:        relative;
  overflow-x:      hidden;
  transition:      background var(--trans), color var(--trans);
}

/* Ambient glow orbs — pure CSS, no images */
body::before,
body::after {
  content:       '';
  position:      fixed;
  border-radius: 50%;
  filter:        blur(100px);
  pointer-events:none;
  z-index:       0;
  animation:     pulse 8s ease-in-out infinite alternate;
}
body::before {
  width: 640px; height: 640px;
  background: var(--glow-a);
  top: -200px;  left: -180px;
}
body::after {
  width: 520px; height: 520px;
  background: var(--glow-b);
  bottom: -160px; right: -140px;
  animation-delay: -4s;
}
@keyframes pulse {
  from { opacity: 0.7; transform: scale(1);    }
  to   { opacity: 1;   transform: scale(1.08); }
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background:           var(--surface);
  backdrop-filter:      blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border:               1px solid var(--border);
  border-radius:        var(--radius-lg);
  box-shadow:           var(--shadow-lg),
                        inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding:              2.5rem 2.25rem;
  position:             relative;
  width:                100%;
  max-width:            420px;
  z-index:              1;
  transition:           background var(--trans), border-color var(--trans),
                        box-shadow var(--trans);
}
.card.wide { max-width: 560px; }

/* Faint inner highlight along the top edge */
.card::before {
  content:        '';
  position:       absolute;
  inset:          0;
  border-radius:  inherit;
  background:     linear-gradient(175deg, rgba(255,255,255,0.07) 0%, transparent 35%);
  pointer-events: none;
}

.card-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             1rem;
  margin-bottom:   0.25rem;
}
.card-header h1 { flex: 1; }
.card-header-actions { display: flex; align-items: center; gap: 0.5rem; }

/* ── Typography ──────────────────────────────────────────────────────────── */
.card h1 {
  font-size:     1.5rem;
  font-weight:   700;
  letter-spacing:-0.025em;
}

[data-theme="dark"] .card h1 {
  background:              linear-gradient(135deg, #ffffff 30%, var(--text-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip:         text;
}

.subtitle {
  color:         var(--muted);
  font-size:     0.9rem;
  margin-bottom: 2rem;
  line-height:   1.55;
}

.divider {
  border:  none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.field {
  display:        flex;
  flex-direction: column;
  gap:            0.4rem;
  margin-bottom:  1.1rem;
}

label {
  color:          var(--muted);
  font-size:      0.74rem;
  font-weight:    600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="email"] {
  background:  var(--surface-2);
  border:      1px solid var(--border);
  border-radius: var(--radius);
  color:       var(--text);
  font-family: inherit;
  font-size:   0.95rem;
  outline:     none;
  padding:     0.7rem 1rem;
  width:       100%;
  transition:  border-color var(--trans), box-shadow var(--trans),
               background var(--trans);
}
/* Remove number-input spinners — looks like plain text, still accepts numbers */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input::placeholder { color: var(--muted); opacity: 0.55; }
input:focus {
  background:   var(--surface);
  border-color: var(--accent);
  box-shadow:   0 0 0 3px var(--accent-soft);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
button { cursor: pointer; font-family: inherit; }

button[type="submit"] {
  background:    linear-gradient(135deg, var(--accent) 0%, var(--accent-h) 100%);
  border:        none;
  border-radius: var(--radius);
  box-shadow:    0 4px 20px var(--accent-soft);
  color:         #fff;
  font-size:     0.95rem;
  font-weight:   600;
  letter-spacing:0.02em;
  margin-top:    0.5rem;
  padding:       0.75rem 1.5rem;
  transition:    opacity var(--trans), transform var(--trans), box-shadow var(--trans);
  width:         100%;
}
button[type="submit"]:hover:not(:disabled) {
  box-shadow: 0 8px 28px var(--accent-soft);
  transform:  translateY(-1px);
}
button[type="submit"]:active  { transform: translateY(0); }
button[type="submit"]:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  background:    transparent;
  border:        1px solid var(--border);
  border-radius: var(--radius);
  color:         var(--muted);
  font-size:     0.84rem;
  font-weight:   500;
  padding:       0.45rem 1rem;
  transition:    border-color var(--trans), color var(--trans),
                 background var(--trans);
  white-space:   nowrap;
}
.btn-ghost:hover {
  border-color: var(--border-h);
  color:        var(--text);
  background:   var(--surface-2);
}

/* ── Error message ───────────────────────────────────────────────────────── */
.error {
  background:    rgba(248, 113, 113, 0.08);
  border:        1px solid rgba(248, 113, 113, 0.25);
  border-radius: var(--radius);
  color:         var(--error);
  font-size:     0.85rem;
  padding:       0.6rem 0.9rem;
  margin-bottom: 0.75rem;
}

/* ── Register / auth link below forms ───────────────────────────────────── */
.register-link {
  margin-top:  1.25rem;
  text-align:  center;
  font-size:   0.85rem;
  color:       var(--muted);
}

.register-link a {
  color:           var(--accent);
  text-decoration: none;
}

.register-link a:hover {
  text-decoration: underline;
}

/* ── Info table ──────────────────────────────────────────────────────────── */
.info-table { border-collapse: collapse; width: 100%; }
.info-table th,
.info-table td {
  border-bottom: 1px solid var(--border);
  font-size:     0.9rem;
  padding:       0.7rem 0.5rem;
  text-align:    left;
}
.info-table tr:last-child th,
.info-table tr:last-child td { border-bottom: none; }
.info-table th { color: var(--muted);     font-weight: 500; width: 38%; }
.info-table td { color: var(--text-soft); }

/* ── Status badges ───────────────────────────────────────────────────────── */
.badge {
  border-radius: 999px;
  display:       inline-block;
  font-size:     0.74rem;
  font-weight:   600;
  letter-spacing:0.05em;
  padding:       0.22rem 0.7rem;
  text-transform:capitalize;
}
.badge-active    { background: rgba(52,  211, 153, 0.13); color: #34d399; }
.badge-away      { background: rgba(251, 191,  36, 0.13); color: #fbbf24; }
.badge-timeouted { background: rgba(251, 146,  60, 0.13); color: #fb923c; }
.badge-banned    { background: rgba(248, 113, 113, 0.13); color: var(--error); }

/* ── Settings panel ──────────────────────────────────────────────────────── */
.settings-panel {
  background:    var(--surface-2);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  margin-top:    1.5rem;
  overflow:      hidden;
  transition:    background var(--trans), border-color var(--trans);
}

.settings-panel summary {
  align-items:    center;
  color:          var(--muted);
  cursor:         pointer;
  display:        flex;
  font-size:      0.74rem;
  font-weight:    600;
  gap:            0.5rem;
  letter-spacing: 0.09em;
  list-style:     none;
  padding:        0.8rem 1rem;
  text-transform: uppercase;
  user-select:    none;
  transition:     color var(--trans);
}
.settings-panel summary::-webkit-details-marker { display: none; }
.settings-panel summary:hover { color: var(--text); }
.settings-panel summary .chevron {
  font-size:   0.6rem;
  margin-left: auto;
  opacity:     0.55;
  transition:  transform var(--trans);
}
.settings-panel[open] summary .chevron { transform: rotate(180deg); }

.settings-body { padding: 0.25rem 1rem 1rem; }

.settings-row {
  align-items:     center;
  display:         flex;
  gap:             1rem;
  justify-content: space-between;
  padding:         0.6rem 0;
}
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-label { color: var(--text-soft); font-size: 0.875rem; font-weight: 500; }

/* ── Theme segmented control ─────────────────────────────────────────────── */
.theme-group {
  background:    rgba(0, 0, 0, 0.18);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  display:       flex;
  gap:           3px;
  overflow:      hidden;
  padding:       3px;
}
.theme-btn {
  background:    transparent;
  border:        none;
  border-radius: 8px;
  color:         var(--muted);
  font-size:     0.82rem;
  font-weight:   500;
  padding:       0.35rem 0.9rem;
  transition:    background var(--trans), color var(--trans), box-shadow var(--trans);
}
.theme-btn.active {
  background: var(--accent);
  box-shadow: 0 2px 10px var(--accent-soft);
  color:      #fff;
}
.theme-btn:not(.active):hover { background: var(--surface-2); color: var(--text); }

/* ── Dashboard page ──────────────────────────────────────────────────────── */
body.dash-body {
  align-items:    flex-start;
  padding-top:    3.5rem;
  padding-bottom: 3.5rem;
}

.dash-wrap {
  display:        flex;
  flex-direction: column;
  gap:            1.25rem;
  max-width:      740px;
  width:          100%;
  z-index:        1;
}

/* ── Top bar ─────────────────────────────────────────────────────────────── */
.dash-topbar {
  align-items:     center;
  display:         flex;
  justify-content: space-between;
  gap:             1rem;
}

.dash-brand {
  color:          var(--text);
  font-size:      1.1rem;
  font-weight:    700;
  letter-spacing: -0.02em;
}

.btn-logout {
  background:    var(--surface);
  backdrop-filter: blur(10px);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  color:         var(--muted);
  cursor:        pointer;
  font-family:   inherit;
  font-size:     0.84rem;
  font-weight:   500;
  padding:       0.45rem 1.1rem;
  transition:    border-color var(--trans), color var(--trans),
                 background var(--trans);
}
.btn-logout:hover {
  background:   rgba(248, 113, 113, 0.07);
  border-color: var(--error);
  color:        var(--error);
}

/* ── Identity card ───────────────────────────────────────────────────────── */
.dash-identity-card {
  align-items:             center;
  background:              var(--surface);
  backdrop-filter:         blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border:                  1px solid var(--border);
  border-radius:           var(--radius-lg);
  box-shadow:              var(--shadow),
                           inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display:                 flex;
  gap:                     1.5rem;
  overflow:                hidden;
  padding:                 1.75rem 2rem;
  position:                relative;
}
.dash-identity-card::before {
  content:        '';
  position:       absolute;
  inset:          0;
  border-radius:  inherit;
  background:     linear-gradient(170deg, rgba(255,255,255,0.06) 0%, transparent 40%);
  pointer-events: none;
}

.dash-avatar-ring {
  align-items:      center;
  background:       linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border-radius:    50%;
  box-shadow:       0 0 0 3px var(--accent-soft),
                    0 4px 20px rgba(99, 102, 241, 0.28);
  color:            #fff;
  display:          flex;
  flex-shrink:      0;
  font-size:        1.5rem;
  font-weight:      700;
  height:           64px;
  justify-content:  center;
  width:            64px;
}

.dash-identity-body { flex: 1; min-width: 0; }

.dash-welcome {
  font-size:      1.3rem;
  font-weight:    700;
  letter-spacing: -0.025em;
  margin-bottom:  0.65rem;
  overflow:       hidden;
  text-overflow:  ellipsis;
  white-space:    nowrap;
}
[data-theme="dark"] .dash-welcome {
  background:              linear-gradient(135deg, #fff 35%, var(--text-soft));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip:         text;
}

.dash-stats-row {
  align-items: center;
  column-gap:  1.25rem;
  display:     flex;
  flex-wrap:   wrap;
  row-gap:     0.45rem;
}
.dash-stat {
  display:        flex;
  flex-direction: column;
  gap:            0.05rem;
}
.dash-stat-key {
  color:          var(--muted);
  font-size:      0.68rem;
  font-weight:    600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.dash-stat-val {
  color:       var(--text-soft);
  font-size:   0.9rem;
  font-weight: 600;
}

/* ── Navigation tiles ────────────────────────────────────────────────────── */
.dash-nav {
  display:               grid;
  gap:                   1rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.dash-tile {
  background:              var(--surface);
  backdrop-filter:         blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border:                  1px solid var(--border);
  border-radius:           var(--radius-lg);
  box-shadow:              var(--shadow);
  color:                   inherit;
  cursor:                  pointer;
  display:                 flex;
  flex-direction:          column;
  gap:                     0.3rem;
  overflow:                hidden;
  padding:                 1.5rem 1.5rem 1.35rem;
  position:                relative;
  text-decoration:         none;
  transition:              border-color var(--trans), transform var(--trans),
                           box-shadow var(--trans), background var(--trans);
}
.dash-tile::before {
  content:        '';
  position:       absolute;
  inset:          0;
  border-radius:  inherit;
  background:     linear-gradient(170deg, rgba(255,255,255,0.05) 0%, transparent 45%);
  pointer-events: none;
}
.dash-tile:hover {
  background:   var(--surface-2);
  border-color: var(--border-h);
  box-shadow:   var(--shadow-lg);
  transform:    translateY(-3px);
}
.dash-tile:active { transform: translateY(-1px); }

.dash-tile-icon {
  font-size:     1.75rem;
  line-height:   1;
  margin-bottom: 0.2rem;
}
.dash-tile-label {
  color:          var(--text);
  font-size:      1.05rem;
  font-weight:    700;
  letter-spacing: -0.015em;
}
.dash-tile-desc {
  color:       var(--muted);
  font-size:   0.82rem;
  line-height: 1.45;
}

/* Admin tile — accent glow */
.dash-tile-admin {
  background:   linear-gradient(145deg, var(--surface) 55%,
                rgba(99, 102, 241, 0.09));
  border-color: rgba(99, 102, 241, 0.22);
}
.dash-tile-admin .dash-tile-label { color: var(--accent); }
.dash-tile-admin:hover {
  border-color: var(--accent);
  box-shadow:   var(--shadow-lg), 0 0 28px rgba(99, 102, 241, 0.20);
}

/* ── Dashboard responsive ────────────────────────────────────────────────── */
@media (max-width: 540px) {
  body.dash-body { padding-top: 1.75rem; padding-bottom: 2rem; }
  .dash-identity-card {
    align-items:    flex-start;
    flex-direction: column;
    gap:            1rem;
    padding:        1.35rem;
  }
  .dash-welcome { font-size: 1.15rem; white-space: normal; }
  .dash-nav     { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 360px) {
  .dash-nav { grid-template-columns: 1fr; }
}

