/* ============================================================
   1337 PANEL — PREMIUM DESIGN SYSTEM
   Deep-space theme
   ============================================================ */

:root {
  color-scheme: dark;
  --radius-lg: 12px;
  --radius-md: 8px;
  --color-primary: #38bdf8;
  --color-primary-hover: #7dd3fc;
  --ui-surface: rgba(8, 15, 30, 0.78);
  --ui-surface-strong: rgba(6, 10, 22, 0.82);
  --ui-surface-elevated: rgba(10, 18, 36, 0.88);
  --ui-border: rgba(56, 189, 248, 0.1);
  --ui-border-strong: rgba(56, 189, 248, 0.25);
  --ui-ring: rgba(56, 189, 248, 0.15);
  --ui-glow: 0 0 16px rgba(56, 189, 248, 0.1);
  --sb-w: 256px;
  --sb-w-collapsed: 68px;
  --sb-speed: 240ms;
  --sb-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100vh; margin: 0; }
body {
  background: #020408;
  color: #e2e8f0;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(56,189,248,0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(56,189,248,0.4); }
::selection { background: rgba(56,189,248,0.25); color: #f0f9ff; }

/* ============================================================
   STARFIELD
   ============================================================ */

@keyframes starfieldDrift1 {
  from { transform: translateX(0); }
  to   { transform: translateX(-2000px); }
}
@keyframes starfieldDrift2 {
  from { transform: translateX(0); }
  to   { transform: translateX(-3000px); }
}
@keyframes nebulaShift {
  0%   { opacity: 0.3; transform: scale(1) translate(0, 0); }
  50%  { opacity: 0.5; transform: scale(1.05) translate(-1%, 2%); }
  100% { opacity: 0.3; transform: scale(1) translate(0, 0); }
}

#starfield {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 40% at 15% 20%, rgba(56,189,248,0.08), transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 70%, rgba(56,189,248,0.06), transparent 55%),
    radial-gradient(ellipse 70% 30% at 50% 90%, rgba(14,165,233,0.05), transparent 50%);
  animation: nebulaShift 30s ease-in-out infinite;
}
#starfield::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 4000px; height: 100%;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 25% 35%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 40% 10%, rgba(186,230,253,0.8), transparent),
    radial-gradient(1px 1px at 55% 45%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 70% 20%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 85% 55%, rgba(147,197,253,0.7), transparent),
    radial-gradient(1px 1px at 15% 60%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 30% 80%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 50% 70%, rgba(196,181,253,0.6), transparent),
    radial-gradient(1px 1px at 65% 85%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 80% 40%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 92% 75%, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 48% 25%, rgba(56,189,248,0.9), transparent),
    radial-gradient(1px 1px at 60% 5%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 35% 95%, rgba(147,197,253,0.5), transparent);
  background-size: 2000px 100%;
  animation: starfieldDrift1 120s linear infinite;
}
#starfield::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 4000px; height: 100%;
  background-image:
    radial-gradient(2px 2px at 12% 22%, rgba(56,189,248,0.6), transparent),
    radial-gradient(1.5px 1.5px at 33% 68%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 58% 18%, rgba(147,197,253,0.7), transparent),
    radial-gradient(1.5px 1.5px at 78% 48%, rgba(255,255,255,0.4), transparent),
    radial-gradient(2.5px 2.5px at 22% 82%, rgba(96,165,250,0.8), transparent),
    radial-gradient(1.5px 1.5px at 45% 38%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 88% 72%, rgba(196,181,253,0.6), transparent),
    radial-gradient(1.5px 1.5px at 65% 92%, rgba(255,255,255,0.4), transparent),
    radial-gradient(2px 2px at 8% 55%, rgba(56,189,248,0.5), transparent);
  background-size: 3000px 100%;
  animation: starfieldDrift2 200s linear infinite;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes loginCardAppear {
  0%   { opacity: 0; transform: translateY(40px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes loginLogoAppear {
  0%   { opacity: 0; transform: scale(0.5); filter: drop-shadow(0 0 0 transparent); }
  60%  { opacity: 1; transform: scale(1.04); filter: drop-shadow(0 0 28px rgba(56,189,248,0.5)); }
  100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 20px rgba(56,189,248,0.35)); }
}
@keyframes logoGlow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(56,189,248,0.3)); }
  50%      { filter: drop-shadow(0 0 35px rgba(56,189,248,0.5)) drop-shadow(0 0 60px rgba(56,189,248,0.2)); }
}
@keyframes gradientShift {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1); }
  50%  { transform: translate3d(2%, 3%, 0) scale(1.04); }
  100% { transform: translate3d(-1%, 4%, 0) scale(1.02); }
}
@keyframes shimmerSweep {
  from { transform: translateX(-120%); }
  to   { transform: translateX(120%); }
}
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-6px); }
  30%      { transform: translateX(5px); }
  45%      { transform: translateX(-4px); }
  60%      { transform: translateX(3px); }
  75%      { transform: translateX(-2px); }
}
@keyframes float-particle {
  0%       { transform: translateY(0) translateX(0); opacity: 0; }
  10%      { opacity: 1; }
  90%      { opacity: 1; }
  100%     { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes progressPulse {
  0%, 100% { width: 30%; opacity: 0.7; }
  50% { width: 70%; opacity: 1; }
}
@property --login-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes loginBorderRotate {
  to { --login-angle: 360deg; }
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-nebula {
  position: relative;
}
.login-nebula::before {
  content: '';
  position: fixed; inset: -20%;
  background:
    radial-gradient(40% 40% at 20% 20%, rgba(56,189,248,0.15), transparent 55%),
    radial-gradient(35% 35% at 80% 30%, rgba(14,165,233,0.12), transparent 55%),
    radial-gradient(50% 50% at 50% 80%, rgba(56,189,248,0.08), transparent 50%);
  filter: blur(60px);
  animation: gradientShift 20s ease-in-out infinite alternate;
  opacity: 0.8;
  pointer-events: none;
  z-index: 0;
}

.login-card {
  animation: loginCardAppear 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
  position: relative;
}
.login-card::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: 24px;
  padding: 1px;
  background: conic-gradient(from var(--login-angle, 0deg), rgba(56,189,248,0.35), transparent 40%, rgba(14,165,233,0.25), transparent 80%, rgba(56,189,248,0.35));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: loginBorderRotate 8s linear infinite;
}
.login-logo-anim {
  opacity: 0;
  animation: loginLogoAppear 1s ease-out 0.15s forwards, logoGlow 4s ease-in-out 1.15s infinite;
}
.shake-error {
  animation: shakeError 0.5s ease;
}

.particle {
  position: absolute;
  width: 2px; height: 2px;
  background: radial-gradient(circle, rgba(56,189,248,0.8), transparent);
  border-radius: 50%;
  animation: float-particle linear infinite;
}

.login-input {
  background: rgba(2,6,18,0.6);
  border: 1px solid rgba(56,189,248,0.08);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: #e2e8f0;
  width: 100%;
  outline: none;
  font-size: 15px;
  transition: all 0.25s ease;
}
.login-input::placeholder { color: #475569; }
.login-input:focus {
  border-color: rgba(56,189,248,0.6);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.1), 0 0 30px rgba(56,189,248,0.1), inset 0 0 20px rgba(56,189,248,0.03);
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  background: linear-gradient(180deg, rgba(2,6,18,0.82) 0%, rgba(6,10,22,0.86) 50%, rgba(2,6,18,0.88) 100%);
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  border-right: 1px solid rgba(56,189,248,0.06);
  transition: width var(--sb-speed) var(--sb-ease);
}

.sb-glow-bottom {
  pointer-events: none;
  position: absolute; bottom: 0; left: 0; right: 0; height: 128px;
  background: radial-gradient(ellipse 70% 50% at 50% 100%, rgba(56,189,248,0.06), transparent);
}

.sb-header-line {
  position: absolute; bottom: 0; left: 16px; right: 16px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56,189,248,0.2), transparent);
}

