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

:root {
  --red: #ff1a1a;
  --red-bright: #ff4444;
  --red-deep: #b30000;
  --red-dim: rgba(255, 26, 26, 0.14);
  --red-dim-strong: rgba(255, 26, 26, 0.22);
  --red-border: rgba(255, 40, 40, 0.45);
  --red-glow: rgba(255, 0, 0, 0.35);
  --red-glow-soft: rgba(255, 0, 0, 0.12);
  --bg: #050505;
  --sidebar: #0a0a0a;
  --surface: #0f0f0f;
  --surface2: #161616;
  --surface3: #1c1c1c;
  --border: rgba(255, 50, 50, 0.12);
  --border-strong: rgba(255, 50, 50, 0.28);
  --text: #f5f5f5;
  --muted: #9a9a9a;
  --accent: #ff1a1a;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ff3333;
  --radius: 14px;
  --font: 'Poppins', -apple-system, system-ui, sans-serif;
  --mono: 'Consolas', 'Courier New', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(255, 0, 0, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(255, 0, 0, 0.14) 0%, transparent 50%),
    linear-gradient(180deg, #030303 0%, #080808 40%, #050505 100%);
  z-index: -2;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 0, 0, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 0, 0, 0.055) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, black 20%, transparent 85%);
  z-index: -1;
  pointer-events: none;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ─── Layout ─── */
.dashboard {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 268px;
  background: linear-gradient(180deg, rgba(14, 14, 14, 0.98) 0%, rgba(8, 8, 8, 0.98) 100%);
  border-right: 1px solid var(--red-border);
  box-shadow: 4px 0 40px rgba(255, 0, 0, 0.08);
  padding: 1.35rem 1rem;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 10;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, var(--red), transparent);
  opacity: 0.5;
  pointer-events: none;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem 1.35rem;
  border-bottom: 1px solid var(--border-strong);
  margin-bottom: 1.25rem;
}

.logo-icon-wrap {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--red-deep), var(--red));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px var(--red-glow-soft);
  color: #fff;
  font-size: 1.1rem;
}

.sidebar .logo { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.sidebar .logo span { color: var(--red); text-shadow: 0 0 20px var(--red-glow); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  color: #aaa;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}

.nav-item i { width: 20px; text-align: center; font-size: 1rem; }

.nav-item:hover {
  background: var(--red-dim);
  color: #fff;
  border-color: rgba(255, 0, 0, 0.2);
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(255, 0, 0, 0.2) 0%, rgba(255, 0, 0, 0.04) 100%);
  color: #fff;
  border-color: var(--red-border);
  border-left: 3px solid var(--red);
  box-shadow: 0 0 24px var(--red-glow-soft);
}

.nav-item.active i { color: var(--red-bright); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-strong);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.95rem 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.user-chip img {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--red-border);
}

.nav-logout:hover {
  color: #ff8888 !important;
  border-color: rgba(255, 60, 60, 0.35) !important;
  background: rgba(255, 0, 0, 0.1) !important;
}

.main {
  flex: 1;
  padding: 1.75rem 2.25rem;
  overflow-y: auto;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-strong);
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.page-header h1 i { color: var(--red); filter: drop-shadow(0 0 8px var(--red-glow)); }
.page-sub { color: var(--muted); font-size: 0.88rem; margin-top: 0.35rem; }
.header-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(135deg, #ff3333 0%, #cc0000 50%, #990000 100%);
  color: #fff;
  border: 1px solid rgba(255, 100, 100, 0.4);
  box-shadow: 0 4px 24px var(--red-glow-soft);
}

.btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--red-glow);
}

.btn.secondary {
  background: rgba(255, 0, 0, 0.06);
  color: #fff;
  border: 1px solid var(--red-border);
}

.btn.secondary:hover:not(:disabled) {
  background: var(--red-dim-strong);
  border-color: var(--red-bright);
}

.btn.danger {
  background: rgba(255, 40, 40, 0.15);
  color: #ffaaaa;
  border: 1px solid rgba(255, 60, 60, 0.4);
}

.btn.danger:hover:not(:disabled) { background: var(--red); color: #fff; }

.btn.sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; border-radius: 8px; }
.btn.w-full { width: 100%; }

