/* Holistic RAD Dashboard — Modern UI/UX Design */
/* Based on UI_UX Design skill principles */

:root {
  /* Primary palette - purple brand */
  --primary-50: #faf5ff;
  --primary-100: #f3e8ff;
  --primary-200: #e9d5ff;
  --primary-300: #d8b4fe;
  --primary-400: #c084fc;
  --primary-500: #a855f7;
  --primary-600: #9333ea;
  --primary-700: #7e22ce;
  --primary-800: #6b21a8;
  --primary-900: #581c87;

  /* Neutrals - warm gray scale */
  --gray-950: #030712;
  --gray-900: #111827;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;

  /* Semantic colors */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* Spacing scale (8px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-purple: 0 4px 20px rgba(147, 51, 234, 0.15);

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--gray-900);
  color: var(--gray-100);
  line-height: 1.6;
  min-height: 100vh;
}

/* Typography Scale */
h1 { font-size: 1.875rem; line-height: 2.25rem; font-weight: 700; }
h2 { font-size: 1.5rem; line-height: 2rem; font-weight: 600; }
h3 { font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; }
h4 { font-size: 1rem; line-height: 1.5rem; font-weight: 600; }

.text-xs   { font-size: 0.75rem; line-height: 1rem; }
.text-sm   { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg   { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl   { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl  { font-size: 1.5rem; line-height: 2rem; }
.text-3xl  { font-size: 1.875rem; line-height: 2.25rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-700); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-600); }

/* ============================================
   LAYOUT
   ============================================ */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

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

.sidebar {
  width: 280px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--gray-800) 0%, var(--gray-900) 100%);
  border-right: 1px solid var(--gray-700);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--gray-700);
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-purple);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary-400);
  letter-spacing: -0.025em;
}

.sidebar-logo-subtitle {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--gray-700);
  color: var(--gray-100);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--primary-600), var(--primary-700));
  color: white;
  box-shadow: var(--shadow-purple);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: white;
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  font-size: 1.125rem;
  width: 24px;
  text-align: center;
}

.nav-label {
  flex: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: var(--space-6);
  border-top: 1px solid var(--gray-700);
  margin-top: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--gray-700);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: white;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--gray-500);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  background: var(--gray-600);
  color: var(--error);
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: var(--space-8);
  min-height: 100vh;
}

/* Page Header */
.page-header {
  margin-bottom: var(--space-8);
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--gray-100);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-2);
}

.page-subtitle {
  font-size: 1rem;
  color: var(--gray-500);
}

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

.card {
  background: var(--gray-800);
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--gray-600);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-100);
  margin-bottom: var(--space-1);
}

.card-description {
  font-size: 0.875rem;
  color: var(--gray-500);
  line-height: 1.5;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gray-100);
  letter-spacing: -0.025em;
  line-height: 1;
}

.card-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.card-trend.up {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.card-trend.down {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Status Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-success {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.badge-warning {
  color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.badge-error {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.badge-info {
  color: var(--info);
  background: rgba(59, 130, 246, 0.1);
}

/* Status Dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.offline { background: var(--gray-600); }
.status-dot.busy { background: var(--warning); }

/* ============================================
   GRID LAYOUTS
   ============================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-6);
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

@media (max-width: 992px) {
  .two-col-grid { grid-template-columns: 1fr; }
}

/* ============================================
   AGENT SECTIONS (ATLAS, NEXUS, NÚCLEO)
   ============================================ */

.agent-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--gray-700);
}

.agent-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: var(--shadow-purple);
}

.agent-info {
  flex: 1;
}

.agent-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-100);
  margin-bottom: var(--space-1);
}

.agent-role {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.agent-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: rgba(34, 197, 94, 0.1);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
}

/* Report Card */
.report-card {
  background: var(--gray-800);
  border: 1px solid var(--gray-700);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--transition-base);
}

.report-card:hover {
  border-color: var(--primary-600);
  transform: translateY(-2px);
  box-shadow: var(--shadow-purple);
}

.report-date {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.report-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-100);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.report-preview {
  font-size: 0.875rem;
  color: var(--gray-400);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.report-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-400);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.report-link:hover {
  color: var(--primary-300);
  gap: var(--space-3);
}

/* Task Item */
.task-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--gray-700);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  transition: all var(--transition-fast);
}

.task-item:last-child {
  margin-bottom: 0;
}

.task-item:hover {
  background: var(--gray-600);
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-500);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.task-item.completed .task-checkbox {
  background: var(--primary-600);
  border-color: var(--primary-600);
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-text {
  font-size: 0.9375rem;
  color: var(--gray-200);
  line-height: 1.4;
}

.task-item.completed .task-text {
  text-decoration: line-through;
  color: var(--gray-500);
}

/* Metric Card */
.metric-card {
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.metric-value {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-400), var(--primary-200));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.metric-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-700);
  border-radius: 4px;
  overflow: hidden;
  margin: var(--space-3) 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-600), var(--primary-400));
  border-radius: 4px;
  transition: width var(--transition-slow);
}

/* ============================================
   LUMA SECTION
   ============================================ */

.luma-header {
  background: linear-gradient(135deg, var(--primary-900), var(--gray-900));
  border: 1px solid var(--primary-800);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
  text-align: center;
}

.luma-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-4);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  box-shadow: 0 0 40px rgba(147, 51, 234, 0.4);
}

.luma-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-2);
}

.luma-subtitle {
  font-size: 1rem;
  color: var(--gray-400);
}

/* Activity Feed */
.activity-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--gray-800);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--gray-600);
  min-width: 60px;
}

.activity-text {
  font-size: 0.9375rem;
  color: var(--gray-300);
  line-height: 1.5;
}

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

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

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

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

.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-slide-in {
  animation: slideIn 0.3s ease forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

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

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  color: white;
  box-shadow: var(--shadow-purple);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(147, 51, 234, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--gray-700);
  color: var(--gray-200);
}

.btn-secondary:hover {
  background: var(--gray-600);
}

/* ============================================
   DIVIDERS & LABELS
   ============================================ */

.divider {
  height: 1px;
  background: var(--gray-700);
  margin: var(--space-6) 0;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-4);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: var(--space-4);
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