.sb-section-label {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 3px; color: rgba(56,189,248,0.4);
}
.sb-section-line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(56,189,248,0.12), transparent);
}

.sb-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  color: #cbd5e1; cursor: pointer;
  transition: all 0.2s; position: relative;
  text-decoration: none;
}
.sb-link:hover {
  color: #f1f5f9;
  background: rgba(56,189,248,0.04);
}
.sb-link.active {
  color: #38bdf8;
  background: linear-gradient(90deg, rgba(56,189,248,0.08), rgba(56,189,248,0.02));
  box-shadow: inset 0 0 20px rgba(56,189,248,0.04);
}
.sb-link .sb-indicator {
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2px; border-radius: 999px;
  transition: all 0.3s;
}
.sb-link.active .sb-indicator {
  height: 60%;
  background: linear-gradient(180deg, rgba(56,189,248,0.8), rgba(56,189,248,0.3));
  box-shadow: 0 0 8px rgba(56,189,248,0.5), 0 0 16px rgba(56,189,248,0.2);
}
.sb-link:not(.active) .sb-indicator { height: 0; }
.sb-link:hover:not(.active) .sb-indicator {
  height: 50%; background: rgba(56,189,248,0.25);
}
.sb-link.active .sb-active-bg {
  position: absolute; inset: 0; border-radius: 8px;
  background: linear-gradient(90deg, rgba(56,189,248,0.08), rgba(56,189,248,0.02));
  pointer-events: none;
}
.sb-link svg {
  transition: all 0.2s;
}
.sb-link.active svg {
  filter: drop-shadow(0 0 8px rgba(56,189,248,0.5));
}
.sb-link:hover:not(.active) svg {
  transform: scale(1.1);
  filter: drop-shadow(0 0 6px rgba(56,189,248,0.3));
}

