/* Variables CSS para paleta de grises elegantes */
:root {
  --primary-color: #374151;
  --secondary-color: #6b7280;
  --accent-color: #9ca3af;
  --dark-gray: #1f2937;
  --medium-gray: #4b5563;
  --light-gray: #d1d5db;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-dark: #111827;
  --border-color: #e5e7eb;
  --shadow-light: 0 1px 3px rgba(55, 65, 81, 0.1);
  --shadow-medium: 0 4px 6px rgba(55, 65, 81, 0.15);
  --shadow-heavy: 0 10px 15px rgba(55, 65, 81, 0.2);
  --gradient-primary: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  --gradient-secondary: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

/* Modo oscuro */
[data-theme="dark"] {
  --primary-color: #9ca3af;
  --secondary-color: #d1d5db;
  --accent-color: #f3f4f6;
  --dark-gray: #f9fafb;
  --medium-gray: #e5e7eb;
  --light-gray: #6b7280;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-light: #9ca3af;
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-dark: #374151;
  --border-color: #374151;
  --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-heavy: 0 10px 15px rgba(0, 0, 0, 0.5);
  --gradient-primary: linear-gradient(135deg, #9ca3af 0%, #d1d5db 100%);
  --gradient-secondary: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

/* Reset y estilos base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', -apple-system, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  font-size: 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}
.frame { position:fixed; inset:24px; border-radius:16px; overflow:hidden; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
    iframe { width:100%; height:100%; border:0; background:#fff; }
/* Estilos globales para elementos de texto en modo oscuro */
[data-theme="dark"] p {
  color: var(--text-secondary);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: var(--text-primary);
}

[data-theme="dark"] a {
  color: var(--accent-color);
}

[data-theme="dark"] .nav-links a {
  color: var(--text-primary);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header y navegación */
header {
  background: var(--bg-primary);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-light);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all 0.3s ease;
  border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] header {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(10px);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary-color);
  text-decoration: none;
}

.logo-accent {
  color: var(--secondary-color);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
}

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a:hover {
  color: var(--primary-color);
}

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 0;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

#theme-toggle {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 50px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  color: var(--text-primary);
}

#theme-toggle:hover {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--bg-primary);
  transform: scale(1.05);
}

[data-theme="dark"] #theme-toggle {
  background: var(--bg-dark);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] #theme-toggle:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--bg-primary);
}

/* Fondo animado */
#code-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(55, 65, 81, 0.02) 0%, rgba(107, 114, 128, 0.03) 100%);
  overflow: hidden;
}

[data-theme="dark"] #code-bg {
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.8) 0%, rgba(31, 41, 55, 0.9) 100%);
}

.code-stream {
  position: absolute;
  white-space: pre;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.95rem;
  opacity: 0.8;
  user-select: none;
  animation: codeMove 15s linear infinite;
  font-weight: 600;
  pointer-events: none;
}

