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

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

body {
  font-family: 'Inter', sans-serif;
  background: #0d0d1a;
  color: #e0e0e0;
  min-height: 100vh;
}

/* ── Dashboard Layout (sidebar + main) ── */
.dashboard {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  background: #111128;
  border-right: 1px solid #1e1e3a;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 90;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid #1e1e3a;
}

.sidebar-brand h1 {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #7c5cfc, #00cc99);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.sidebar-brand .subtitle {
  font-size: 11px;
  color: #555;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: #888;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-link:hover {
  color: #ccc;
  background: rgba(124, 92, 252, 0.06);
}

.nav-link.active {
  color: #fff;
  background: rgba(124, 92, 252, 0.12);
  font-weight: 600;
}

.nav-link .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.nav-link .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7c5cfc;
  margin-left: auto;
  display: none;
}

.nav-link.active .nav-dot { display: block; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1e1e3a;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  color: #888;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-logout:hover {
  color: #ff6b6b;
  border-color: rgba(255, 68, 68, 0.3);
  background: rgba(255, 68, 68, 0.05);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

/* ── Page Header ── */
.page-header {
  padding: 32px 32px 24px;
  border-bottom: 1px solid #1e1e3a;
  background: linear-gradient(180deg, #111128 0%, #0d0d1a 100%);
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.page-header p {
  color: #666;
  font-size: 14px;
}

/* ── Container ── */
.container {
  max-width: 960px;
  padding: 24px 32px;
}

/* ── Alert Banner ── */
#alert-banner {
  display: none;
  background: linear-gradient(135deg, #ff4444, #cc0000);
  padding: 0;
  box-shadow: 0 4px 20px rgba(255, 0, 0, 0.3);
  animation: pulseGlow 2s ease-in-out infinite;
}

#alert-banner.visible { display: block; }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(255, 0, 0, 0.3); }
  50% { box-shadow: 0 4px 30px rgba(255, 0, 0, 0.5); }
}

.alert-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.alert-header .icon { font-size: 18px; }

.alert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 14px;
}

.alert-item .name { font-weight: 700; }
.alert-item .due-info { opacity: 0.9; font-size: 13px; }

/* ── Cards ── */
.card {
  background: #111128;
  border: 1px solid #1e1e3a;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Form Elements ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
}

.form-group input, .form-group select {
  background: #0d0d1a;
  border: 1px solid #1e1e3a;
  border-radius: 10px;
  padding: 11px 14px;
  color: #e0e0e0;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #7c5cfc;
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.12);
}

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #7c5cfc, #6342ff);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 92, 252, 0.3);
}

.btn-primary:active { transform: translateY(0); }

.btn-paid, .btn-unpaid {
  padding: 7px 16px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-paid {
  background: rgba(0, 204, 153, 0.1);
  color: #00cc99;
  border: 1px solid rgba(0, 204, 153, 0.2);
}

.btn-paid:hover { background: rgba(0, 204, 153, 0.15); }

.btn-unpaid {
  background: rgba(124, 92, 252, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(124, 92, 252, 0.2);
}

.btn-unpaid:hover { background: rgba(124, 92, 252, 0.18); }

.btn-delete {
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.btn-delete:hover {
  color: #ff6b6b;
  background: rgba(255, 68, 68, 0.08);
}

/* ── List Card ── */
.list-card {
  background: #111128;
  border: 1px solid #1e1e3a;
  border-radius: 14px;
  overflow: hidden;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #1e1e3a;
}

.list-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.badge {
  background: rgba(124, 92, 252, 0.1);
  color: #a78bfa;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #444;
}

.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Server Row ── */
.server-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid #1e1e3a;
  transition: background 0.15s;
}

.server-row:hover { background: rgba(124, 92, 252, 0.03); }
.server-row:last-child { border-bottom: none; }
.server-row.paid { opacity: 0.45; }

.server-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.server-due { font-size: 13px; color: #777; }
.server-due.urgent { color: #ff6b6b; font-weight: 600; }

.server-cost {
  font-weight: 700;
  color: #00cc99;
  font-size: 14px;
  white-space: nowrap;
}

/* ── Player Tracker: Status Card ── */
.status-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0 0;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: #00cc99;
  box-shadow: 0 0 12px rgba(0, 204, 153, 0.6);
  animation: statusPulse 2s ease-in-out infinite;
}

.status-dot.offline {
  background: #ff4444;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(0, 204, 153, 0.6); }
  50% { box-shadow: 0 0 20px rgba(0, 204, 153, 0.9); }
}

.status-info { flex: 1; }
.status-info .server-ip { font-size: 13px; color: #666; font-family: 'JetBrains Mono', monospace; }
.status-info .player-count { font-size: 18px; font-weight: 700; color: #e0e0e0; }
.status-info .player-count span { color: #00cc99; }

.status-label {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.status-label.online { background: rgba(0, 204, 153, 0.12); color: #00cc99; }
.status-label.offline { background: rgba(255, 68, 68, 0.12); color: #ff6b6b; }

/* ── Player Tracker: Online Players Grid ── */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #0d0d1a;
  border-radius: 10px;
  border: 1px solid #1e1e3a;
}

.player-card img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  image-rendering: pixelated;
}

.player-card .player-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-players {
  text-align: center;
  padding: 30px;
  color: #444;
  font-size: 14px;
}

/* ── Leaderboard Table ── */
.leaderboard-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.leaderboard th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  border-bottom: 2px solid #1e1e3a;
  white-space: nowrap;
}

.leaderboard td {
  padding: 11px 14px;
  border-bottom: 1px solid #1e1e3a;
  white-space: nowrap;
}

.leaderboard tr:last-child td { border-bottom: none; }
.leaderboard tr:hover { background: rgba(124, 92, 252, 0.03); }

.leaderboard .player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.leaderboard .player-cell img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  image-rendering: pixelated;
}

.leaderboard .time-cell { color: #555; }
.leaderboard .time-cell.highlight { color: #00cc99; font-weight: 600; }

.leaderboard-empty {
  text-align: center;
  padding: 40px 20px;
  color: #444;
  font-size: 14px;
}

/* ── Loading Spinner ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: #555;
  font-size: 14px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #1e1e3a;
  border-top-color: #7c5cfc;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error State ── */
.error-msg {
  background: rgba(255, 68, 68, 0.08);
  border: 1px solid rgba(255, 68, 68, 0.2);
  border-radius: 10px;
  padding: 12px 16px;
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 12px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-nav {
    display: flex !important;
  }

  .page-header { padding: 20px 16px 16px; }
  .container { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }

  .server-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .server-name { grid-column: 1 / -1; }
  .players-grid { grid-template-columns: 1fr; }
}

/* ── Mobile Nav (hidden on desktop) ── */
.mobile-nav {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #111128;
  border-bottom: 1px solid #1e1e3a;
  overflow-x: auto;
}

.mobile-nav .nav-brand {
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #7c5cfc, #00cc99);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-right: auto;
  white-space: nowrap;
}

.mobile-nav .nav-link {
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}
