/* ═══════════════════════════════════════════════════════════
   app.css — Design tokens, base, typography, keyframes
   Masri.Cloud Dashboard v2
   ═══════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  /* Base palette */
  --bg:          #060d1f;
  --bg-2:        #0a1428;
  --surface:     rgba(255,255,255,0.04);
  --surface-2:   rgba(255,255,255,0.07);
  --surface-3:   rgba(255,255,255,0.11);
  --border:      rgba(255,255,255,0.08);
  --border-2:    rgba(0,240,200,0.2);

  /* Accents */
  --accent:      #00F0C8;
  --accent-dim:  rgba(0,240,200,0.15);
  --accent-glow: rgba(0,240,200,0.35);
  --gold:        #F0A500;
  --gold-dim:    rgba(240,165,0,0.15);

  /* Semantic */
  --text:        #e8f0fe;
  --text-2:      #94a3b8;
  --text-3:      #4a5568;
  --danger:      #ff5555;
  --warn:        #F0A500;
  --success:     #22c55e;

  /* Gradients */
  --grad-accent: linear-gradient(135deg, #00F0C8, #0080ff);
  --grad-gold:   linear-gradient(135deg, #F0A500, #ff6b35);
  --grad-danger: linear-gradient(135deg, #ff5555, #c026d3);

  /* Blur */
  --blur-sm:  blur(8px);
  --blur-md:  blur(16px);
  --blur-lg:  blur(32px);

  /* Layout */
  --radius:    14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --sidebar:   240px;
  --header-h:  60px;
  --btmnav-h:  68px;

  /* Transitions */
  --t-fast:   0.15s cubic-bezier(0.4,0,0.2,1);
  --t-normal: 0.25s cubic-bezier(0.4,0,0.2,1);
  --t-slow:   0.4s  cubic-bezier(0.4,0,0.2,1);
}

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

/* ── Base ────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background atmospheric glow */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(0,240,200,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  bottom: -150px;
  right: -150px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0,128,255,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Typography scale ────────────────────────────────────── */
.t-display { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.t-title   { font-size: 18px; font-weight: 600; }
.t-body    { font-size: 14px; font-weight: 400; line-height: 1.6; }
.t-small   { font-size: 12px; font-weight: 400; }
.t-micro   { font-size: 10px; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; }
.t-mono    { font-family: 'DM Mono', monospace; }
.t-muted   { color: var(--text-2); }
.t-accent  { color: var(--accent); }

/* ── Glass utility ───────────────────────────────────────── */
.glass {
  background: var(--surface);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--border);
}

.glass-2 {
  background: var(--surface-2);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border: 1px solid var(--border);
}

/* ── Status bar ──────────────────────────────────────────── */
#status-bar {
  background: rgba(6,13,31,0.9);
  backdrop-filter: var(--blur-sm);
  padding: 5px 20px;
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  color: var(--text-2);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 50;
  transition: bottom var(--t-normal);
}

/* ── Toast ───────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--bg-2);
  backdrop-filter: var(--blur-md);
  color: var(--text);
  padding: 14px 20px 14px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  z-index: 9999;
  display: none;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  border: 1px solid var(--border);
  transform: translateY(10px);
  transition: transform var(--t-normal), opacity var(--t-normal);
}
#toast.show {
  display: block;
  transform: translateY(0);
}
#toast.ok  { border-left: 3px solid var(--accent); }
#toast.err { border-left: 3px solid var(--danger); }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; }

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

/* ── Skeleton loading ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.09) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.skel-line  { height: 12px; margin-bottom: 8px; }
.skel-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skel-val   { height: 32px; width: 80px; margin-bottom: 8px; }
.skel-card  { height: 120px; border-radius: var(--radius); }

/* ── Loading / empty states ──────────────────────────────── */
.loading-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--text-2);
  font-size: 13px;
}

.empty {
  text-align: center;
  padding: 48px;
  color: var(--text-2);
  font-size: 13px;
}
.empty::before {
  content: '○';
  display: block;
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--border);
}

/* ── Pulse dot ───────────────────────────────────────────── */
.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--success);
  animation: pulse-ring 2s ease infinite;
}
.pulse-dot.warn  { background: var(--warn); }
.pulse-dot.warn::after  { border-color: var(--warn); }
.pulse-dot.err   { background: var(--danger); }
.pulse-dot.err::after   { border-color: var(--danger); }

@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ── Utility classes ─────────────────────────────────────── */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col     { display: flex; flex-direction: column; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }

/* ── Page fade animation ─────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-enter {
  animation: fadeUp 0.28s cubic-bezier(0.4,0,0.2,1) both;
}

/* ── Stagger children ────────────────────────────────────── */
.stagger > * { animation: fadeUp 0.3s cubic-bezier(0.4,0,0.2,1) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