/* Diferentes colores para cada tipo de código */
.code-stream.javascript {
  color: #1a202c;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.code-stream.php {
  color: #2d3748;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.code-stream.json {
  color: #4a5568;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.code-stream.python {
  color: #2d3748;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.code-stream.sql {
  color: #1a202c;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Colores más visibles para modo oscuro */
[data-theme="dark"] .code-stream.javascript {
  color: #e2e8f0;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

[data-theme="dark"] .code-stream.php {
  color: #f7fafc;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

[data-theme="dark"] .code-stream.json {
  color: #edf2f7;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

[data-theme="dark"] .code-stream.python {
  color: #f7fafc;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

[data-theme="dark"] .code-stream.sql {
  color: #e2e8f0;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
}

@keyframes codeMove {
  0% { transform: translateY(-100px); opacity: 0; }
  10% { opacity: 0.1; }
  90% { opacity: 0.1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

/* Hero section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 2rem;
  background: linear-gradient(135deg, rgba(55, 65, 81, 0.05) 0%, rgba(107, 114, 128, 0.08) 100%);
}

.hero-text h1 {
  font-size: 3.5rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Arreglar el h1 en modo oscuro */
[data-theme="dark"] .hero-text h1 {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--text-primary); /* Fallback por si el gradiente falla */
}

.highlight {
  color: var(--accent-color);
}

[data-theme="dark"] .highlight {
  color: var(--accent-color);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

[data-theme="dark"] .hero-subtitle {
  color: var(--text-secondary);
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.875rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-medium);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-heavy);
}

.btn-secondary {
  background: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  box-shadow: var(--shadow-light);
}

[data-theme="dark"] .btn-secondary {
  background: var(--bg-secondary);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

[data-theme="dark"] .btn-secondary:hover {
  background: var(--accent-color);
  color: var(--bg-primary);
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

[data-theme="dark"] .btn-outline {
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

[data-theme="dark"] .btn-outline:hover {
  background: var(--accent-color);
  color: var(--bg-primary);
}

/* Secciones */
.section {
  padding: 5rem 0;
  position: relative;
}

.section h2 {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

[data-theme="dark"] .section h2 {
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 600px;
  margin: 0 auto 3rem;
}

[data-theme="dark"] .section-subtitle {
  color: var(--text-secondary);
}

/* Servicios */
.servicios-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.servicio {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .servicio {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.servicio::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.servicio:hover::before {
  transform: scaleX(1);
}

.servicio:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-heavy);
}

.servicio-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  display: block;
  color: var(--primary-color);
  transition: all 0.3s ease;
}

.servicio-icon i {
  transition: all 0.3s ease;
}

.servicio:hover .servicio-icon {
  color: var(--accent-color);
  transform: scale(1.1);
}

.servicio h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

[data-theme="dark"] .servicio h3 {
  color: var(--text-primary);
}

.servicio p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

[data-theme="dark"] .servicio p {
  color: var(--text-secondary);
}

.servicio-features {
  list-style: none;
}

.servicio-features li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  position: relative;
  padding-left: 1.5rem;
}

[data-theme="dark"] .servicio-features li {
  color: var(--text-secondary);
}

.servicio-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--medium-gray);
  font-weight: bold;
}

[data-theme="dark"] .servicio-features li::before {
  color: var(--accent-color);
}

/* Portafolio */
.portafolio-section {
  background: var(--bg-secondary);
}

.portafolio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  margin-top: 3rem;
}

@media (min-width: 1024px) {
  .portafolio-grid {
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }
}

.featured-project {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-medium);
  transition: transform 0.3s ease;
}

[data-theme="dark"] .featured-project {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.featured-project:hover {
  transform: translateY(-5px);
}

.proyecto {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--shadow-light);
  transition: transform 0.3s ease;
}

[data-theme="dark"] .proyecto {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.proyecto:hover {
  transform: translateY(-3px);
}

.featured-project:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-heavy);
}

.proyecto-image {
  position: relative;
  height: 300px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 4rem;
}

/* New styles for image header */
.proyecto-image-header {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-radius: 15px 15px 0 0;
}

.project-title-image {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow-medium);
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
}

.project-title-image:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-heavy);
}

.project-website-btn {
  margin-top: 1rem;
}

.btn-website {
  background: var(--gradient-primary);
  color: white;
  padding: 1rem 2rem;
  border-radius: 25px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-medium);
}

.btn-website:hover {
  background: var(--gradient-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-heavy);
  color: white;
  text-decoration: none;
}

.btn-website i {
  font-size: 1rem;
}

.proyecto-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.status-badge {
  background: var(--medium-gray);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
}

.proyecto-content {
  padding: 2rem;
  background: var(--bg-primary);
}

[data-theme="dark"] .proyecto-content {
  background: var(--bg-secondary);
}

.proyecto-content h3 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

[data-theme="dark"] .proyecto-content h3 {
  color: var(--text-primary);
}

.tech-stack {
  display: flex;
  gap: 0.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.tech-tag {
  background: var(--bg-secondary);
  color: var(--primary-color);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 500;
}

.projeto-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

.metric {
  text-align: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 10px;
}

.metric-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-color);
}

.metric-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.proyecto-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.feature {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.feature i {
  color: var(--primary-color);
  font-size: 1rem;
}

[data-theme="dark"] .feature {
  color: var(--text-secondary);
}

[data-theme="dark"] .feature i {
  color: var(--accent-color);
}

/* Workflows Section */
.workflows-section {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

[data-theme="dark"] .workflows-section {
  background: var(--bg-primary);
}

.workflows-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 3rem;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.workflow-item {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--shadow-light);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.workflow-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .workflow-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .workflow-item:hover {
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.1);
}

.workflow-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-medium);
}

