/* ===== SISTEMA DE DISEÑO GOOGLE MATERIAL DESIGN ===== */

/* Importar fuentes Google Material Design */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&family=Roboto+Mono:wght@400;500&display=swap');

/* Variables CSS del Sistema de Diseño */
:root {
  /* === TIPOGRAFÍA GOOGLE === */
  --font-sans: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Roboto Mono', 'JetBrains Mono', 'Fira Code', monospace;
  
  /* === ESCALA TIPOGRÁFICA === */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  
  /* === LINE HEIGHTS === */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  
  /* === GOOGLE MATERIAL COLORS === */
  --google-blue-50: #e3f2fd;
  --google-blue-100: #bbdefb;
  --google-blue-200: #90caf9;
  --google-blue-300: #64b5f6;
  --google-blue-400: #42a5f5;
  --google-blue-500: #2196f3;
  --google-blue-600: #1e88e5;
  --google-blue-700: #1976d2;
  --google-blue-800: #1565c0;
  --google-blue-900: #0d47a1;

  --google-grey-50: #fafafa;
  --google-grey-100: #f5f5f5;
  --google-grey-200: #eeeeee;
  --google-grey-300: #e0e0e0;
  --google-grey-400: #bdbdbd;
  --google-grey-500: #9e9e9e;
  --google-grey-600: #757575;
  --google-grey-700: #616161;
  --google-grey-800: #424242;
  --google-grey-900: #212121;
  
  /* === COLORES DE MARCA GOOGLE === */
  --primary-50: var(--google-blue-50);
  --primary-100: var(--google-blue-100);
  --primary-200: var(--google-blue-200);
  --primary-300: var(--google-blue-300);
  --primary-400: var(--google-blue-400);
  --primary-500: var(--google-blue-500);
  --primary-600: var(--google-blue-600);
  --primary-700: var(--google-blue-700);
  --primary-800: var(--google-blue-800);
  --primary-900: var(--google-blue-900);
  
  /* === COLORES SEMÁNTICOS === */
  --success-50: #f0fdf4;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  
  /* === RADIOS Y ESPACIADO === */
  --radius-xs: 0.25rem;   /* 4px */
  --radius-sm: 0.375rem;  /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  
  /* === SOMBRAS MATERIAL DESIGN === */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* === TEMA CLARO GOOGLE === */
  --bg: var(--google-grey-50);
  --fg: var(--google-grey-900);
  --bg-secondary: white;
  --fg-secondary: var(--google-grey-600);
  --border: var(--google-grey-200);
  --border-hover: var(--google-grey-300);
  --card-bg: white;
  --card-border: var(--google-grey-200);
  --card-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --card-shadow-hover: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
  
  /* === SIDEBAR GOOGLE === */
  --sidebar-bg: white;
  --sidebar-fg: var(--google-grey-700);
  --sidebar-border: var(--google-grey-200);
  --sidebar-item-hover: var(--google-grey-100);
  --sidebar-item-active: var(--primary-50);
  --sidebar-item-active-fg: var(--primary-700);
  
  /* === BOTONES GOOGLE === */
  --btn-primary-bg: var(--primary-600);
  --btn-primary-hover: var(--primary-700);
  --btn-secondary-bg: var(--google-grey-100);
  --btn-secondary-hover: var(--google-grey-200);
  --btn-ghost-hover: var(--google-grey-100);
  
  /* === FORMULARIOS GOOGLE === */
  --input-bg: white;
  --input-border: var(--google-grey-300);
  --input-border-focus: var(--primary-500);
  --input-ring: rgba(33, 150, 243, 0.2);
  --input-placeholder: var(--google-grey-400);
}

/* === TEMA OSCURO GOOGLE === */
[data-theme="dark"] {
  --bg: var(--google-grey-900);
  --fg: var(--google-grey-100);
  --bg-secondary: var(--google-grey-800);
  --fg-secondary: var(--google-grey-400);
  --border: var(--google-grey-700);
  --border-hover: var(--google-grey-600);
  --card-bg: var(--google-grey-800);
  --card-border: var(--google-grey-700);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  
  /* === SIDEBAR OSCURO GOOGLE === */
  --sidebar-bg: var(--google-grey-800);
  --sidebar-fg: var(--google-grey-300);
  --sidebar-border: var(--google-grey-700);
  --sidebar-item-hover: var(--google-grey-700);
  --sidebar-item-active: var(--primary-900);
  --sidebar-item-active-fg: var(--primary-300);
  
  /* === BOTONES OSCURO GOOGLE === */
  --btn-secondary-bg: var(--google-grey-700);
  --btn-secondary-hover: var(--google-grey-600);
  --btn-ghost-hover: var(--google-grey-700);
  
  /* === FORMULARIOS OSCURO GOOGLE === */
  --input-bg: var(--google-grey-800);
  --input-border: var(--google-grey-600);
  --input-placeholder: var(--google-grey-500);
}

/* === RESET Y BASE === */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  background-color: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* === UTILIDADES TIPOGRÁFICAS === */
.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-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.leading-tight { line-height: var(--leading-tight); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

/* === TRANSICIONES GLOBALES === */
* {
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, 
              box-shadow 0.2s ease, transform 0.2s ease;
}

/* === SCROLLBAR PERSONALIZADA === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--google-grey-100);
}

::-webkit-scrollbar-thumb {
  background: var(--google-grey-300);
  border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--google-grey-400);
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--google-grey-800);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--google-grey-600);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--google-grey-500);
}

/* === BOTONES MATERIAL DESIGN === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--text-sm);
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* === VARIANTES DE BOTONES === */
.btn-filled-primary {
  background: var(--primary-600);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-filled-primary:hover {
  background: var(--primary-700);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-tonal-primary {
  background: var(--primary-100);
  color: var(--primary-700);
  border: 1px solid var(--primary-200);
}

.btn-tonal-primary:hover {
  background: var(--primary-200);
  transform: translateY(-1px);
}

.btn-outlined-primary {
  background: transparent;
  color: var(--primary-600);
  border: 1px solid var(--primary-300);
}

.btn-outlined-primary:hover {
  background: var(--primary-50);
  border-color: var(--primary-400);
  transform: translateY(-1px);
}

.btn-text-primary {
  background: transparent;
  color: var(--primary-600);
  padding: 0.5rem 0.75rem;
}

.btn-text-primary:hover {
  background: var(--primary-50);
}

/* === TAMAÑOS === */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: var(--text-xs);
  gap: 0.25rem;
}

.btn-md {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: var(--text-base);
  gap: 0.75rem;
}

/* === ESTADOS === */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:disabled:hover {
  background: inherit;
  box-shadow: inherit;
}

/* === MODO OSCURO === */
[data-theme="dark"] .btn-filled-primary {
  background: var(--primary-500);
}

[data-theme="dark"] .btn-filled-primary:hover {
  background: var(--primary-400);
}

[data-theme="dark"] .btn-tonal-primary {
  background: var(--primary-900);
  color: var(--primary-200);
  border-color: var(--primary-800);
}

[data-theme="dark"] .btn-tonal-primary:hover {
  background: var(--primary-800);
}

[data-theme="dark"] .btn-outlined-primary {
  color: var(--primary-400);
  border-color: var(--primary-600);
}

[data-theme="dark"] .btn-outlined-primary:hover {
  background: var(--primary-900);
  border-color: var(--primary-500);
}

[data-theme="dark"] .btn-text-primary {
  color: var(--primary-400);
}

[data-theme="dark"] .btn-text-primary:hover {
  background: var(--primary-900);
}