/* ============================================
   NetSeva - Main CSS Design System
   Global tokens, glassmorphism, animations
   ============================================ */

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

/* ---- CSS Variables / Design Tokens ---- */
:root {
  /* Brand Colors */
  --primary: #1a6bff;
  --primary-dark: #1050cc;
  --primary-light: #4d8fff;
  --primary-glow: rgba(26, 107, 255, 0.35);

  --accent: #ff6b1a;
  --accent-dark: #cc5210;
  --accent-light: #ff8f4d;
  --accent-glow: rgba(255, 107, 26, 0.35);

  --success: #00c96b;
  --success-dark: #009950;
  --success-light: #33d98a;
  --success-glow: rgba(0, 201, 107, 0.35);

  --warning: #ffb300;
  --warning-dark: #cc8f00;
  --warning-light: #ffcc44;

  --danger: #ff3b5c;
  --danger-dark: #cc2444;
  --danger-light: #ff6b83;

  --info: #00b4d8;
  --info-dark: #0090ad;

  /* Neutrals */
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1628;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.07);
  --bg-modal: rgba(10, 14, 26, 0.95);

  --text-primary: #f0f4ff;
  --text-secondary: #8a9bc8;
  --text-muted: #5a6a95;
  --text-inverse: #0a0e1a;

  --border: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(26, 107, 255, 0.6);
  --border-card: rgba(255, 255, 255, 0.08);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-blur: blur(20px);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #1a6bff 0%, #0040cc 100%);
  --grad-accent: linear-gradient(135deg, #ff6b1a 0%, #cc3d00 100%);
  --grad-success: linear-gradient(135deg, #00c96b 0%, #009950 100%);
  --grad-hero: linear-gradient(135deg, #0a0e1a 0%, #0f1628 50%, #1a2040 100%);
  --grad-card: linear-gradient(135deg, rgba(26,107,255,0.1) 0%, rgba(255,107,26,0.05) 100%);
  --grad-sidebar: linear-gradient(180deg, #0d1425 0%, #0a0e1a 100%);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-primary: 0 4px 20px rgba(26, 107, 255, 0.3);
  --shadow-accent: 0 4px 20px rgba(255, 107, 26, 0.3);
  --shadow-success: 0 4px 20px rgba(0, 201, 107, 0.3);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Typography */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Poppins', system-ui, sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Z-index */
  --z-dropdown: 100;
  --z-modal: 200;
  --z-toast: 300;
  --z-tooltip: 400;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(26, 107, 255, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(255, 107, 26, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(0, 201, 107, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p { color: var(--text-secondary); }

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--primary); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: rgba(26,107,255,0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ---- Selection ---- */
::selection { background: rgba(26, 107, 255, 0.3); color: var(--text-primary); }

/* ---- Focus ---- */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ============================================
   GLASSMORPHISM UTILITIES
   ============================================ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-dark {
  background: rgba(10, 14, 26, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ============================================
   GRADIENT UTILITIES
   ============================================ */
.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-accent {
  background: linear-gradient(135deg, #ff6b1a, #ff3b5c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-success {
  background: linear-gradient(135deg, #00c96b, #00b4d8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-start { display: flex; align-items: center; justify-content: flex-start; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

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

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(26, 107, 255, 0.3); }
  50% { box-shadow: 0 0 40px rgba(26, 107, 255, 0.6); }
}

@keyframes ripple {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

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

.animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
.animate-fadeInLeft { animation: fadeInLeft 0.5s ease forwards; }
.animate-fadeInRight { animation: fadeInRight 0.5s ease forwards; }
.animate-scaleIn { animation: scaleIn 0.3s ease forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s ease infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }

/* Staggered animation delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ============================================
   SKELETON LOADING
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: all;
  animation: fadeInRight 0.3s ease forwards;
  backdrop-filter: blur(20px);
  border: 1px solid;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.toast-success {
  background: rgba(0, 201, 107, 0.15);
  border-color: rgba(0, 201, 107, 0.3);
  color: var(--success-light);
}

.toast-error {
  background: rgba(255, 59, 92, 0.15);
  border-color: rgba(255, 59, 92, 0.3);
  color: var(--danger-light);
}

.toast-warning {
  background: rgba(255, 179, 0, 0.15);
  border-color: rgba(255, 179, 0, 0.3);
  color: var(--warning-light);
}

.toast-info {
  background: rgba(0, 180, 216, 0.15);
  border-color: rgba(0, 180, 216, 0.3);
  color: var(--info);
}

.toast.hiding {
  animation: fadeInRight 0.3s ease reverse forwards;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

#loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(26, 107, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* ============================================
   BADGES / STATUS INDICATORS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-success { background: rgba(0,201,107,0.15); color: var(--success); border: 1px solid rgba(0,201,107,0.3); }
.badge-warning { background: rgba(255,179,0,0.15); color: var(--warning); border: 1px solid rgba(255,179,0,0.3); }
.badge-danger { background: rgba(255,59,92,0.15); color: var(--danger); border: 1px solid rgba(255,59,92,0.3); }
.badge-info { background: rgba(0,180,216,0.15); color: var(--info); border: 1px solid rgba(0,180,216,0.3); }
.badge-primary { background: rgba(26,107,255,0.15); color: var(--primary-light); border: 1px solid rgba(26,107,255,0.3); }
.badge-neutral { background: rgba(255,255,255,0.08); color: var(--text-secondary); border: 1px solid var(--border); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.active { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.status-dot.info { background: var(--info); box-shadow: 0 0 6px var(--info); }

/* ============================================
   DIVIDERS
   ============================================ */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.85rem;
}
.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }

/* Scrollable containers */
.scroll-x { overflow-x: auto; }
.scroll-y { overflow-y: auto; }

/* ============================================
   PARTICLE BACKGROUND
   ============================================ */
.particles-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  animation: float linear infinite;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .container { padding: 0 var(--space-md); }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
}