.sb-user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  background: rgba(56,189,248,0.03);
  border: 1px solid rgba(56,189,248,0.06);
}
.sb-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(14,165,233,0.08));
  border: 1px solid rgba(56,189,248,0.15);
  color: #38bdf8; font-size: 14px;
}
.sb-separator {
  margin: 0 8px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56,189,248,0.15), transparent);
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--ui-surface);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative; overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.25s;
}
.card:hover {
  border-color: rgba(56,189,248,0.18);
  box-shadow: var(--ui-glow);
}
.card::before {
  content: '';
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(110deg, transparent 20%, rgba(56,189,248,0.03) 50%, transparent 80%);
  opacity: 0; transition: opacity 0.4s; pointer-events: none;
}
.card:hover::before { opacity: 1; }

.card-strong {
  background: var(--ui-surface-strong);
  border: 1px solid var(--ui-border-strong);
  border-radius: 16px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.06), 0 24px 48px rgba(0,0,0,0.35);
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
  color: white; font-weight: 600;
  padding: 12px 28px; border-radius: 10px;
  border: none; cursor: pointer;
  position: relative; overflow: hidden;
  transition: all 0.2s ease;
  font-size: inherit;
}
.btn-primary:hover {
  box-shadow: 0 0 30px rgba(14,165,233,0.45), 0 0 60px rgba(56,189,248,0.15);
  filter: brightness(1.1);
}
.btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,0.1) 50%, transparent 80%);
  transform: translateX(-120%);
  pointer-events: none;
}
.btn-primary:hover::after { animation: shimmerSweep 0.8s ease forwards; }
.btn-primary:disabled {
  opacity: 0.45; cursor: not-allowed;
  filter: none; box-shadow: none;
}
.btn-primary:disabled::after { animation: none; }

