@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #000000;
  --surface: #0a0f14;
  --surface-2: #111921;
  --surface-3: #18222e;
  --surface-hover: #1c2836;
  --text: #e8f4f8;
  --text-2: #5e8a9a;
  --text-3: #3d5f6e;
  --accent: #00e5c8;
  --accent-2: #00b4d8;
  --accent-dim: rgba(0, 229, 200, 0.08);
  --accent-glow: rgba(0, 229, 200, 0.15);
  --accent-strong: rgba(0, 229, 200, 0.25);
  --danger: #ff4d6a;
  --danger-dim: rgba(255, 77, 106, 0.1);
  --success: #00e5c8;
  --warning: #ffb347;
  --border: #1a2a35;
  --border-accent: rgba(0, 229, 200, 0.2);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.6);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }
::selection { background: var(--accent); color: var(--bg); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: scale(0.95) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 8px var(--accent-dim), 0 0 24px var(--accent-dim); } 50% { box-shadow: 0 0 12px var(--accent-glow), 0 0 40px var(--accent-glow); } }
@keyframes borderGlow { 0%, 100% { border-color: var(--border); } 50% { border-color: var(--border-accent); } }
.fade-up { animation: fadeUp 0.4s ease-out both; }
.fade-up-1 { animation-delay: 0.05s; }
.fade-up-2 { animation-delay: 0.1s; }
.fade-up-3 { animation-delay: 0.15s; }
.fade-up-4 { animation-delay: 0.2s; }

/* Header */
header {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.5px;
}
.header-nav { display: flex; align-items: center; gap: 2px; }
.header-nav a {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.header-nav a svg { width: 14px; height: 14px; opacity: 0.6; }
.header-nav a:hover { color: var(--text); background: var(--surface-2); }
.header-nav a.active { color: var(--accent); background: var(--accent-dim); }
.header-nav a.active svg { opacity: 1; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-right a.btn-ghost { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; font-size: 11px; white-space: nowrap; line-height: 1; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: var(--bg); font-size: 12px; font-weight: 700;
}
.user-id {
  font-size: 11px; color: var(--text-2); cursor: pointer;
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border);
  transition: var(--transition); font-family: 'JetBrains Mono', monospace;
  display: inline-flex; align-items: center; gap: 4px; line-height: 1;
}
.user-id svg { width: 12px; height: 12px; opacity: 0.6; }
.user-id:hover { border-color: var(--accent); color: var(--accent); }

/* Auth */
.auth-page {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 20%, rgba(0, 229, 200, 0.04) 0%, var(--bg) 60%);
  padding: 40px 20px; position: relative;
}
.auth-page::before {
  content: ''; position: absolute; top: -100px; left: 50%; transform: translateX(-50%);
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0, 229, 200, 0.06) 0%, transparent 70%);
  pointer-events: none;
}
.auth-page h1 {
  font-size: 38px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #fff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 6px; position: relative;
}
.auth-page .subtitle { color: var(--text-2); margin-bottom: 32px; font-size: 14px; letter-spacing: 0.3px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg); animation: slideIn 0.4s ease-out;
}
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card label {
  font-size: 11px; font-weight: 600; color: var(--text-2);
  display: flex; flex-direction: column; gap: 5px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.auth-card input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px;
  color: var(--text); transition: var(--transition);
}
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg); border: none; border-radius: var(--radius-sm);
  padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: var(--transition); letter-spacing: 0.3px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-google {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px; font-size: 13px;
  font-weight: 500; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: var(--transition); width: 100%;
}
.btn-google:hover { border-color: var(--accent); background: var(--surface-3); }
.divider {
  display: flex; align-items: center; gap: 12px; color: var(--text-3);
  font-size: 10px; margin: 12px 0; text-transform: uppercase; letter-spacing: 1px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-card .switch { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 14px; }
.auth-card .error { color: var(--danger); font-size: 12px; min-height: 16px; text-align: center; }

/* Layout */
.dashboard { max-width: 1100px; margin: 0 auto; padding: 24px 20px; flex: 1; }

/* Quick Actions Bar */
.quick-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0; margin-bottom: 20px; border-bottom: 1px solid var(--border);
}
.quick-bar .balance-display {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; white-space: nowrap;
}
.quick-bar .balance-display .label {
  font-size: 10px; color: var(--text-2); text-transform: uppercase;
  line-height: 1;
}
.quick-bar .balance-display .amount {
  font-size: 16px; font-weight: 700; color: var(--accent);
  font-family: 'JetBrains Mono', monospace; line-height: 1;
}

/* API Key Compact */
.api-key-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px; flex: 1;
}
.api-key-bar code {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.api-key-bar .key-actions { display: flex; gap: 2px; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-accent); }
.stat-label { font-size: 10px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-value { font-size: 20px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.stat-value.accent { color: var(--accent); }

/* Content Grid */
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; transition: var(--transition);
}
.panel:hover { border-color: var(--border-accent); }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 13px; font-weight: 600; }
.panel-header .badge { font-size: 10px; color: var(--text-2); background: var(--surface-2); padding: 2px 8px; border-radius: 4px; }

/* Model rows */
.model-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.model-row:last-child { border-bottom: none; }
.model-name { font-size: 12px; font-weight: 600; }
.model-desc { font-size: 10px; color: var(--text-2); margin-top: 1px; }
.model-mult { font-size: 12px; font-weight: 700; color: var(--accent); font-family: 'JetBrains Mono', monospace; }