.workflow-preview {
  background: var(--gradient-primary);
  padding: 2rem;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.workflow-preview:has(.frame) {
  height: 500px;
  padding: 1rem;
}

[data-theme="dark"] .workflow-preview {
  background: var(--gradient-secondary);
}

/* N8N Demo Component Styles */
n8n-demo {
  width: 100% !important;
  height: 400px !important;
  max-width: 100% !important;
  max-height: 400px !important;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  background: #ffffff;
  display: block !important;
  contain: layout style size;
}

[data-theme="dark"] n8n-demo {
  background: #1a1a1a;
}

.workflow-preview:has(n8n-demo) {
  height: 450px !important;
  padding: 1rem;
  background: transparent;
  overflow: hidden;
}

/* Force contained sizing */
.workflow-preview n8n-demo {
  position: relative !important;
  transform: scale(1) !important;
  width: 100% !important;
  height: 400px !important;
}

/* Responsive para n8n-demo */
@media (max-width: 1024px) {
  n8n-demo {
    height: 350px !important;
    max-height: 350px !important;
  }
  
  .workflow-preview:has(n8n-demo) {
    height: 400px !important;
  }
}

.workflow-canvas {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.workflow-node {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.workflow-connection {
  width: 30px;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
  position: relative;
}

.workflow-connection::after {
  content: '';
  position: absolute;
  right: -4px;
  top: -2px;
  width: 0;
  height: 0;
  border-left: 6px solid rgba(255, 255, 255, 0.6);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}

.workflow-info {
  padding: 1.5rem;
}

.workflow-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

[data-theme="dark"] .workflow-info h3 {
  color: var(--text-primary);
}

.workflow-info p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

[data-theme="dark"] .workflow-info p {
  color: var(--text-secondary);
}

.workflow-stats {
  display: flex;
  gap: 1rem;
}

.stat {
  background: var(--bg-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

[data-theme="dark"] .stat {
  background: var(--bg-dark);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* N8N Workflow Viewer Custom Styles */
.workflow-preview:has(n8n-workflow-viewer) {
  background: transparent;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-medium);
}

.workflow-preview n8n-workflow-viewer {
  width: 100%;
  display: block;
}

.n8n-workflow-container {
  background: var(--bg-primary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-light);
}

[data-theme="dark"] .n8n-workflow-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.workflow-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[data-theme="dark"] .workflow-header {
  background: linear-gradient(135deg, var(--bg-dark), var(--medium-gray));
  color: var(--text-primary);
}

.workflow-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.workflow-controls {
  display: flex;
  gap: 0.5rem;
}

.fit-btn, .export-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.3s ease;
}

.fit-btn:hover, .export-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

[data-theme="dark"] .fit-btn,
[data-theme="dark"] .export-btn {
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .fit-btn:hover,
[data-theme="dark"] .export-btn:hover {
  background: var(--medium-gray);
}

/* Vis.js network container styling */
.n8n-workflow-container > div:last-child {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-top: none;
}

[data-theme="dark"] .n8n-workflow-container > div:last-child {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

/* Skills Section */
.skills-section {
  background: var(--bg-secondary);
  padding: 5rem 0;
}

[data-theme="dark"] .skills-section {
  background: var(--bg-primary);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.skill-category {
  background: var(--bg-primary);
  border-radius: 15px;
  padding: 2rem;
  text-align: center;
  box-shadow: var(--shadow-medium);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.skill-category:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-heavy);
}

[data-theme="dark"] .skill-category {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.skill-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.skill-icon i {
  display: block;
  transition: all 0.3s ease;
}

.skill-category:hover .skill-icon i {
  transform: scale(1.1);
  color: var(--accent-color);
}

.skill-category h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.skill-tag {
  padding: 0.5rem 1rem;
  border-radius: 25px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.skill-tag.advanced {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.skill-tag.intermediate {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.skill-tag.beginner {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
}

.skill-tag:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.experience-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  background: var(--bg-primary);
  border-radius: 15px;
  padding: 2rem;
  box-shadow: var(--shadow-medium);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .experience-summary {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.experience-item {
  text-align: center;
}

.experience-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.experience-label {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
}

@media (max-width: 768px) {
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .skill-category {
    padding: 1.5rem;
  }
  
  .skill-icon {
    font-size: 2.5rem;
  }
  
  .experience-summary {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .experience-number {
    font-size: 2rem;
  }
}

/* Education Section */
.education-section {
  margin-top: 3rem;
}

.education-section h3 {
  text-align: center;
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.education-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.education-item {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  transition: all 0.3s ease;
}

.education-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-medium);
}

[data-theme="dark"] .education-item {
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

.education-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
  color: var(--primary-color);
  transition: all 0.3s ease;
}

.education-icon i {
  transition: all 0.3s ease;
}

.education-item:hover .education-icon {
  color: var(--accent-color);
  transform: scale(1.1);
}

.education-content {
  flex: 1;
}

.education-content h4 {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.education-institution {
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.education-year {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.education-status {
  display: flex;
  gap: 0.5rem;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status-badge.completed {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

@media (max-width: 768px) {
  .education-grid {
    grid-template-columns: 1fr;
  }
  
  .education-item {
    padding: 1.5rem;
    gap: 1rem;
  }
  
  .education-icon {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .workflows-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .workflow-canvas {
    gap: 0.5rem;
  }
  
  .workflow-node {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
  
  .workflow-connection {
    width: 20px;
  }
}

[data-theme="dark"] .automation-section {
  background: var(--bg-primary); /* Fondo negro en modo oscuro */
  color: var(--text-primary); /* Texto blanco en modo oscuro */
}

.automation-section h2,
.automation-section .section-subtitle {
  color: white;
}

[data-theme="dark"] .automation-section h2,
[data-theme="dark"] .automation-section .section-subtitle {
  color: var(--text-primary); /* Texto blanco en modo oscuro */
}

.automation-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.automation-item {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 2rem;
  text-align: center;
  color: white;
}

[data-theme="dark"] .automation-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.automation-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: white;
}

[data-theme="dark"] .automation-icon {
  color: var(--accent-color);
}

.automation-item h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: white;
}

[data-theme="dark"] .automation-item h3 {
  color: var(--text-primary);
}

.automation-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  opacity: 0.8;
  color: white;
}

[data-theme="dark"] .automation-flow {
  color: var(--text-secondary);
}

.automation-flow span {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  color: white;
}

[data-theme="dark"] .automation-flow span {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

/* Contacto */
.contact-section {
  background: var(--bg-secondary);
}

.contact-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.contact-method {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
}

[data-theme="dark"] .contact-method {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.contact-method:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-medium);
}

.contact-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  transition: all 0.3s ease;
}

.contact-icon i {
  transition: all 0.3s ease;
}

.contact-method:hover .contact-icon {
  color: var(--accent-color);
  transform: scale(1.1);
}

.contact-method h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

[data-theme="dark"] .contact-method h3 {
  color: var(--text-primary);
}

/* Redes sociales */
.socials {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.social-icon {
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s ease;
}

.social-icon:hover {
  transform: translateY(-3px) scale(1.1);
  background: var(--medium-gray);
}

/* Chat flotante */
.chat-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-primary);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-heavy);
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
  touch-action: manipulation; /* Mejora respuesta táctil */
  -webkit-tap-highlight-color: transparent; /* Elimina resaltado en iOS */
  position: relative;
  z-index: 1001;
}

[data-theme="dark"] .chat-toggle {
  background: var(--gradient-secondary);
  color: white;
}

.chat-toggle:hover,
.chat-toggle:active {
  transform: scale(1.1);
}

@keyframes pulse {
  0% { box-shadow: var(--shadow-heavy); }
  50% { box-shadow: 0 0 0 10px rgba(55, 65, 81, 0.3); }
  100% { box-shadow: var(--shadow-heavy); }
}

.chat-box {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 320px;
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow-heavy);
  transform: scale(0);
  transform-origin: bottom right;
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
}

[data-theme="dark"] .chat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.chat-box.active {
  transform: scale(1);
  opacity: 1;
  visibility: visible;
}

.chat-header {
  background: var(--gradient-primary);
  color: white;
  padding: 1rem;
  border-radius: 15px 15px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[data-theme="dark"] .chat-header {
  background: var(--gradient-secondary);
  color: var(--text-primary);
}

.chat-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: white;
}

[data-theme="dark"] .chat-header h3 {
  color: var(--text-primary);
}

.chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

[data-theme="dark"] .chat-close {
  color: var(--text-primary);
}

.chat-content {
  padding: 1rem;
}

.chat-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-option {
  background: var(--bg-secondary);
  border: none;
  padding: 1rem;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s ease;
  color: var(--text-primary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px; /* Mínimo táctil para móviles */
  touch-action: manipulation; /* Mejora respuesta táctil */
}

[data-theme="dark"] .chat-option {
  background: var(--bg-dark);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.chat-option:hover,
.chat-option:active {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

[data-theme="dark"] .chat-option:hover,
[data-theme="dark"] .chat-option:active {
  background: var(--accent-color);
  color: var(--bg-primary);
}

/* Estilos para el chat del asistente */
.chat-assistant {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 400px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 10px;
  margin-bottom: 1rem;
  max-height: 300px;
}

[data-theme="dark"] .chat-messages {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
}

.message {
  margin-bottom: 1rem;
  animation: fadeInUp 0.3s ease;
}

.message-content {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 15px;
  max-width: 85%;
  word-wrap: break-word;
}

.bot-message .message-content {
  background: var(--primary-color);
  color: white;
  margin-right: auto;
}

.user-message .message-content {
  background: var(--accent-color);
  color: var(--text-primary);
  margin-left: auto;
  flex-direction: row-reverse;
}

[data-theme="dark"] .user-message .message-content {
  background: var(--light-gray);
  color: var(--bg-primary);
}

.message-content i {
  font-size: 0.9rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.chat-input-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0;
}

#chat-input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 20px;
  outline: none;
  font-size: 0.9rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.3s ease;
}

#chat-input:focus {
  border-color: var(--primary-color);
}

[data-theme="dark"] #chat-input {
  background: var(--bg-dark);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.send-btn, .back-btn {
  padding: 0.75rem;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-btn {
  background: var(--primary-color);
  color: white;
}

.send-btn:hover {
  background: var(--dark-gray);
  transform: scale(1.05);
}

.send-btn:disabled {
  background: var(--light-gray);
  cursor: not-allowed;
  transform: none;
}

.back-btn {
  background: var(--secondary-color);
  color: white;
}

.back-btn:hover {
  background: var(--medium-gray);
  transform: scale(1.05);
}

/* Animación para mensajes nuevos */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Indicador de escritura */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--primary-color);
  color: white;
  border-radius: 15px;
  margin-right: auto;
  max-width: 85%;
}

.typing-dots {
  display: flex;
  gap: 0.2rem;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Footer */
footer {
  background: var(--text-primary);
  color: white;
  text-align: center;
  padding: 2rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .hero-text h1 {
    font-size: 2.5rem;
  }
  
  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .servicios-grid {
    grid-template-columns: 1fr;
  }
  
  .contact-options {
    grid-template-columns: 1fr;
  }
  
  .chat-widget {
    bottom: 1rem;
    right: 1rem;
  }
  
  .chat-box {
    width: 280px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }
  
  .navbar {
    padding: 1rem;
  }
  
  .section {
    padding: 3rem 0;
  }
  
  .hero-text h1 {
    font-size: 2rem;
  }
}

/* Segundo botón flotante para n8n */
.n8n-widget {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 1000;
}

.n8n-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-secondary);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-heavy);
  transition: all 0.3s ease;
  animation: pulseN8n 2s infinite;
}

[data-theme="dark"] .n8n-toggle {
  background: var(--gradient-primary);
  color: white;
}

.n8n-toggle:hover {
  transform: scale(1.1);
}

@keyframes pulseN8n {
  0% { box-shadow: var(--shadow-heavy); }
  50% { box-shadow: 0 0 0 10px rgba(107, 114, 128, 0.3); }
  100% { box-shadow: var(--shadow-heavy); }
}

/* Tercer botón flotante para Asistente AI Facturas */
.invoice-widget {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}

.invoice-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-heavy);
  transition: all 0.3s ease;
  animation: pulseInvoice 2s infinite;
}

[data-theme="dark"] .invoice-toggle {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.invoice-toggle:hover {
  transform: translateX(-50%) scale(1.1);
}

@keyframes pulseInvoice {
  0% { box-shadow: var(--shadow-heavy); }
  50% { box-shadow: 0 0 0 10px rgba(5, 150, 105, 0.3); }
  100% { box-shadow: var(--shadow-heavy); }
}

.invoice-box {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  box-shadow: var(--shadow-heavy);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.invoice-box.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-10px);
}

.invoice-header {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  padding: 1rem;
  border-radius: 15px 15px 0 0;
  display: flex;
  justify-content: between;
  align-items: center;
}

[data-theme="dark"] .invoice-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.invoice-header h3 {
  font-size: 1rem;
  margin: 0;
  flex: 1;
}

.invoice-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.invoice-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.invoice-content {
  padding: 1.5rem;
}

.invoice-content p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
}

.invoice-form-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

[data-theme="dark"] .invoice-form-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.invoice-form-btn:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(5, 150, 105, 0.3);
}

[data-theme="dark"] .invoice-form-btn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.invoice-info {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #059669;
}

.invoice-info h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.invoice-info ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.invoice-info li {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
  padding-left: 1rem;
  position: relative;
}

.invoice-info li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #059669;
  font-weight: bold;
}

.n8n-box {
  position: absolute;
  bottom: 80px;
  left: 0;
  width: 300px;
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow-heavy);
  transform: scale(0);
  transform-origin: bottom left;
  transition: all 0.3s ease;
}

[data-theme="dark"] .n8n-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.n8n-box.active {
  transform: scale(1);
}

/* Estilos específicos para el chat del asistente n8n */
.n8n-box .chat-assistant {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 400px;
  padding: 0;
}

.n8n-box .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: 10px;
  margin: 1rem 1rem 0.5rem 1rem;
  max-height: 280px;
  min-height: 200px;
}

[data-theme="dark"] .n8n-box .chat-messages {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
}

.n8n-box .chat-input-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 1rem 1rem 1rem;
  background: transparent;
}

.n8n-box #n8n-chat-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 25px;
  outline: none;
  font-size: 0.9rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.3s ease;
  min-width: 0; /* Para que se ajuste correctamente */
}

