/* ============================================
   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 — zinc (shadcn)
   (NO usar directamente en componentes)
   ============================================ */
:root {
  --gray-50:  #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-850: #1f1f23;
  --gray-900: #18181b;
  --gray-950: #09090b;
}

/* ============================================
   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:          var(--gray-600);
  --sidebar-text-muted:    var(--gray-400);
  --sidebar-text-active:   var(--gray-900);
  --sidebar-hover:         var(--gray-100);
  --sidebar-active:        var(--gray-100);
  --sidebar-border:        var(--gray-200);
  --surface-active: var(--gray-100);
  --surface-hover:  var(--gray-100);
  --surface-inverted: var(--gray-900);
  --surface-disabled: var(--gray-100);

  /* --- Texto --- */
  --text-primary:   var(--gray-950);
  --text-secondary: var(--gray-600);
  --text-muted:     #66666e;
  --text-placeholder: var(--gray-400);
  --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(--gray-400);

  /* --- 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);

  /* --- Focus ring (shadcn style) --- */
  --ring-color: rgba(9, 9, 11, 0.07);
  --ring: 0 0 0 3px var(--ring-color);

  --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;
  --color-blue-text: #1d4ed8;
  --color-green-text: #15803d;
  --color-amber-text: #b45309;
  --color-red-text: #b91c1c;
  --color-purple-text: #6d28d9;
}

/* ============================================
   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:       var(--gray-950);
  --sidebar-text:          var(--gray-400);
  --sidebar-text-muted:    var(--gray-600);
  --sidebar-text-active:   var(--gray-100);
  --sidebar-hover:         var(--gray-900);
  --sidebar-active:        var(--gray-900);
  --sidebar-border:        var(--gray-800);
  --surface-active: var(--gray-800);
  --surface-hover:  var(--gray-900);
  --surface-inverted: var(--gray-100);
  --surface-disabled: var(--gray-800);

  /* --- Texto --- */
  --text-primary:   var(--gray-100);
  --text-secondary: var(--gray-400);
  --text-muted:     #8b8b94;
  --text-placeholder: var(--gray-600);
  --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(--gray-500);

  /* --- 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);

  /* --- Focus ring (dark) --- */
  --ring-color: rgba(244, 244, 245, 0.1);
  --ring: 0 0 0 3px var(--ring-color);

  --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-blue-text: #60a5fa;
  --color-green-text: #4ade80;
  --color-amber-text: #fbbf24;
  --color-red-text: #f87171;
  --color-purple-text: #a78bfa;
}

/* ============================================
   Color primario (accent) — Light
   Sobreescribible desde PHP con inline <style>
   ============================================ */
:root {
  --primary:            #0C447C;
  --primary-hover:      #0A3A69;
  --primary-pressed:    #082F56;
  --primary-light:      #E8F1FA;
  --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:            #4A9AD4;
  --primary-hover:      #6BB3E4;
  --primary-pressed:    #3888C4;
  --primary-light:      rgba(74, 154, 212, 0.15);
  --primary-foreground: #09090b;

  --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:   8px;
  --radius-lg:   10px;
  --radius-xl:   14px;
  --radius-2xl:  1rem;
  --radius-full: 9999px;
  --radius-pill: 9999px;

  /* Semantic radii */
  --radius-input: 8px;
  --radius-card:  14px;
  --radius-tabs:  11px;

  /* Control sizing */
  --control-h:    38px;

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