/* =========================================
   DATERO - Sistema de Diseño Global
   Tema Claro y Oscuro Profesional
   ========================================= */

/* Variables CSS Globales para el Tema */
:root {
  /* Modo Claro - Colores Base */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  
  --border-default: #e5e7eb;
  --border-hover: #d1d5db;
  
  --accent-primary: #dc2626;
  --accent-hover: #b91c1c;
  --accent-light: #fef2f2;
  
  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --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);
}

/* Modo Oscuro - Estilo ChatGPT/Google */
[data-theme="dark"] {
  --bg-primary: #212121;
  --bg-secondary: #171717;
  --bg-tertiary: #2a2a2a;
  
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-tertiary: #8e8e8e;
  
  --border-default: #3e3e3e;
  --border-hover: #525252;
  
  --accent-primary: #ef4444;
  --accent-hover: #dc2626;
  --accent-light: #7f1d1d;
  
  /* Sombras para modo oscuro */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.7), 0 2px 4px -2px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.8), 0 4px 6px -4px rgba(0, 0, 0, 0.7);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.9), 0 8px 10px -6px rgba(0, 0, 0, 0.8);
}

/* Reset y Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Utilidades Base para Temas */
.bg-theme-primary {
  background-color: var(--bg-primary);
}

.bg-theme-secondary {
  background-color: var(--bg-secondary);
}

.bg-theme-tertiary {
  background-color: var(--bg-tertiary);
}

.text-theme-primary {
  color: var(--text-primary);
}

.text-theme-secondary {
  color: var(--text-secondary);
}

.text-theme-tertiary {
  color: var(--text-tertiary);
}

.border-theme {
  border-color: var(--border-default);
}

.border-theme-hover:hover {
  border-color: var(--border-hover);
}

.accent-primary {
  color: var(--accent-primary);
}

.bg-accent-primary {
  background-color: var(--accent-primary);
}

.bg-accent-hover:hover {
  background-color: var(--accent-hover);
}

/* Botones Estilo Profesional */
.btn-primary {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background-color: var(--accent-primary);
  color: white;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Source Buttons (Sidebar) */
.source-btn {
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.15s ease;
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.source-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.source-btn.active {
  background-color: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Cards Profesionales */
.card {
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: all 0.3s ease;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-lg);
}

/* Inputs Profesionales */
.input-field {
  width: 100%;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.input-field:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input-field::placeholder {
  color: var(--text-tertiary);
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  border-radius: 1rem;
  padding: 1.5rem;
  max-width: 42rem;
  width: 100%;
  margin: 0 1rem;
  background-color: var(--bg-primary);
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.2s ease-out;
}

/* Tablas */
.table-professional {
  width: 100%;
  border-collapse: collapse;
}

.table-professional thead {
  background-color: var(--bg-tertiary);
  border-bottom: 2px solid var(--border-default);
}

.table-professional th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
}

.table-professional td {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-default);
}

.table-professional tr:hover {
  background-color: var(--bg-secondary);
}

/* Badges y Tags */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-primary {
  background-color: var(--accent-light);
  color: var(--accent-primary);
}

.badge-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Estados de Loading */
.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* Transiciones Suaves */
.transition-theme {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Efectos de Hover Profesionales */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(220, 38, 38, 0.3);
}

[data-theme="dark"] .hover-glow:hover {
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

/* Animaciones de Entrada */
.fade-in, .animate-fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

.slide-up, .animate-slide-up {
  animation: slideUp 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mejoras de Accesibilidad */
.focus-visible:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Utilities para gradientes */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .gradient-text {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Separadores */
.divider {
  height: 1px;
  background-color: var(--border-default);
}

/* Grid Responsive */
.grid-responsive {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Logo visibility based on theme */
.logo-light {
  display: block;
}

.logo-dark {
  display: none;
}

[data-theme="dark"] .logo-light {
  display: none;
}

[data-theme="dark"] .logo-dark {
  display: block;
}

/* Theme icon visibility */
.theme-icon-light {
  display: inline;
}

.theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark {
  display: inline;
}