.n8n-box #n8n-chat-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(55, 65, 81, 0.1);
}

[data-theme="dark"] .n8n-box #n8n-chat-input {
  background: var(--bg-dark);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.n8n-box #n8n-chat-input::placeholder {
  color: var(--text-light);
  font-size: 0.85rem;
}

.n8n-box .send-btn,
.n8n-box .back-btn {
  padding: 0.75rem;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.n8n-box .send-btn {
  background: var(--primary-color);
  color: white;
}

.n8n-box .send-btn:hover:not(:disabled) {
  background: var(--dark-gray);
  transform: scale(1.05);
}

.n8n-box .send-btn:disabled {
  background: var(--light-gray);
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}

.n8n-box .back-btn {
  background: var(--secondary-color);
  color: white;
}

.n8n-box .back-btn:hover {
  background: var(--medium-gray);
  transform: scale(1.05);
}

/* Ajustar mensajes dentro del n8n-box */
.n8n-box .message {
  margin-bottom: 0.75rem;
  animation: fadeInUp 0.3s ease;
}

.n8n-box .message-content {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 15px;
  max-width: 90%;
  word-wrap: break-word;
  font-size: 0.9rem;
  line-height: 1.4;
}

.n8n-box .bot-message .message-content {
  background: var(--primary-color);
  color: white;
  margin-right: auto;
}

.n8n-box .user-message .message-content {
  background: var(--accent-color);
  color: var(--text-primary);
  margin-left: auto;
  flex-direction: row-reverse;
}

[data-theme="dark"] .n8n-box .user-message .message-content {
  background: var(--light-gray);
  color: var(--bg-primary);
}

/* Indicador de escritura específico para n8n */
.n8n-box .typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--primary-color);
  color: white;
  border-radius: 15px;
  margin-right: auto;
  max-width: 85%;
  font-size: 0.9rem;
}

