/**
 * POWERCode Admin - Core Design Tokens
 * 
 * Single source of truth for design tokens across Admin Panel, Login and Components.
 *
 * @package POWERCode_Admin
 * @version 3.0.0
 */

:root,
html,
body.wp-admin,
html[data-powercode-theme="hybrid"],
html[data-powercode-theme="dark"],
html[data-powercode-theme="light"] {
  /* Tipografía */
  --pc-font-family: -apple-system, BlinkMacSystemFont, "Plus Jakarta Sans", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --pc-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Geometría y Dimensiones */
  --pc-sidebar-width: 236px;
  --pc-sidebar-collapsed-width: 56px;
  --pc-topbar-height: 42px;
  --pc-radius-xs: 4px;
  --pc-radius-sm: 6px;
  --pc-radius-md: 8px;
  --pc-radius-lg: 12px;
  --pc-radius-xl: 16px;
  --pc-radius-full: 9999px;

  /* Transiciones Suaves */
  --pc-transition-fast: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --pc-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --pc-transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* Sombras y Elevación */
  --pc-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --pc-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --pc-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
  --pc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --pc-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* Colores Semánticos por Defecto */
  --pc-color-primary: #6366f1;
  --pc-color-primary-rgb: 99, 102, 241;
  --pc-color-primary-hover: #4f46e5;
  --pc-color-primary-active: #4338ca;
  --pc-color-primary-subtle: rgba(99, 102, 241, 0.12);
  --pc-color-primary-glow: rgba(99, 102, 241, 0.35);
  --pc-color-primary-text: #ffffff;

  --pc-color-secondary: #4f46e5;
  --pc-color-accent: #818cf8;

  /* Estados de Feedback */
  --pc-feedback-success: #10b981;
  --pc-feedback-success-bg: #ecfdf5;
  --pc-feedback-success-border: #a7f3d0;
  
  --pc-feedback-warning: #f59e0b;
  --pc-feedback-warning-bg: #fffbeb;
  --pc-feedback-warning-border: #fde68a;

  --pc-feedback-danger: #ef4444;
  --pc-feedback-danger-bg: #fef2f2;
  --pc-feedback-danger-border: #fecaca;

  --pc-feedback-info: #3b82f6;
  --pc-feedback-info-bg: #eff6ff;
  --pc-feedback-info-border: #bfdbfe;

  /* Lienzo y Superficies (Modo Híbrido / Claro) */
  --pc-bg-canvas: #f8fafc;
  --pc-bg-surface: #ffffff;
  --pc-bg-card: #ffffff;
  --pc-bg-input: #ffffff;
  --pc-bg-hover: #f1f5f9;
  --pc-bg-active: #e2e8f0;

  /* Sidebar Oscuro (Modo Híbrido SaaS) */
  --pc-sidebar-bg: #111827;
  --pc-sidebar-border: rgba(255, 255, 255, 0.08);
  --pc-sidebar-text: #94a3b8;
  --pc-sidebar-text-active: #ffffff;
  --pc-sidebar-item-hover: rgba(255, 255, 255, 0.06);
  --pc-sidebar-item-active: var(--pc-color-primary);

  /* Barra Superior */
  --pc-topbar-bg: #111827;
  --pc-topbar-border: rgba(255, 255, 255, 0.08);
  --pc-topbar-text: #f1f5f9;
  --pc-topbar-hover: rgba(255, 255, 255, 0.08);

  /* Texto de Contenido */
  /* Enlaces y Textos */
  --pc-text-heading: #0f172a;
  --pc-text-body: #334155;
  --pc-text-muted: #64748b;
  --pc-text-faint: #94a3b8;
  --pc-color-link: var(--pc-color-primary);
  --pc-color-link-hover: var(--pc-color-primary-hover);

  /* Bordes y Formularios */
  --pc-border-subtle: #f1f5f9;
  --pc-border-default: #e2e8f0;
  --pc-border-card: #e2e8f0;
  --pc-border-focus: var(--pc-color-primary);
  --pc-border-input: #cbd5e1;
  --pc-input-text: #0f172a;
  --pc-input-focus: var(--pc-color-primary);
  --pc-sidebar-sub-bg: #0d131f;
}

/* Modo Total Oscuro */
html[data-powercode-theme="dark"],
body.powercode-dark-theme {
  --pc-bg-canvas: #090d16;
  --pc-bg-surface: #111827;
  --pc-bg-card: #111827;
  --pc-bg-input: #1e293b;
  --pc-bg-hover: #1e293b;
  --pc-bg-active: #334155;

  --pc-sidebar-bg: #090d16;
  --pc-sidebar-border: #1e293b;
  --pc-sidebar-text: #94a3b8;
  --pc-sidebar-text-active: #ffffff;
  --pc-sidebar-item-hover: rgba(255, 255, 255, 0.05);
  --pc-sidebar-sub-bg: #04070d;

  --pc-topbar-bg: #090d16;
  --pc-topbar-border: #1e293b;
  --pc-topbar-text: #f8fafc;

  --pc-text-heading: #f8fafc;
  --pc-text-body: #cbd5e1;
  --pc-text-muted: #94a3b8;
  --pc-text-faint: #64748b;
  --pc-color-link: var(--pc-color-primary);
  --pc-color-link-hover: var(--pc-color-accent);

  --pc-border-subtle: #162032;
  --pc-border-default: #1e293b;
  --pc-border-card: #1e293b;
  --pc-border-input: #334155;
  --pc-input-text: #f8fafc;
  --pc-input-focus: var(--pc-color-primary);
}

/* Modo Total Claro */
html[data-powercode-theme="light"],
body.powercode-light-theme {
  --pc-bg-canvas: #f8fafc;
  --pc-bg-surface: #ffffff;
  --pc-bg-card: #ffffff;
  --pc-bg-input: #ffffff;
  --pc-bg-hover: #f1f5f9;
  --pc-bg-active: #e2e8f0;

  --pc-sidebar-bg: #ffffff;
  --pc-sidebar-border: #e2e8f0;
  --pc-sidebar-text: #64748b;
  --pc-sidebar-text-active: #0f172a;
  --pc-sidebar-item-hover: #f1f5f9;

  --pc-topbar-bg: #ffffff;
  --pc-topbar-border: #e2e8f0;
  --pc-topbar-text: #0f172a;
  --pc-topbar-hover: #f1f5f9;

  --pc-text-heading: #0f172a;
  --pc-text-body: #334155;
  --pc-text-muted: #64748b;
  --pc-text-faint: #94a3b8;

  --pc-border-subtle: #f8fafc;
  --pc-border-default: #e2e8f0;
}

/* Soporte para Reducción de Movimiento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
