/**
 * Noxara Edge — Premium Frontend Styles
 * Glassmorphism, animated orbs, cyan/purple accents, dark theme
 */

:root {
  --bg: #05070a;
  --bg-secondary: #0a0e17;
  --panel: rgba(15, 20, 28, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-hover: rgba(255, 255, 255, 0.12);
  --text: #e8eaf2;
  --text-dim: #b7c0d0;
  --muted: #6b7280;
  --accent: #22d3ee;
  --accent-glow: rgba(34, 211, 238, 0.4);
  --accent-secondary: #818cf8;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
  --glass-blur: blur(16px) saturate(180%);
  --glass-blur-strong: blur(24px) saturate(200%);
  --radius: 16px;
  --radius-lg: 24px;
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(15, 20, 28, 0.9) 0%, var(--bg) 100%);
  z-index: 0;
}

/* Animated background orbs */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
  animation: orb-drift 20s infinite alternate;
}
.orb-1 {
  width: 400px; height: 400px;
  background: var(--accent);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.orb-2 {
  width: 300px; height: 300px;
  background: var(--accent-secondary);
  bottom: -50px; right: -50px;
  animation-delay: -5s;
}
.orb-3 {
  width: 500px; height: 500px;
  background: #7c3aed;
  top: 20%; left: 60%;
  animation-delay: -10s;
}
@keyframes orb-drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, -60px) scale(1.1); }
}

/* Grid pattern */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 2;
  background-image:
    linear-gradient(var(--panel-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--panel-border) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 50%, black 25%, transparent 75%);
  pointer-events: none;
}

/* Layout */
.page {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.page.hidden { display: none; opacity: 0; }

/* Auth card */
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 48px 32px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--glass-blur-strong);
  box-shadow: 0 25px 80px -15px rgba(0,0,0,0.6);
  animation: cardFadeIn 0.6s ease-out;
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: #000;
  box-shadow: 0 0 20px var(--accent-glow);
}
.name { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.name .sub { font-weight: 400; font-size: 13px; opacity: 0.6; margin-left: 4px; }

h1 { font-size: 26px; margin-bottom: 8px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { font-size: 14px; color: var(--muted); margin-bottom: 24px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); font-weight: 600;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
  background: rgba(0,0,0,0.4);
}

.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #000;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.6; cursor: not-allowed; transform: none;
}
.btn-loader {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--panel-border);
  padding: 8px 16px;
  font-size: 13px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); }

.msg {
  margin-top: 14px;
  font-size: 13px; padding: 10px 14px; border-radius: 8px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg { background: rgba(248, 113, 113, 0.15); color: var(--danger); border: 1px solid rgba(248, 113, 113, 0.3); }
.msg.ok { background: rgba(74, 222, 128, 0.15); color: var(--success); border: 1px solid rgba(74, 222, 128, 0.3); }

.hint { margin-top: 20px; font-size: 12px; color: var(--muted); text-align: center; }

/* Dashboard nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: 72px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  z-index: 100;
  backdrop-filter: var(--glass-blur-strong);
}
.nav-brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.5px;
}
.nav-brand .mark { width: 28px; height: 28px; font-size: 14px; box-shadow: none; }
.nav-brand .sub { font-size: 11px; }

.nav-links { display: flex; gap: 20px; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: color 0.2s; padding: 8px 12px; border-radius: 8px;
}
.nav-link:hover, .nav-link.active { color: var(--accent); background: rgba(34, 211, 238, 0.1); }

.nav-user { display: flex; align-items: center; gap: 16px; }
.user-badge {
  font-size: 12px; color: var(--text-dim); padding: 6px 12px;
  background: rgba(255,255,255,0.05); border-radius: 20px;
  border: 1px solid var(--panel-border);
}

/* Dashboard main */
.dashboard {
  max-width: 1300px;
  margin: 80px auto 40px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .nav { padding: 0 16px; }
  .nav-links { display: none; }
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: var(--glass-blur);
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.4);
  animation: panelFade 0.4s ease;
}
@keyframes panelFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel.hidden { display: none; }

.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-header h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.panel-header .subtitle { font-size: 12px; color: var(--muted); margin-top: 4px; }

.badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; padding: 4px 10px; border-radius: 20px;
}
.badge-edge {
  background: var(--accent-glow);
  color: #000;
  border: 1px solid var(--accent);
}

.muted { color: var(--muted); font-size: 13px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 640px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: rgba(0,0,0,0.25);
  padding: 20px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  transition: transform 0.2s, border-color 0.2s;
}
.stat-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat-trend { font-size: 11px; margin-top: 6px; }
.stat-trend.positive { color: var(--success); }
.stat-trend.neutral { color: var(--muted); }

/* Tables */
.table-wrap { overflow: auto; border: 1px solid var(--panel-border); border-radius: 12px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 12px 16px; color: var(--muted); font-size: 10px; text-transform: uppercase; border-bottom: 1px solid var(--panel-border); font-weight: 600; }
td { padding: 12px 16px; border-bottom: 1px solid var(--panel-border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.03); }
code { font-family: 'JetBrains Mono', monospace; font-size: 11px; background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; color: var(--accent); }

/* Charts */
.chart-wrap { margin-top: 24px; }
.chart-wrap h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text); }

/* Loader card */
.loader-card { display: flex; flex-direction: column; gap: 16px; }
.loader-info h3 { margin-bottom: 6px; font-size: 17px; }
.loader-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.output { margin-top: 12px; padding: 16px; background: rgba(0,0,0,0.4); border-radius: 10px; font-family: 'JetBrains Mono', SFMono-Regular, monospace; font-size: 11px; color: var(--accent); white-space: pre-wrap; border: 1px solid var(--panel-border); }

/* Toast notifications */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.6);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }

/* Turnstile */
.turnstile-wrap { margin: 16px 0; display: flex; justify-content: center; min-height: 80px; }
.turnstile-loading {
  display: none; font-size: 12px; color: var(--muted); text-align: center; margin-top: 8px;
}
</style>