.n8n-header {
  background: var(--gradient-secondary);
  color: white;
  padding: 1rem;
  border-radius: 15px 15px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[data-theme="dark"] .n8n-header {
  background: var(--gradient-primary);
  color: var(--text-primary);
}

.n8n-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: white;
}

[data-theme="dark"] .n8n-header h3 {
  color: var(--text-primary);
  margin: 0;
}

.n8n-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

[data-theme="dark"] .n8n-close {
  color: var(--text-primary);
}

.n8n-content {
  padding: 1rem;
  color: var(--text-primary);
}

[data-theme="dark"] .n8n-content {
  color: var(--text-primary) !important;
}

/* Forzar todos los textos dentro del widget n8n a ser blancos en modo oscuro */
[data-theme="dark"] .n8n-box * {
  color: var(--text-primary) !important;
}

/* Excepto para los fondos hover que deben ser contrastantes */
[data-theme="dark"] .n8n-option:hover {
  background: var(--accent-color) !important;
  color: var(--bg-primary) !important;
}

.n8n-content p {
  margin: 0 0 1rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

[data-theme="dark"] .n8n-content p {
  color: var(--text-primary) !important;
}

.n8n-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.n8n-option {
  background: var(--bg-secondary);
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  color: var(--text-primary);
}

[data-theme="dark"] .n8n-option {
  background: var(--bg-dark) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color);
}

