/**
 * RADIUS Manager - Design System v2.0
 * Design tokens e componentes reutilizáveis
 */

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

/* ======================================
   DESIGN TOKENS - Cores
   ====================================== */
:root {
  /* Brand Colors */
  --primary-50: #f0f2ff;
  --primary-100: #e0e4ff;
  --primary-500: #667eea;
  --primary-600: #5568d3;
  --primary-700: #4854b8;
  --primary-900: #764ba2;

  /* Grayscale */
  --gray-50: #f8f9fc;
  --gray-100: #f1f3f9;
  --gray-200: #e4e7ed;
  --gray-300: #d1d5dc;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic Colors */
  --success-light: #d1fae5;
  --success: #10b981;
  --success-dark: #047857;

  --danger-light: #fee2e2;
  --danger: #ef4444;
  --danger-dark: #b91c1c;

  --warning-light: #fef3c7;
  --warning: #f59e0b;
  --warning-dark: #d97706;

  --info-light: #dbeafe;
  --info: #3b82f6;
  --info-dark: #1e40af;

  /* Vendor Colors - Ajustados para contraste WCAG AA */
  --mikrotik: #ff7733;
  --mikrotik-bg: #fff4ed;
  --mikrotik-dark: #e65c1a;

  --juniper: #0077ed;
  --juniper-bg: #eff6ff;
  --juniper-dark: #005bc4;

  /* Backgrounds */
  --bg-main: #f8f9fc;
  --bg-card: #ffffff;
  --bg-hover: #f9fafb;

  /* Borders */
  --border-light: #e4e7ed;
  --border-normal: #d1d5dc;
  --border-dark: #9ca3af;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --border-light: #334155;
  --border-normal: #475569;
  --border-dark: #64748b;

  /* Text colors inverted */
  --gray-900: #f1f5f9;
  --gray-800: #e2e8f0;
  --gray-700: #cbd5e1;
  --gray-600: #94a3b8;
  --gray-500: #64748b;
  --gray-400: #475569;
  --gray-300: #334155;
  --gray-200: #1e293b;
  --gray-100: #0f172a;
  --gray-50: #020617;
}

[data-theme="dark"] .navbar {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border-light);
}

[data-theme="dark"] .card {
  background: var(--bg-card);
}

[data-theme="dark"] .stat-card {
  background: var(--bg-card);
  border-color: var(--border-light);
}

[data-theme="dark"] .stat-card:hover {
  border-color: var(--primary-500);
  background: var(--bg-hover);
}

[data-theme="dark"] code {
  background: var(--gray-800);
  color: var(--gray-100);
}

[data-theme="dark"] .table-compact tbody tr:hover {
  background: var(--bg-hover);
}

[data-theme="dark"] .row-heavy {
  background-color: #422006 !important;
}

[data-theme="dark"] .row-stale {
  background-color: #450a0a !important;
}

[data-theme="dark"] .row-long {
  background-color: #172554 !important;
}

/* ======================================
   TIPOGRAFIA
   ====================================== */
:root {
  /* Font Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Font Sizes - Type Scale (1.250 - Major Third) */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-5xl: 3rem;      /* 48px */

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.75;

  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======================================
   GLOBAL STYLES
   ====================================== */
body {
  font-family: var(--font-sans);
  background: var(--bg-main);
  color: var(--gray-900);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code, .code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--gray-100);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--gray-800);
}

/* ======================================
   COMPONENTES - Navbar
   ====================================== */
.navbar {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-900) 100%);
  box-shadow: var(--shadow-md);
}

.navbar-brand {
  font-weight: var(--font-bold);
  font-size: var(--text-xl);
}

/* ======================================
   COMPONENTES - Cards
   ====================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* ======================================
   COMPONENTES - Stat Cards
   ====================================== */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  border: 1px solid var(--border-light);
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  transition: all var(--transition-base);
  animation: fadeIn var(--transition-slow) ease-out both;
}

.stat-card:hover {
  border-color: var(--primary-500);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.12);
  transform: translateY(-2px);
}

.stat-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-900));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-2xl);
  flex-shrink: 0;
}

.stat-card__content {
  flex: 1;
}

.stat-card__label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.stat-card__value {
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  color: var(--gray-900);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
}

.stat-card__trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}

.stat-card__trend--up {
  color: var(--success);
}

.stat-card__trend--down {
  color: var(--danger);
}

/* ======================================
   COMPONENTES - Search Box
   ====================================== */
.search-box-container {
  position: relative;
  width: 100%;
  max-width: 500px;
}

.search-box-container .search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  font-size: var(--text-lg);
  z-index: 10;
}