/* Models page */
.models-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.model-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; transition: var(--transition);
  cursor: default;
}
.model-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 229, 200, 0.04); }
.model-card-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.model-card-provider { font-size: 9px; color: var(--text-3); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.model-card-price { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.model-card-desc { font-size: 11px; color: var(--text-2); line-height: 1.5; }

/* Logs table */
.logs-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.logs-table th, .logs-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.logs-table th { font-size: 10px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.logs-table tr:hover td { background: var(--surface-2); }
.logs-table td { color: var(--text-2); }

/* Empty state */
.empty-state { text-align: center; padding: 32px 20px; color: var(--text-3); }
.empty-state svg { width: 36px; height: 36px; opacity: 0.3; margin-bottom: 10px; }

/* Settings */
.settings-page { max-width: 560px; margin: 0 auto; padding: 24px 20px; }
.settings-page h2 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 12px;
}
.settings-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.settings-card input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px;
  color: var(--text); width: 100%; margin-bottom: 8px; transition: var(--transition);
}
.settings-card input:focus { outline: none; border-color: var(--accent); }
.keys-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.key-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; transition: var(--transition);
}
.key-item:hover { border-color: var(--border-accent); }
.key-item .name { font-size: 12px; font-weight: 600; }
.key-item .val { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-2); }

/* Admin */
.admin-page { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.admin-page h2 { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.admin-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.admin-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; text-align: center;
}
.admin-stat .val { font-size: 18px; font-weight: 700; color: var(--accent); font-family: 'JetBrains Mono', monospace; }
.admin-stat .lbl { font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.admin-toolbar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.admin-toolbar input {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 12px; font-size: 12px;
  color: var(--text); flex: 1; transition: var(--transition);
}
.admin-toolbar input:focus { outline: none; border-color: var(--accent); }

.admin-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--surface-2); font-size: 10px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table tr:hover td { background: var(--surface-2); }
.admin-table td { color: var(--text-2); }
.admin-actions { display: flex; gap: 4px; }
.banned-badge { background: var(--danger-dim); color: var(--danger); padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.ok-badge { background: rgba(0, 229, 200, 0.1); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; }

/* Buttons */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: none; border-radius: var(--radius-sm); padding: 7px 12px;
  font-size: 12px; font-weight: 500; cursor: pointer; transition: var(--transition);
  font-family: 'Inter', sans-serif;
}
.btn-accent { background: var(--accent); color: var(--bg); font-weight: 600; }
.btn-accent:hover { box-shadow: 0 4px 16px var(--accent-glow); transform: translateY(-1px); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger-dim); border: 1px solid rgba(255, 77, 106, 0.2); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 77, 106, 0.2); }
.btn-sm { padding: 5px 9px; font-size: 11px; }
.btn-xs { padding: 3px 7px; font-size: 10px; border-radius: 5px; }

.icon-btn {
  background: none; border: 1px solid transparent; color: var(--text-2);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 6px; transition: var(--transition); padding: 0;
}
.icon-btn:hover { color: var(--accent); border-color: var(--border-accent); background: var(--accent-dim); }
.icon-btn svg { width: 14px; height: 14px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px); display: flex; align-items: center;
  justify-content: center; z-index: 1000;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; max-width: 420px;
  width: 90%; box-shadow: var(--shadow-lg); animation: slideIn 0.25s ease-out;
}
.modal h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.modal-key {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.modal-key code {
  flex: 1; font-size: 11px; word-break: break-all; user-select: all;
  font-family: 'JetBrains Mono', monospace; color: var(--accent);
}
.topup-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.topup-grid button {
  padding: 14px; font-size: 15px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; color: var(--text); transition: var(--transition);
}
.topup-grid button:hover { border-color: var(--accent); background: var(--surface-3); transform: translateY(-2px); }
.topup-grid button span { font-size: 10px; font-weight: 400; color: var(--text-2); display: block; margin-top: 3px; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; right: 20px; background: var(--surface);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 12px; color: var(--accent);
  box-shadow: var(--shadow); z-index: 2000; animation: slideIn 0.2s ease-out;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border); margin-top: auto;
  padding: 32px 24px 20px; background: var(--surface);
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px;
}
.footer-brand {
  font-size: 16px; font-weight: 800; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.footer-col p, .footer-col a {
  font-size: 11px; color: var(--text-3); line-height: 1.8; display: block;
}
.footer-col a { transition: color 0.2s; display: flex; align-items: center; gap: 4px; }
.footer-col a:hover { color: var(--accent); }
.footer-title { font-size: 11px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.payment-logos { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-badge {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 8px; font-size: 10px; font-weight: 600;
  color: var(--text-2); letter-spacing: 0.3px;
}
.footer-bottom {
  max-width: 1100px; margin: 16px auto 0; padding-top: 12px;
  border-top: 1px solid var(--border); text-align: center;
}
.footer-bottom p { font-size: 10px; color: var(--text-3); }

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 16px; }
}

/* Cursor trail */
.trail {
  position: fixed; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); pointer-events: none; z-index: 9999;
  opacity: 0.6; transition: transform 0.15s, opacity 0.4s; mix-blend-mode: screen;
}

/* Responsive */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  header { padding: 0 12px; }
  .dashboard { padding: 16px 12px; }
  .models-list { grid-template-columns: repeat(2, 1fr); }
  .header-nav { gap: 1px; }
  .header-nav a { padding: 6px 8px; font-size: 11px; }
  .quick-bar { flex-wrap: wrap; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 16px; }
}