.n8n-option:hover {
  background: var(--medium-gray);
  color: white;
}

[data-theme="dark"] .n8n-option:hover {
  background: var(--accent-color) !important;
  color: var(--bg-primary) !important;
}

/* Responsive para botones flotantes */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 1rem;
    right: 1rem;
  }
  
  .n8n-widget {
    bottom: 1rem;
    left: 1rem;
  }
  
  .invoice-widget {
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .invoice-toggle:hover {
    transform: translateX(-50%) scale(1.1) !important;
  }
  
  .invoice-box {
    width: 280px;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .invoice-box.active {
    transform: translateX(-50%) translateY(-10px);
  }
  
  .n8n-box {
    width: 260px;
  }
}

/* Responsive styles for project image header */
@media (max-width: 768px) {
  .proyecto-image-header {
    padding: 1rem;
  }
  
  .project-title-image {
    max-width: 100%;
    margin-bottom: 1rem;
  }
  
  .btn-website {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
  }
  
  .proyecto-overlay {
    top: 0.5rem;
    right: 0.5rem;
  }
  
  .status-badge {
    padding: 0.3rem 0.8rem;
    font-size: 0.75rem;
  }
}

/* ========================================
   RESPONSIVE DESIGN COMPLETO
   ======================================== */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
  .container {
    padding: 0 1.5rem;
  }
  
  .hero h1 {
    font-size: 3rem;
  }
  
  .hero p {
    font-size: 1.1rem;
  }
  
  .servicios-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .workflows-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .habilidades-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .section {
    padding: 4rem 0;
  }
}