#search-box {
  padding: var(--space-3) var(--space-4) var(--space-3) 3rem;
  font-size: var(--text-base);
  border: 2px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  width: 100%;
  transition: all var(--transition-base);
}

#search-box:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

#search-box::placeholder {
  color: var(--gray-400);
}

/* ======================================
   COMPONENTES - Filter Pills
   ====================================== */
.quick-filters {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.filter-badge {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.filter-badge:hover {
  border-color: var(--border-normal);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.filter-badge.active {
  border-color: var(--primary-500);
  background: var(--primary-50);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.filter-badge i {
  font-size: var(--text-lg);
}

/* ======================================
   COMPONENTES - Badges Vendor
   ====================================== */
.badge-mikrotik {
  background: var(--mikrotik);
  color: white;
  font-weight: var(--font-semibold);
}

.badge-juniper {
  background: var(--juniper);
  color: white;
  font-weight: var(--font-semibold);
}

/* ======================================
   COMPONENTES - Tabela
   ====================================== */
.table-compact {
  font-size: var(--text-sm);
}

.table-compact thead th {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-700);
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--border-light);
}

.table-compact tbody td {
  padding: var(--space-3) var(--space-4);
  vertical-align: middle;
}

.table-compact tbody tr {
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--gray-100);
}

.table-compact tbody tr:hover {
  background: var(--bg-hover);
}

/* Rows com anomalias */
.row-heavy {
  background-color: #fff3cd !important;
  border-left: 4px solid var(--warning);
}

.row-stale {
  background-color: #fee2e2 !important;
  border-left: 4px solid var(--danger);
}

.row-long {
  background-color: #dbeafe !important;
  border-left: 4px solid var(--info);
}

.row-no-traffic {
  background-color: var(--gray-100) !important;
  opacity: 0.7;
}

/* ======================================
   COMPONENTES - Action Buttons
   ====================================== */
.action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-normal);
  background: var(--bg-card);
  color: var(--gray-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-dark);
  color: var(--gray-900);
  transform: scale(1.05);
}

.action-btn--danger {
  border-color: var(--danger-light);
  color: var(--danger);
}

.action-btn--danger:hover {
  background: var(--danger-light);
  border-color: var(--danger);
}

.action-btn--warning {
  border-color: var(--warning-light);
  color: var(--warning-dark);
}

.action-btn--warning:hover {
  background: var(--warning-light);
  border-color: var(--warning);
}

/* ======================================
   COMPONENTES - Status Indicators
   ====================================== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: var(--space-2);
}

.status-dot--success {
  background: var(--success);
}

.status-dot--danger {
  background: var(--danger);
}

.status-dot--warning {
  background: var(--warning);
}

.status-dot--info {
  background: var(--info);
}

/* Pulse animation */
.status-dot--pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

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

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

.fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

.slide-in {
  animation: slideIn var(--transition-base) ease-out;
}

/* Staggered animations for cards */
.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 50ms; }
.stat-card:nth-child(3) { animation-delay: 100ms; }
.stat-card:nth-child(4) { animation-delay: 150ms; }

/* ======================================
   DATA VISUALIZATION
   ====================================== */
.progress-inline {
  height: 4px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-1);
}

.progress-inline__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-900));
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.progress-inline__bar--success {
  background: linear-gradient(90deg, var(--success), var(--success-dark));
}

.progress-inline__bar--warning {
  background: linear-gradient(90deg, var(--warning), var(--warning-dark));
}

.progress-inline__bar--danger {
  background: linear-gradient(90deg, var(--danger), var(--danger-dark));
}

.traffic-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.traffic-indicator__value {
  font-weight: var(--font-semibold);
  min-width: 60px;
}

.traffic-indicator__bar {
  flex: 1;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.traffic-indicator__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--info), var(--info-dark));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* ======================================
   UTILITIES
   ====================================== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning-dark); }
.text-info { color: var(--info); }
.text-muted { color: var(--gray-500); }

.bg-success-light { background: var(--success-light); }
.bg-danger-light { background: var(--danger-light); }
.bg-warning-light { background: var(--warning-light); }
.bg-info-light { background: var(--info-light); }

.font-mono { font-family: var(--font-mono); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* ======================================
   RESPONSIVENESS
   ====================================== */
@media (max-width: 768px) {
  :root {
    --text-4xl: 1.875rem;  /* 30px em mobile */
    --text-5xl: 2.25rem;   /* 36px em mobile */
  }

  .stat-card {
    flex-direction: column;
    text-align: center;
  }

  .stat-card__icon {
    margin: 0 auto;
  }

  .filter-badge {
    width: 100%;
    justify-content: center;
  }
}
