@tailwind base;
@tailwind components;
@tailwind utilities;

/* Variables CSS para temas */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-primary: #f59e0b;
  --accent-secondary: #d97706;
  --accent-blue: #3b82f6;
  --accent-sky: #0ea5e9;
}

/* Modo claro */
.light {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
}

/* Modo oscuro */
.dark {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
}

/* Aplicar colores de texto según el tema */
.dark .text-white { color: #ffffff !important; }
.light .text-white { color: #0f172a !important; } /* Gris oscuro casi negro para modo claro */
.dark .text-slate-300 { color: #cbd5e1 !important; }
.light .text-slate-300 { color: #334155 !important; } /* Gris oscuro para modo claro */
.dark .text-slate-400 { color: #94a3b8 !important; }
.light .text-slate-400 { color: #475569 !important; } /* Gris medio oscuro para modo claro */

/* Forzar colores de texto en modo claro para todos los elementos */
.light * { color: inherit !important; }
.light h1, .light h2, .light h3, .light h4, .light h5, .light h6 { color: #0f172a !important; }
.light p, .light span, .light div, .light label { color: #0f172a !important; }
.light button { color: #0f172a !important; }
.light input, .light textarea, .light select { color: #0f172a !important; }

/* Calculadora de costos - Glassmorphism */
.dark .bg-slate-800\/80 {
  background-color: rgba(30, 41, 59, 0.8) !important;
  backdrop-filter: blur(16px) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(30, 41, 59, 0.2) !important;
}

.light .bg-slate-800\/80 {
  background-color: rgba(55, 65, 81, 0.8) !important;
  backdrop-filter: blur(16px) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(111, 131, 121, 0.2) !important;
}

/* Elementos internos */
.dark .bg-slate-900\/50 {
  background-color: rgba(15, 23, 42, 0.5) !important;
  backdrop-filter: blur(12px) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(15, 23, 42, 0.3) !important;
}

.light .bg-slate-900\/50 {
  background-color: rgba(71, 85, 105, 0.5) !important;
  backdrop-filter: blur(12px) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(111, 131, 121, 0.2) !important;
}

/* Colores de texto con opacidad */
.dark .text-white\/80 { color: rgba(255, 255, 255, 0.8) !important; }
.light .text-white\/80 { color: rgba(15, 23, 42, 0.8) !important; } /* Gris oscuro casi negro con opacidad */
.dark .text-white\/70 { color: rgba(255, 255, 255, 0.7) !important; }
.light .text-white\/70 { color: rgba(15, 23, 42, 0.7) !important; } /* Gris oscuro casi negro con opacidad */
.dark .text-white\/60 { color: rgba(255, 255, 255, 0.6) !important; }
.light .text-white\/60 { color: rgba(51, 65, 85, 0.6) !important; } /* Gris oscuro con opacidad */
.dark .text-white\/50 { color: rgba(255, 255, 255, 0.5) !important; }
.light .text-white\/50 { color: rgba(51, 65, 85, 0.5) !important; } /* Gris oscuro con opacidad */
.dark .text-white\/90 { color: rgba(255, 255, 255, 0.9) !important; }
.light .text-white\/90 { color: rgba(15, 23, 42, 0.9) !important; } /* Gris oscuro casi negro con opacidad */

/* Aplicar colores del tema a elementos específicos */
.dark .min-h-screen { background-color: var(--bg-primary) !important; }
.light .min-h-screen { background-color: var(--bg-primary) !important; }

/* Asegurar que los fondos personalizados funcionen */
.custom-background .bg-slate-900 { background-color: transparent !important; }
.custom-background .text-white { color: white !important; }

/* Forzar transparencia en fondos personalizados */
.custom-background {
  background-color: transparent !important;
}

/* Asegurar que elementos específicos sean transparentes en fondos personalizados */
.custom-background .min-h-screen {
  background-color: transparent !important;
}

.custom-background .bg-slate-800 {
  background-color: rgba(30, 41, 59, 0.5) !important;
  backdrop-filter: blur(12px);
}

.custom-background .bg-slate-900 {
  background-color: rgba(15, 23, 42, 0.5) !important;
  backdrop-filter: blur(12px);
}

body.custom-background {
  background-color: transparent !important;
}

/* Efectos glassmorphism */
.glass-dark {
  background: rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 
    0 8px 32px 0 rgba(0, 0, 0, 0.3),
    0 2px 16px 0 rgba(0, 0, 0, 0.2),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

.glass-light {
  background: rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 8px 32px 0 rgba(31, 38, 135, 0.15),
    0 2px 16px 0 rgba(31, 38, 135, 0.1),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
}

/* Componentes personalizados */
@layer components {
  .glass-surface {
    @apply backdrop-blur-md bg-white/10 border border-white/20;
  }
  
  .adaptive-button {
    @apply transition-all duration-200 focus:outline-none focus:ring-2;
  }

  .glass-card {
    @apply backdrop-blur-xl bg-white/10 border border-white/20 rounded-2xl shadow-2xl;
  }

  .glass-input {
    @apply backdrop-blur-sm bg-white/10 border border-white/20 rounded-lg text-white placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-white/30;
  }

  .glass-select {
    @apply backdrop-blur-sm bg-white/10 border border-white/20 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-white/30;
  }

  .glass-textarea {
    @apply backdrop-blur-sm bg-white/10 border border-white/20 rounded-lg text-white placeholder-white/60 focus:outline-none focus:ring-2 focus:ring-white/30 resize-none;
  }
}

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-in {
  animation: slideIn 0.3s ease-out;
}

.animate-pulse-slow {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Estilos para elementos de formulario */
.glass-input:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.glass-select:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.glass-textarea:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Estilos de contenido */
.prose h1, .prose h2, .prose h3 { 
  margin-top: 1.2em; 
  margin-bottom: 0.5em; 
  line-height: 1.2; 
}
.prose p { margin-bottom: 1em; }
.prose ul, .prose ol { 
  margin-left: 1.5em; 
  margin-bottom: 1em; 
}
.prose li { margin-bottom: 0.5em; }

/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: all 0.3s ease;
}