.btn-outline {
  background: transparent; color: #38bdf8;
  font-weight: 500; padding: 10px 22px;
  border-radius: 10px;
  border: 1px solid rgba(56,189,248,0.35);
  cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-outline:hover {
  background: rgba(56,189,248,0.1);
  border-color: #38bdf8;
}

/* ============================================================
   INPUTS
   ============================================================ */

.input {
  background: var(--ui-surface-strong);
  border: 1px solid rgba(56,189,248,0.08);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  color: #e2e8f0; width: 100%;
  outline: none; transition: all 0.25s;
}
.input::placeholder { color: #475569; }
.input:focus {
  border-color: rgba(56,189,248,0.5);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.1), 0 0 20px rgba(56,189,248,0.08);
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ============================================================
   TOGGLES
   ============================================================ */

.toggle-track {
  width: 42px; height: 24px; border-radius: 12px;
  background: rgba(100,116,139,0.35);
  border: 1px solid rgba(100,116,139,0.25);
  cursor: pointer; position: relative;
  transition: all 0.25s; flex-shrink: 0;
}
.toggle-track.active {
  background: rgba(56,189,248,0.28);
  border-color: #38bdf8;
}
.toggle-knob {
  width: 18px; height: 18px; border-radius: 50%;
  background: #94a3b8;
  position: absolute; top: 2px; left: 2px;
  transition: all 0.25s;
}
.toggle-track.active .toggle-knob {
  left: 20px; background: #38bdf8;
  box-shadow: 0 0 10px rgba(56,189,248,0.55);
}

/* ============================================================
   STATUS, PROGRESS, STATS
   ============================================================ */

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.status-dot.processing { background: #38bdf8; animation: pulse 1.4s ease-in-out infinite; }
.status-dot.done { background: #22c55e; }
.status-dot.error { background: #ef4444; }

.stat-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  backdrop-filter: blur(10px);
  position: relative; overflow: hidden;
  transition: all 0.25s;
}
.stat-card:hover {
  border-color: rgba(56,189,248,0.22);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2), var(--ui-glow);
}
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.25rem; font-weight: 700;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
  animation: countUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.stat-card:nth-child(2) .stat-value { animation-delay: 0.06s; }
.stat-card:nth-child(3) .stat-value { animation-delay: 0.12s; }
.stat-card:nth-child(4) .stat-value { animation-delay: 0.18s; }

.progress-bar {
  height: 3px; border-radius: 2px;
  background: rgba(56,189,248,0.15);
  overflow: hidden; margin-top: 12px;
}
.progress-bar-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8, #22d3ee);
  animation: progressPulse 2s ease-in-out infinite;
}

/* ============================================================
   FILE DROP, PROJECT CARDS
   ============================================================ */

.file-drop {
  border: 2px dashed var(--ui-border-strong);
  border-radius: 14px; padding: 36px;
  text-align: center; cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.file-drop:hover, .file-drop.dragover {
  border-color: #38bdf8;
  background: rgba(56,189,248,0.06);
  transform: scale(1.005);
}
.file-drop.dragover { box-shadow: 0 0 30px rgba(56,189,248,0.15); }
.file-drop.has-file {
  border-color: #22c55e;
  background: rgba(34,197,94,0.06);
}

.project-card {
  padding: 22px; border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--ui-surface);
  border: 2px solid transparent;
  position: relative; overflow: hidden;
}
.project-card:hover {
  border-color: rgba(56,189,248,0.35);
  transform: translateY(-2px);
}
.project-card.selected {
  border-color: #38bdf8;
  background: rgba(56,189,248,0.1);
  box-shadow: 0 0 32px rgba(56,189,248,0.18);
}

/* ============================================================
   BADGES, TOASTS, MISC
   ============================================================ */

.badge-zip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 8px;
  background: rgba(56,189,248,0.12);
  border: 1px solid rgba(56,189,248,0.25);
  color: #7dd3fc;
}

.page-enter { animation: fadeSlideUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 40%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 20px rgba(56,189,248,0.12));
}

.toast-msg {
  position: fixed; bottom: 28px; right: 28px;
  z-index: 9999; padding: 14px 24px;
  border-radius: 12px; font-size: 13px; font-weight: 500;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0; transform: translateY(12px);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.toast-msg.show { opacity: 1; transform: translateY(0); }
.toast-success {
  background: rgba(34,197,94,0.18);
  border: 1px solid rgba(34,197,94,0.35);
  color: #86efac;
}
.toast-error {
  background: rgba(239,68,68,0.18);
  border: 1px solid rgba(239,68,68,0.35);
  color: #fca5a5;
}

.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle; margin-right: 8px;
}

table tr { transition: background 0.15s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
  #starfield::before, #starfield::after { animation: none !important; }
}
