/* ==========================================================================
   REPOR-MAGNA - Corporate Dashboard Stylesheet
   Design System: Deep Corporate Navy, Electric Cyan & Vibrant Status Accents
   ========================================================================== */

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

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Theme Tokens: Dark (Default Corporate Theme) */
  --bg-body: #090e17;
  --bg-surface: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-card: rgba(51, 65, 85, 0.5);
  --border-focus: #00b4d8;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Brand Accents */
  --brand-primary: #0284c7;
  --brand-primary-light: #38bdf8;
  --brand-gradient: linear-gradient(135deg, #0284c7 0%, #00b4d8 50%, #2563eb 100%);
  --brand-glow: rgba(0, 180, 216, 0.25);

  /* Status Colors */
  --color-open: #0284c7;        /* Abierto */
  --color-pending: #f59e0b;     /* Pendiente */
  --color-waiting-client: #f97316; /* Esperando Cliente */
  --color-waiting-3rd: #ec4899;  /* Esperando Tercero */
  --color-resolved: #10b981;    /* Resuelto */
  --color-closed: #64748b;      /* Cerrado */
  --color-overdue: #ef4444;     /* Vencido */
  --color-due-today: #8b5cf6;   /* Vence Hoy */
  --color-unassigned: #e11d48;  /* No Asignado */
}

/* Light Theme Variables */
body.light-theme {
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #f1f5f9;
  --border-card: rgba(226, 232, 240, 0.8);
  --border-focus: #0284c7;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: -0.015em;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism Card Style */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.glass-panel:hover {
  border-color: rgba(56, 189, 248, 0.4);
}

.glass-dropdown {
  background: #0b132b;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 180, 216, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
}

body.light-theme .glass-dropdown {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* KPI Cards Animations & Micro-Interactions */
.kpi-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.85;
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -4px rgba(0, 0, 0, 0.35);
}

.kpi-card.active-filter {
  outline: 2px solid var(--brand-primary-light);
  box-shadow: 0 0 20px var(--brand-glow);
}

/* Chart Card Handles & Edit Mode */
.edit-mode-active .chart-drag-handle {
  display: flex !important;
}

.edit-mode-active .sortable-ghost {
  opacity: 0.4;
  border: 2px dashed #00b4d8 !important;
}

.edit-mode-active .sortable-chosen {
  transform: scale(1.02);
}

/* Pulse indicator animation */
@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.live-pulse {
  animation: pulse-dot 2s infinite cubic-bezier(0.45, 0, 0.55, 1);
}

/* Skeleton Loading Shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, rgba(30, 41, 59, 0.6) 25%, rgba(51, 65, 85, 0.6) 50%, rgba(30, 41, 59, 0.6) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  transform: translateY(20px);
  opacity: 0;
  animation: toast-in 0.3s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-in {
  to { transform: translateY(0); opacity: 1; }
}

/* Custom Checkbox Pill */
.filter-chip {
  transition: all 0.15s ease;
  user-select: none;
}

.filter-chip.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.4);
}

/* Code / Monospace snippet style */
.email-preview-box {
  font-family: var(--font-mono);
  background: #060b13;
  color: #e2e8f0;
  line-height: 1.6;
}
