/**
 * CSS Modules — Base
 * Design Tokens + Reset + Typography + Accessibility
 * Check Pro v12.44.782 — Minimalista Premium
 */

/* ═══ DESIGN TOKENS — DARK MODE (default) ═══ */
:root {
  /* Background */
  --bg-app: #0a0a0b;
  --bg-sidebar: #111113;
  --bg-card: #18181b;
  --bg-card-hover: #1f1f23;
  --bg-input: #0f0f12;
  --bg-hover: rgba(255,255,255,0.04);
  --bg-active: rgba(255,255,255,0.08);
  --bg-modal: rgba(0,0,0,0.8);
  --bg-elevated: #27272a;

  /* Accent — Emerald */
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-light: rgba(16,185,129,0.12);
  --accent-subtle: rgba(16,185,129,0.06);
  --accent-dark: #047857;

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-link: #34d399;
  --text-inverse: #09090b;

  /* Status */
  --success: #22c55e;
  --success-bg: rgba(34,197,94,0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245,158,11,0.12);
  --error: #ef4444;
  --error-bg: rgba(239,68,68,0.12);
  --info: #3b82f6;
  --info-bg: rgba(59,130,246,0.12);

  /* Border */
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.14);
  --border-focus: var(--accent);
  --border-card: rgba(255,255,255,0.06);

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

  /* Radius */
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.25rem;
  --text-3xl: 1.5rem;
  --text-4xl: 2rem;
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --tracking-tight: -0.01em;
  --tracking-normal: 0;

  /* Transitions */
  --duration-fast: 100ms;
  --duration-normal: 150ms;
  --duration-slow: 250ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-tooltip: 600;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --header-height: 0px;
  --content-max-width: 1400px;
}

/* ═══ LIGHT MODE ═══ */
html.light, html:not(.dark) {
  --bg-app: #fafafa;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f4f4f5;
  --bg-input: #f4f4f5;
  --bg-hover: rgba(0,0,0,0.03);
  --bg-active: rgba(0,0,0,0.06);
  --bg-modal: rgba(0,0,0,0.5);
  --bg-elevated: #ffffff;

  --accent: #059669;
  --accent-hover: #047857;
  --accent-light: rgba(5,150,105,0.1);
  --accent-subtle: rgba(5,150,105,0.05);

  --text-primary: #09090b;
  --text-secondary: #71717a;
  --text-muted: #a1a1aa;
  --text-link: #059669;
  --text-inverse: #fafafa;

  --success: #16a34a;
  --success-bg: rgba(22,163,74,0.1);
  --warning: #d97706;
  --warning-bg: rgba(217,119,6,0.1);
  --error: #dc2626;
  --error-bg: rgba(220,38,38,0.1);
  --info: #2563eb;
  --info-bg: rgba(37,99,235,0.1);

  --border: #e4e4e7;
  --border-hover: #d4d4d8;
  --border-focus: var(--accent);
  --border-card: #e4e4e7;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.08), 0 8px 10px rgba(0,0,0,0.03);

  color-scheme: light;
}

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
}

body {
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: var(--text-base);
  min-height: 100vh;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  outline: none;
}

button { cursor: pointer; }

ul, ol { list-style: none; }

/* ═══ TYPOGRAPHY ═══ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); font-weight: 500; }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mono { font-family: var(--font-mono); }

/* ═══ LAYOUT UTILITIES ═══ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.max-w-content { max-width: var(--content-max-width); }
.mx-auto { margin-left: auto; margin-right: auto; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; letter-spacing: 0.05em; }

/* Spacing */
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.ml-2 { margin-left: var(--space-2); }
.mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ═══ ANIMATIONS ═══ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@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: -200px 0; } 100% { background-position: calc(200px + 100%) 0; } }

.animate-fade-in { animation: fadeIn var(--duration-slow) var(--ease-out); }
.animate-fade-in-up { animation: fadeInUp var(--duration-slow) var(--ease-out); }
.animate-scale-in { animation: scaleIn var(--duration-normal) var(--ease-spring); }
.animate-spin { animation: spin 0.8s linear infinite; }
.animate-pulse { animation: pulse 2s var(--ease) infinite; }

/* Stagger children */
.stagger > * { animation: fadeInUp var(--duration-slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
.stagger > *:nth-child(6) { animation-delay: 200ms; }
.stagger > *:nth-child(7) { animation-delay: 240ms; }
.stagger > *:nth-child(8) { animation-delay: 280ms; }

/* ═══ EMPTY STATE ═══ */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-12) var(--space-6); text-align: center;
}
.empty-state .icon { font-size: 40px; margin-bottom: var(--space-4); opacity: 0.3; }
.empty-state h3 { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-1); }
.empty-state p { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-6); max-width: 320px; }

/* ═══ ERROR STATE (F3: estados estándar unificados) ═══ */
.error-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10) var(--space-6); text-align: center;
  border: 1px dashed var(--error-bg); border-radius: var(--radius-xl);
}
.error-state .material-symbols-outlined { font-size: 36px; color: var(--error); opacity: 0.85; }
.error-state p { font-size: var(--text-sm); color: var(--text-secondary); max-width: 360px; }
.error-state .retry-btn {
  margin-top: var(--space-2); cursor: pointer;
  background: var(--error-bg); color: var(--error);
  border: none; border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-5); font-size: var(--text-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.error-state .retry-btn:hover { filter: brightness(1.15); }

/* ═══ LOADING ═══ */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200px 100%; animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 36px; height: 36px; border-radius: var(--radius-full); }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }

/* ═══ ACCESSIBILITY ═══ */
.skip-to-content {
  position: absolute; top: -50px; left: 0; z-index: var(--z-tooltip);
  background: var(--accent); color: var(--text-inverse);
  padding: var(--space-2) var(--space-4); font-size: var(--text-sm); font-weight: 500;
  transition: top var(--duration-normal) var(--ease);
}
.skip-to-content:focus { top: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

.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;
}

/* High contrast */
@media (forced-colors: active) {
  :focus-visible { outline: 3px solid CanvasText; }
  .btn, .nav-item, .card { border: 1px solid CanvasText; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 640px) {
  :root {
    --sidebar-width: 100vw;
    --text-base: 0.875rem;
  }
  .sm\:hidden { display: none !important; }
  .sm\:block { display: block !important; }
  .sm\:flex { display: flex !important; }
  .sm\:grid-cols-1 { grid-template-columns: 1fr; }
  .sm\:p-4 { padding: var(--space-4); }
}

@media (min-width: 641px) and (max-width: 768px) {
  .md\:hidden { display: none !important; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1025px) {
  .lg\:hidden { display: none !important; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}
