/* ============================================
   PHPFoundry Design Tokens
   Sistema de diseño propio — zero dependencias
   ============================================ */

/* --- Reset mínimo --- */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--surface-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Escala de grises base — neutral
   (NO usar directamente en componentes)
   ============================================ */
:root {
  --gray-50:  #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-850: #1f1f1f;
  --gray-900: #171717;
  --gray-950: #0a0a0a;
}

/* ============================================
   Variables semánticas — Light theme (default)
   ============================================ */
:root,
[data-theme="light"] {
  /* --- Superficies --- */
  --surface-base:     #ffffff;
  --surface-raised:   var(--gray-50);
  --surface-sunken:   var(--gray-100);
  --surface-overlay:  #ffffff;
  /* Sidebar claro — patrón shadcn dashboard-01 */
  --surface-sidebar:       #ffffff;
  --sidebar-text:          #525252;
  --sidebar-text-muted:    #a3a3a3;
  --sidebar-text-active:   #171717;
  --sidebar-hover:         #f5f5f5;
  --sidebar-active:        #f5f5f5;
  --sidebar-border:        #e5e5e5;
  --surface-active: #f0f0f0;
  --surface-hover:  #f5f5f5;
  --surface-inverted: var(--gray-900);
  --surface-disabled: var(--gray-100);

  /* --- Texto --- */
  --text-primary:   #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-muted:     #9a9a9a;
  --text-disabled:   var(--gray-300);
  --text-inverted:   #ffffff;
  --text-link:       var(--primary);
  --text-link-hover: var(--primary-hover);

  /* --- Bordes --- */
  --border-default: var(--gray-200);
  --border-muted:   var(--gray-100);
  --border-strong:  var(--gray-300);
  --border-focus:   var(--primary);

  /* --- Interactivos --- */
  --interactive-bg:          transparent;
  --interactive-bg-hover:    var(--gray-100);
  --interactive-bg-pressed:  var(--gray-200);
  --interactive-bg-selected: var(--gray-100);

  /* --- Sombras --- */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --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);

  --color-blue: #3b82f6;
  --color-blue-soft: #eff6ff;
  --color-green: #16a34a;
  --color-green-soft: #f0fdf4;
  --color-amber: #d97706;
  --color-amber-soft: #fffbeb;
  --color-red: #dc2626;
  --color-red-soft: #fef2f2;
  --color-purple: #7c3aed;
  --color-purple-soft: #f3e8ff;
}

/* ============================================
   Variables semánticas — Dark theme
   ============================================ */
[data-theme="dark"] {
  /* --- Superficies --- */
  --surface-base:     var(--gray-950);
  --surface-raised:   var(--gray-900);
  --surface-sunken:   var(--gray-800);
  --surface-overlay:  var(--gray-850);
  --surface-sidebar:       #0a0a0a;
  --sidebar-text:          #a3a3a3;
  --sidebar-text-muted:    #525252;
  --sidebar-text-active:   #f5f5f5;
  --sidebar-hover:         #1a1a1a;
  --sidebar-active:        #1a1a1a;
  --sidebar-border:        #262626;
  --surface-active: #2a2a2a;
  --surface-hover:  #252525;
  --surface-inverted: var(--gray-100);
  --surface-disabled: var(--gray-800);

  /* --- Texto --- */
  --text-primary:   #f0f0f0;
  --text-secondary: #a0a0a0;
  --text-muted:     #666666;
  --text-disabled:  var(--gray-600);
  --text-inverted:  var(--gray-900);

  /* --- Bordes --- */
  --border-default: var(--gray-800);
  --border-muted:   var(--gray-850);
  --border-strong:  var(--gray-700);
  --border-focus:   var(--primary);

  /* --- Interactivos --- */
  --interactive-bg:          transparent;
  --interactive-bg-hover:    var(--gray-800);
  --interactive-bg-pressed:  var(--gray-700);
  --interactive-bg-selected: var(--gray-800);

  /* --- Sombras (dark) --- */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.3), 0 8px 10px -6px rgb(0 0 0 / 0.3);

  --color-blue: #60a5fa;
  --color-blue-soft: #1e3a5f;
  --color-green: #4ade80;
  --color-green-soft: #14352a;
  --color-amber: #fbbf24;
  --color-amber-soft: #3d2e0a;
  --color-red: #f87171;
  --color-red-soft: #3b1515;
  --color-purple: #a78bfa;
  --color-purple-soft: #2e1f5e;
}

/* ============================================
   Color primario (accent) — Light
   Sobreescribible desde PHP con inline <style>
   ============================================ */
:root {
  --primary:            #2563eb;
  --primary-hover:      #1d4ed8;
  --primary-pressed:    #1e40af;
  --primary-light:      #dbeafe;
  --primary-foreground: #ffffff;

  --danger:            #dc2626;
  --danger-hover:      #b91c1c;
  --danger-light:      #fee2e2;
  --danger-foreground: #ffffff;

  --success:            #16a34a;
  --success-hover:      #15803d;
  --success-light:      #dcfce7;
  --success-foreground: #ffffff;

  --warning:            #d97706;
  --warning-hover:      #b45309;
  --warning-light:      #fef3c7;
  --warning-foreground: #ffffff;

  --info:            #0284c7;
  --info-hover:      #0369a1;
  --info-light:      #e0f2fe;
  --info-foreground: #ffffff;
}

/* --- Colores semánticos en dark --- */
[data-theme="dark"] {
  --primary:            #3b82f6;
  --primary-hover:      #60a5fa;
  --primary-pressed:    #2563eb;
  --primary-light:      rgba(59, 130, 246, 0.15);
  --primary-foreground: #ffffff;

  --danger:            #ef4444;
  --danger-hover:      #f87171;
  --danger-light:      rgba(239, 68, 68, 0.15);

  --success:            #22c55e;
  --success-hover:      #4ade80;
  --success-light:      rgba(34, 197, 94, 0.15);

  --warning:            #f59e0b;
  --warning-hover:      #fbbf24;
  --warning-light:      rgba(245, 158, 11, 0.15);

  --info:            #38bdf8;
  --info-hover:      #7dd3fc;
  --info-light:      rgba(56, 189, 248, 0.15);
}

/* ============================================
   Tipografía
   ============================================ */
:root {
  --font-family:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;

  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;

  --leading-tight:   1.25;
  --leading-normal:  1.5;
  --leading-relaxed: 1.75;
}

/* ============================================
   Spacing, radios, transiciones, z-index
   ============================================ */
:root {
  --space-0:  0;
  --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;
  --space-16: 4rem;

  --radius-none: 0;
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-xl:   10px;
  --radius-2xl:  1rem;
  --radius-full: 9999px;
  --radius-pill: 9999px;

  --transition-fast:   150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow:   300ms ease;

  --z-dropdown: 1000;
  --z-sticky:   1020;
  --z-fixed:    1030;
  --z-overlay:  1040;
  --z-modal:    1050;
  --z-popover:  1060;
  --z-tooltip:  1070;
  --z-toast:    1080;

  --sidebar-width:           260px;
  --sidebar-collapsed-width: 64px;
  --header-height:           48px;
}