/* Móviles grandes (481px - 768px) */
@media (max-width: 768px) {
  /* Navegación */
  .navbar {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }
  
  .nav-links {
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
  }
  
  .nav-links a {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }
  
  .logo {
    font-size: 1.5rem;
    text-align: center;
  }
  
  /* Hero */
  .hero {
    padding: 3rem 0;
    text-align: center;
  }
  
  .hero h1 {
    font-size: 2.5rem;
    line-height: 1.2;
  }
  
  .hero p {
    font-size: 1rem;
    margin: 1rem 0 2rem 0;
  }
  
  .hero-buttons {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 280px;
    padding: 1rem 1.5rem;
    justify-content: center;
  }
  
  /* Secciones */
  .section {
    padding: 3rem 0;
  }
  
  .section h2 {
    font-size: 2rem;
  }
  
  .section-subtitle {
    font-size: 1rem;
  }
  
  /* Servicios */
  .servicios-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .servicio-card {
    padding: 1.5rem;
  }
  
  .servicio-card h3 {
    font-size: 1.3rem;
  }
  
  /* Portfolio */
  .portafolio-grid {
    grid-template-columns: 1fr;
  }
  
  .proyecto {
    margin-bottom: 2rem;
  }
  
  .proyecto-content {
    padding: 1.5rem;
  }
  
  .proyecto-content h3 {
    font-size: 1.4rem;
  }
  
  .tech-stack {
    gap: 0.3rem;
  }
  
  .tech-tag {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }
  
  .proyecto-metrics {
    flex-direction: column;
    gap: 1rem;
  }
  
  .metric-number {
    font-size: 1.5rem;
  }
  
  .proyecto-features {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  
  /* Proyecto imagen header */
  .proyecto-image-header {
    padding: 1rem;
  }
  
  .project-title-image {
    max-width: 100%;
    margin-bottom: 1rem;
  }
  
  .btn-website {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
  }
  
  /* Habilidades */
  .habilidades-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .habilidad {
    padding: 1rem;
  }
  
  .habilidad-icon {
    font-size: 2rem;
  }
  
  .habilidad h3 {
    font-size: 1rem;
  }
  
  .habilidad p {
    font-size: 0.8rem;
  }
  
  /* Workflows */
  .workflow-item {
    margin-bottom: 2rem;
  }
  
  .workflow-preview {
    height: 250px;
  }
  
  .workflow-info {
    padding: 1.5rem;
  }
  
  .workflow-info h3 {
    font-size: 1.3rem;
  }
  
  .workflow-stats {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  /* n8n Widget */
  .n8n-widget {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    width: auto;
  }
  
  .n8n-toggle {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  
  .n8n-box {
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
  }
  
  /* Chat */
  .chat-widget {
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
  }
  
  .chat-toggle {
    width: 60px;
    height: 60px;
    font-size: 1.4rem;
    z-index: 1001;
    position: relative;
  }
  
  .chat-box {
    width: calc(100vw - 2rem);
    max-width: 400px;
    height: 450px;
    right: 1rem;
    bottom: 80px;
    z-index: 1000;
    position: fixed;
  }
  
  .chat-box.active {
    display: block;
    opacity: 1;
    transform: scale(1);
    visibility: visible;
  }
  
  .chat-header h3 {
    font-size: 1rem;
  }
  
  .chat-content {
    padding: 1rem;
    height: calc(100% - 60px);
    overflow-y: auto;
  }
  
  .chat-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
  }
  
  .chat-option {
    width: 100%;
    padding: 1rem;
    font-size: 0.9rem;
    text-align: left;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
  }
  
  .chat-option:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
  }
  
  .chat-option i {
    margin-right: 0.5rem;
    font-size: 1rem;
  }
  
  /* Contacto */
  .contacto-content {
    flex-direction: column;
  }
  
  .contacto-info,
  .contacto-form {
    width: 100%;
  }
  
  .contacto-info {
    margin-bottom: 2rem;
  }
  
  /* Footer */
  .footer {
    padding: 2rem 0;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 2rem;
    text-align: center;
  }
  
  .footer-section h3 {
    font-size: 1.1rem;
  }
  
  .social-links {
    justify-content: center;
  }
}

/* Móviles pequeños (320px - 480px) */
@media (max-width: 480px) {
  /* Tipografía más pequeña */
  .hero h1 {
    font-size: 2rem;
    line-height: 1.1;
  }
  
  .section h2 {
    font-size: 1.8rem;
  }
  
  /* Navegación ultra compacta */
  .navbar {
    padding: 0.8rem;
  }
  
  .nav-links {
    gap: 0.5rem;
  }
  
  .nav-links a {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  
  .logo {
    font-size: 1.3rem;
  }
  
  /* Hero compacto */
  .hero {
    padding: 2rem 0;
  }
  
  .hero p {
    font-size: 0.9rem;
  }
  
  .btn {
    max-width: 100%;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Cards más compactas */
  .servicio-card {
    padding: 1rem;
  }
  
  .servicio-card h3 {
    font-size: 1.1rem;
  }
  
  .servicio-card p {
    font-size: 0.8rem;
  }
  
  /* Proyecto compacto */
  .proyecto-content {
    padding: 1rem;
  }
  
  .proyecto-content h3 {
    font-size: 1.2rem;
  }
  
  .proyecto-content p {
    font-size: 0.8rem;
  }
  
  /* Habilidades en una columna */
  .habilidades-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
  
  /* Chat más compacto */
  .chat-box {
    width: calc(100vw - 1rem);
    height: 350px;
    right: 0.5rem;
    bottom: 60px;
  }
  
  .chat-messages {
    height: calc(350px - 110px);
  }
  
  /* n8n widget compacto */
  .n8n-box {
    max-width: 300px;
  }
  
  /* Espaciado reducido */
  .section {
    padding: 2rem 0;
  }
  
  .container {
    padding: 0 1rem;
  }
  
  /* Overlay más pequeño */
  .proyecto-overlay {
    top: 0.5rem;
    right: 0.5rem;
  }
  
  .status-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
  }
  
  /* Footer compacto */
  .footer {
    padding: 1.5rem 0;
  }
  
  .footer-content {
    gap: 1.5rem;
  }
  
  .social-links a {
    padding: 0.5rem;
    font-size: 1rem;
  }
}

/* Extra pequeños (menos de 320px) */
@media (max-width: 320px) {
  .hero h1 {
    font-size: 1.8rem;
  }
  
  .section h2 {
    font-size: 1.6rem;
  }
  
  .logo {
    font-size: 1.1rem;
  }
  
  .nav-links a {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }
  
  .btn {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }
  
  .servicio-card,
  .proyecto-content {
    padding: 0.8rem;
  }
  
  .chat-box {
    height: 300px;
  }
  
  .chat-messages {
    height: calc(300px - 100px);
  }
}
