/* 
 * Modern Design System - Immediate Visual Impact
 * Production-ready CSS with glassmorphism and modern aesthetics
 */
@import './github-dark.css';
:root {
  /* Primary Brand Colors */
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --accent: #a855f7;
  --accent-light: #c084fc;
  
  /* Semantic Colors */
  --success: #22c55e;
  --success-light: #4ade80;
  --warning: #fb923c;
  --warning-light: #fbbf24;
  --error: #ef4444;
  --error-light: #f87171;
  --error-dark: #dc2626;
  
  /* Background System */
  --background: #0f0f23;
  --background-gradient: linear-gradient(135deg, #0f0f23 0%, #1e1b4b 50%, #312e81 100%);
  --surface: rgba(255, 255, 255, 0.05);
  --surface-variant: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.1);
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  
  /* Border System */
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(99, 102, 241, 0.5);
  --focus-ring: rgba(99, 102, 241, 0.6);
  
  /* Spacing Scale */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  
  /* Typography Scale */
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  
  /* Border Radius */
  --radius-xs: 0.125rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-3xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Shadow System */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  
  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Font Stacks */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

/* Modern Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Immediate Visual Impact */
html {
  height: 100%;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--background-gradient);
  color: var(--text-primary);
  overflow-x: hidden;
  position: relative;
}

/* Animated Background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(34, 197, 94, 0.05) 0%, transparent 50%);
  animation: backgroundShift 20s ease-in-out infinite;
  z-index: -1;
}

@keyframes backgroundShift {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Root Container */
#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Immediate Glassmorphism Effect */
.app-container {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  margin: var(--spacing-md);
  overflow: hidden;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-variant);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-focus);
  background-clip: content-box;
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-variant) transparent;
}

/* Selection */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

::-moz-selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

/* Focus Outline */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  body::before {
    animation: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --border: #ffffff;
    --border-light: #ffffff;
    --text-secondary: #ffffff;
    --surface: rgba(255, 255, 255, 0.2);
    --surface-variant: rgba(255, 255, 255, 0.3);
  }
}

/* Responsive Base */
@media (max-width: 768px) {
  .app-container {
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
  }
  
  html {
    font-size: 14px;
  }
}

/* Reglas específicas para móvil - viewport y scroll */
@media (max-width: 768px) {
  html {
    /* Prevenir zoom horizontal */
    overflow-x: hidden;
    /* Asegurar altura de viewport móvil */
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height para móviles modernos */
    /* Safari específico */
    height: -webkit-fill-available;
  }
  
  body {
    /* Prevenir scroll horizontal */
    overflow-x: hidden;
    /* Asegurar que el body use toda la altura disponible */
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available; /* Safari específico */
    /* Prevenir elastic scroll en iOS */
    position: relative; /* Cambio de fixed a relative para Safari */
    width: 100%;
    /* Safari móvil fix */
    -webkit-overflow-scrolling: touch;
  }
  
  #root {
    /* Usar toda la altura de viewport */
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available; /* Safari específico */
    overflow-x: hidden;
    overflow-y: auto;
    /* Scroll suave en móvil */
    -webkit-overflow-scrolling: touch;
    /* Safari fix */
    position: relative;
  }
  
  /* Mejorar área táctil en móvil */
  button, 
  input, 
  textarea,
  select,
  .clickable {
    min-height: 44px;
    touch-action: manipulation; /* Prevenir double-tap zoom */
  }
  
  /* Prevenir zoom en inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    font-size: 16px !important; /* Prevenir zoom en iOS */
  }
}

/* Reglas para pantallas muy pequeñas */
@media (max-width: 480px) {
  html {
    font-size: 14px; /* Texto base más pequeño */
  }
  
  body {
    /* Reducir el padding/margin por defecto del navegador */
    margin: 0;
    padding: 0;
  }
}

/* Landscape móvil */
@media (max-width: 768px) and (orientation: landscape) {
  html {
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
  }
  
  body {
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
  }
  
  #root {
    height: 100vh;
    height: 100dvh;
    height: -webkit-fill-available;
  }
}

/* Safari específico - CSS adicional */
@supports (-webkit-touch-callout: none) {
  /* Estas reglas solo se aplican en Safari */
  .app-layout {
    height: -webkit-fill-available !important;
    min-height: -webkit-fill-available;
  }
  
  .chat-container {
    height: -webkit-fill-available !important;
    min-height: -webkit-fill-available;
  }
  
  body {
    height: -webkit-fill-available !important;
    min-height: -webkit-fill-available;
  }
}

/* Ensure immediate visual feedback */
.modern-ui {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
}
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--secondary-bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* Elementos base */
button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  transition: all var(--transition-fast);
}

input, textarea {
  font-family: inherit;
  outline: none;
}

/* Utilidades */
.glass {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

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

/* Dark mode tipo Perplexity */
:root {
  --primary-bg-color: #191a1a;
  --secondary-bg-color: #23272f;
  --border-color: #23272f;
  --text-color: #f3f4f6;
  --secondary-color: #60a5fa;
  --user-bubble: linear-gradient(135deg, #2563eb 0%, #1e293b 100%);
  --assistant-bubble: linear-gradient(135deg, #23272f 0%, #191a1a 100%);
  --shadow: 0 2px 12px 0 rgba(30,41,59,0.18);
}

/* Reset y base styles mejorados */
* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'HelveticaNeueLight', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(120deg, #191a1a 0%, #23272f 100%);
  color: var(--text-color);
  height: 100vh;
  overflow-x: hidden;
  position: relative;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}

#root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
  /* Estilos específicos para dispositivos táctiles */
  button, 
  .clickable {
    min-height: 44px; /* Área táctil mínima recomendada */
    min-width: 44px;
  }
}