/* ─── Stats ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  position: relative;
  background: linear-gradient(145deg, rgba(22, 22, 22, 0.95), rgba(12, 12, 12, 0.98));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255, 0, 0, 0.5), transparent);
}

.stat-card:hover {
  border-color: var(--red-border);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 30px var(--red-glow-soft);
}

.stat-card .label {
  color: #888;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stat-card .label i { color: var(--red); font-size: 0.75rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.stat-card.stat-hero { border-color: rgba(255, 0, 0, 0.5); box-shadow: 0 0 40px var(--red-glow-soft); }
.stat-card .value.green { color: var(--success); }
.stat-card .value.yellow { color: var(--warning); }
.stat-card .value.red { color: var(--red-bright); }

/* ─── Cards ─── */
.card {
  background: linear-gradient(160deg, rgba(18, 18, 18, 0.98), rgba(10, 10, 10, 0.98));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header h2 i { color: var(--red); font-size: 0.9rem; }
.card-body { padding: 1.25rem; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 1rem; }
}

/* ─── Forms ─── */
label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #bbb;
  margin-bottom: 0.35rem;
  margin-top: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

label:first-child { margin-top: 0; }
label i { margin-right: 0.35rem; color: var(--red); }

input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-dim), 0 0 20px var(--red-glow-soft);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-card { max-width: 480px; }

.toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input, .toolbar select {
  width: auto;
  min-width: 180px;
}

/* ─── Table ─── */
.table-wrap { overflow-x: auto; }

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

.data-table th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
  background: rgba(255, 0, 0, 0.03);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.empty-row, .empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 2rem !important;
}

.key-cell {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--red-bright);
  cursor: pointer;
}

.key-cell:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-active { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-paused { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-banned { background: rgba(255, 26, 26, 0.15); color: var(--red-bright); }

.actions-cell { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.hwid-cell {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hwid-bound { color: var(--success); }
.hwid-unbound { font-style: italic; }

/* ─── Generate result ─── */
.gen-key {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.65rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s;
}

.gen-key:hover { background: var(--red-dim); border-color: var(--red-border); }
.copy-hint { font-size: 0.7rem; color: var(--muted); }

/* ─── Quick actions ─── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.quick-btn {
  padding: 1rem;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
}

.quick-btn i { display: block; font-size: 1.4rem; color: var(--red); margin-bottom: 0.5rem; }
.quick-btn:hover { border-color: var(--red-border); background: var(--red-dim); transform: translateY(-2px); }

/* ─── API docs ─── */
.code-block {
  background: #0a0a0a;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  color: #ccc;
  overflow-x: auto;
  margin: 0.75rem 0;
  white-space: pre-wrap;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.info-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.info-item .info-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; margin-bottom: 0.35rem; }
.info-item .info-value { font-weight: 600; font-size: 0.95rem; word-break: break-all; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  padding: 0.85rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-size: 0.875rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--red); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ─── Modal ─── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--red-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.modal-content h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.modal-content p { color: var(--muted); font-size: 0.875rem; margin-bottom: 1.25rem; line-height: 1.5; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }

.loading-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  padding: 1.5rem;
}

.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ─── Login ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

.login-card {
  background: linear-gradient(160deg, rgba(20, 20, 20, 0.98), rgba(10, 10, 10, 0.98));
  border: 1px solid var(--red-border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.7), 0 0 80px var(--red-dim);
  text-align: center;
}

.login-card .logo-icon-wrap {
  width: 56px; height: 56px;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
}

.login-card h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.login-card h1 span { color: var(--red); }
.login-card .subtitle { color: var(--muted); font-size: 0.875rem; margin-bottom: 2rem; }

.error-banner {
  background: rgba(255, 26, 26, 0.1);
  border: 1px solid var(--red-border);
  color: var(--red-bright);
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  margin-bottom: 1.25rem;
  text-align: left;
  line-height: 1.5;
}

.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: #5865F2;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font);
  transition: background 0.2s, transform 0.15s;
}

.btn-discord:hover { background: #4752C4; transform: translateY(-2px); }
.login-note { margin-top: 1.5rem; font-size: 0.75rem; color: var(--muted); }

.secret-reveal {
  background: var(--surface2);
  border: 1px solid var(--success);
  border-radius: 10px;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  word-break: break-all;
  margin-top: 0.75rem;
  color: var(--success);
}
