/* ========================================================
   VARIABLES Y SISTEMA DE DISEÑO (DARK / LIGHT)
======================================================== */
:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Acentos y Paleta */
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-glow: rgba(56, 189, 248, 0.28);
  --secondary: #818cf8;
  --secondary-glow: rgba(129, 140, 248, 0.22);
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.2);
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* TEMA OSCURO */
[data-theme="dark"] {
  --bg-body: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.72);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-alt: #070a12;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.45);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --nav-bg: rgba(11, 15, 25, 0.82);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.55);
  --glass: rgba(255, 255, 255, 0.035);
  --card-glow: rgba(56, 189, 248, 0.04);
}

/* TEMA CLARO */
[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --bg-alt: #f1f5f9;
  --border: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(14, 165, 233, 0.45);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --nav-bg: rgba(248, 250, 252, 0.88);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
  --glass: rgba(0, 0, 0, 0.02);
  --card-glow: rgba(14, 165, 233, 0.03);
}

/* ========================================================
   RESETEO BÁSICO Y BASE
======================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 2;
}

/* ========================================================
   EFECTOS AMBIENTALES Y LUCES DE FONDO (ADVANCED)
======================================================== */
.cursor-spotlight {
  position: fixed;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 65%);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 1;
  opacity: 0.7;
  filter: blur(25px);
  will-change: left, top;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.ambient-1 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  top: -100px;
  right: -50px;
}

.ambient-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--secondary-glow) 0%, transparent 70%);
  top: 45%;
  left: -150px;
  animation-duration: 24s;
  animation-delay: -5s;
}

.ambient-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  bottom: -50px;
  right: 10%;
  animation-duration: 20s;
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% { transform: translate(0px, 0px) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, 45px) scale(0.95); }
}

/* ========================================================
   ANIMACIONES DE ENTRADA SCROLL REVEAL (INTERSECTION OBSERVER)
======================================================== */
.reveal-up {
  opacity: 0;
  transform: translateY(35px);
  filter: blur(4px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.8s ease;
  will-change: opacity, transform, filter;
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92) translateY(20px);
  filter: blur(4px);
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.85s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.85s ease;
  will-change: opacity, transform, filter;
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  filter: blur(4px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.8s ease;
  will-change: opacity, transform, filter;
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  filter: blur(4px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.8s ease;
  will-change: opacity, transform, filter;
}

.reveal-up.is-visible,
.reveal-scale.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible {
  opacity: 1;
  transform: translate(0, 0) scale(1);
  filter: blur(0);
}

/* Stagger para listas de cartas */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================================
   KEYFRAMES COMUNES
======================================================== */
@keyframes pulseGreen {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseCyan {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(56, 189, 248, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes borderBeam {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

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

/* ========================================================
   TIPOGRAFÍA Y DECORACIONES
======================================================== */
.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-line {
  width: 50px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  margin: 0.75rem auto 0 auto;
  border-radius: 2px;
}

.section {
  padding: 5.5rem 0;
  position: relative;
  z-index: 2;
}

.bg-alt {
  background-color: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ========================================================
   NAVBAR
======================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  transition: var(--transition);
}

.nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 2px;
}

.logo-bracket {
  color: var(--primary);
  font-family: var(--font-mono);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.8rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0%;
  height: 2px;
  background: var(--primary);
  transition: width 0.25s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-mobile-actions {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  margin-top: 0.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.btn-hero-danibot {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px var(--primary-glow);
  font-weight: 700;
}

.btn-hero-danibot:hover {
  box-shadow: 0 6px 22px var(--primary-glow);
  transform: translateY(-2px);
}

.btn-icon {
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.05);
}

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

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.mobile-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: var(--transition);
}

/* ========================================================
   BOTONES Y ELEMENTOS MAGNÉTICOS
======================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.magnetic-btn {
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.25s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #041019;
  box-shadow: 0 4px 14px 0 var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 var(--primary-glow);
}

.btn-secondary {
  background: var(--glass);
  border-color: var(--border);
  color: var(--text-main);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--text-main);
  color: var(--text-main);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

/* ========================================================
   BADGES & ETIQUETAS
======================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.badge-opentowork {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-location {
  background: var(--glass);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-status {
  background: rgba(56, 189, 248, 0.1);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.badge-dot-live {
  width: 7px;
  height: 7px;
  background-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
  animation: pulseCyan 1.8s infinite;
}

.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulsing-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 1.8s infinite;
}

/* ========================================================
   HERO SECTION & CANVAS INTERACTIVO
======================================================== */
.hero {
  padding: 6.5rem 0 4.5rem 0;
  position: relative;
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.65;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  align-items: center;
  gap: 3.5rem;
  position: relative;
  z-index: 2;
}

.hero-badges {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 0.6rem;
  color: var(--text-main);
}

.typewriter-container {
  min-height: 2.2rem;
  margin-bottom: 1.2rem;
}

.hero-subtitle {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
}

.typewriter-cursor {
  display: inline-block;
  margin-left: 2px;
  color: var(--primary);
  font-weight: 300;
  animation: blinkCursor 0.8s infinite;
}

.hero-description {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 580px;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 2.5rem;
}

/* Contadores Rápidos */
.quick-highlights {
  display: flex;
  align-items: center;
  gap: 1.8rem;
  border-top: 1px solid var(--border);
  padding-top: 1.8rem;
}

.quick-item {
  display: flex;
  flex-direction: column;
}

.quick-number {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.quick-label {
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-divider {
  width: 1px;
  height: 35px;
  background: var(--border);
}

/* ========================================================
   TARJETA 3D INTERACTIVA (HERO TILT CARD)
======================================================== */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out, box-shadow 0.25s ease;
  position: relative;
}

.profile-card-glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* Haz de luz de borde animado */
.card-border-beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(90deg, transparent 0%, var(--primary) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: borderBeam 4s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.avatar-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto 1.4rem auto;
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  font-family: var(--font-mono);
}

.avatar-ring-opentowork {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 2px dashed #10b981;
  animation: spin 20s linear infinite;
  pointer-events: none;
}

.card-name {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.card-role {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 1.2rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.card-tag {
  background: var(--glass);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.card-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dot-green {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
}

/* ========================================================
   SOBRE MÍ
======================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.5rem;
  align-items: start;
}

.about-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2.2rem;
  box-shadow: var(--shadow);
}

.about-card .lead-text {
  font-size: 1.15rem;
  color: var(--text-main);
  margin-bottom: 1.2rem;
  line-height: 1.7;
}

.about-card p {
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  line-height: 1.7;
}

.about-card p:last-child {
  margin-bottom: 0;
}

.about-features {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.feature-box {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  transition: var(--transition);
}

.feature-box:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 0.8rem;
}

.feature-box h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.feature-box p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ========================================================
   HABILIDADES / STACK
======================================================== */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2.5rem;
}

.filter-btn {
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.55rem 1.2rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  color: var(--text-main);
  border-color: var(--border-focus);
}

.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #041019;
  font-weight: 700;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
}

.skill-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  transition: var(--transition);
}

.skill-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.35);
}

.skill-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.skill-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
}

.skill-badge {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.skill-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ========================================================
   TIMELINE DE EDUCACIÓN
======================================================== */
.timeline {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-left: 55px;
  margin-bottom: 2.5rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: 13px;
  top: 24px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-body);
  border: 3px solid var(--primary);
  z-index: 2;
}

.timeline-dot.pulsing-border {
  border-color: #10b981;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.timeline-content {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.timeline-content:hover {
  border-color: var(--border-focus);
}

.timeline-content.card-highlight {
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.05) 0%, var(--bg-card) 100%);
}

.timeline-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.5rem 0 0.2rem 0;
}

.timeline-subtitle {
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 0.8rem;
}

.timeline-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.2rem;
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.timeline-tags .tag {
  background: var(--glass);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.timeline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}

.link-chip {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.link-chip:hover {
  transform: translateX(2px);
  color: var(--primary-hover);
}

/* ========================================================
   PROYECTOS / SHOWCASE (GRIDS UNIFORMES Y COMPACTOS)
======================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}

@media (max-width: 992px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 295px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.project-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-focus);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
}

.project-card-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.project-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.project-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.project-type-pill {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

.project-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  line-height: 1.35;
  color: var(--text-main);
}

.project-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex-grow: 1;
  margin-bottom: 0.85rem;
}

.project-featured {
  border-color: rgba(56, 189, 248, 0.45);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.06) 0%, var(--bg-card) 100%);
}

.project-card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.project-tag {
  background: var(--glass);
  border: 1px solid var(--border);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--primary);
}

.project-demo-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 34px;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.project-code-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  color: var(--text-light);
}

/* ========================================================
   MODAL DE DEMOSTRACIÓN JUGABLE & SMARTPHONE MOCKUP
======================================================== */
.game-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-modal-backdrop.is-active {
  display: flex;
  opacity: 1;
}

.game-modal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  max-height: 94vh;
  background: #090e1a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.6rem;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95), 0 0 30px rgba(56, 189, 248, 0.18);
  color: #ffffff !important;
}

.game-modal-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.game-modal-title-wrap .badge-status {
  background: rgba(56, 189, 248, 0.2) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.4) !important;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
}

.game-modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff !important;
  margin-top: 0.35rem;
  letter-spacing: -0.2px;
}

.game-modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-modal-actions .btn-outline {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
}

.game-modal-actions .btn-outline:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
}

.game-modal-actions .btn-icon {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  width: 34px;
  height: 34px;
}

.game-modal-actions .btn-icon:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

.phone-frame-wrapper {
  perspective: 1000px;
  display: flex;
  justify-content: center;
  margin: 0.2rem 0;
}

.phone-bezel {
  width: 350px;
  height: 620px;
  max-height: 68vh;
  aspect-ratio: 9 / 19.5;
  background: #000000;
  border: 10px solid #1e293b;
  border-radius: 42px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.phone-notch {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 16px;
  background: #0b0f19;
  border-radius: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.phone-camera {
  width: 6px;
  height: 6px;
  background: #1e293b;
  border-radius: 50%;
  border: 1px solid #334155;
}

.phone-speaker {
  width: 28px;
  height: 3px;
  background: #334155;
  border-radius: 3px;
}

.phone-screen {
  width: 100%;
  height: 100%;
  border: none;
  background: #000000;
  display: block;
}

.game-modal-footer {
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  color: #cbd5e1 !important;
  text-align: center;
  line-height: 1.45;
}

.game-modal-footer p {
  color: #cbd5e1 !important;
  margin: 0;
}

.game-modal-footer strong {
  color: #38bdf8 !important;
  font-weight: 700;
}

/* ========================================================
   CONTACTO
======================================================== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.contact-info-card, .contact-form-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2.2rem;
  box-shadow: var(--shadow);
}

.contact-info-card h3, .contact-form-card h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.contact-info-card p {
  color: var(--text-muted);
  margin-bottom: 1.8rem;
  line-height: 1.6;
}

.contact-links-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.contact-item:hover {
  border-color: var(--border-focus);
  transform: translateX(4px);
}

.contact-item.copyable {
  cursor: pointer;
}

.contact-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.linkedin-bg { background: rgba(10, 102, 194, 0.18); color: #0a66c2; }
.email-bg { background: rgba(56, 189, 248, 0.18); color: var(--primary); }
.location-bg { background: rgba(16, 185, 129, 0.18); color: #10b981; }

.contact-text {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.contact-label {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
}

.contact-val {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.copy-badge {
  font-size: 0.72rem;
  background: var(--glass);
  border: 1px solid var(--border);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--text-muted);
  transition: var(--transition);
}

/* Formulario */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-feedback {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: none;
}

.form-feedback.success {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #10b981;
}

.form-feedback.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* ========================================================
   FOOTER
======================================================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  text-align: center;
  position: relative;
  z-index: 2;
}

.footer-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-sub {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.3rem;
}

/* ========================================================
   RESPONSIVE DESIGN (MÓVIL / TABLET)
======================================================== */
@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2.5rem;
  }

  .hero-description {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-badges, .hero-cta, .quick-highlights {
    justify-content: center;
  }

  .about-grid, .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0.65rem 0;
  }

  .nav-content {
    gap: 8px;
  }

  .logo {
    font-size: 1.05rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .nav-actions {
    gap: 6px;
  }

  /* Ocultar botón de imprimir en el header en móvil (disponible dentro del menú desplegable) */
  .btn-print-cv {
    display: none !important;
  }

  .nav-mobile-actions {
    display: flex;
  }

  .hero {
    padding: 3.2rem 0 2rem 0;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .hero-badges {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
  }

  .badge {
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
  }

  .hero-title {
    font-size: clamp(1.85rem, 6.8vw, 2.3rem);
    line-height: 1.2;
    margin-bottom: 0.45rem;
    text-align: center;
  }

  .typewriter-container {
    min-height: 2rem;
    margin-bottom: 0.85rem;
    display: flex;
    justify-content: center;
  }

  .hero-subtitle {
    font-size: 1.05rem;
    text-align: center;
  }

  .hero-description {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-align: center;
    padding: 0 4px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 2rem;
  }

  .hero-cta .btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1.2rem;
  }

  .quick-highlights {
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    padding-top: 1.3rem;
  }

  .quick-divider {
    display: none;
  }

  .quick-item {
    align-items: center;
    min-width: 85px;
  }

  .quick-number {
    font-size: 1.5rem;
  }

  .quick-label {
    font-size: 0.72rem;
    text-align: center;
    max-width: 100px;
  }

  .hero-visual {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .profile-card-glass {
    max-width: 310px;
    width: 100%;
    margin: 0 auto;
  }

  .cursor-spotlight {
    display: none !important;
  }

  .mobile-toggle {
    display: flex;
    padding: 6px;
  }

  .nav-links {
    position: fixed;
    top: 57px;
    left: 0;
    right: 0;
    background: var(--bg-body);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1.2rem 1.5rem;
    gap: 1rem;
    display: none;
    box-shadow: var(--shadow);
    z-index: 1001;
  }

  .nav-links.active {
    display: flex;
  }

  .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    padding: 0.25rem 0.5rem 0.85rem;
    margin-bottom: 1.8rem;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .filter-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .phone-bezel {
    max-width: min(350px, calc(100vw - 36px));
    border-width: 8px;
    border-radius: 36px;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 3rem 0;
  }

  .hero-title {
    font-size: clamp(1.65rem, 7.5vw, 1.95rem);
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.6rem;
  }

  .skill-card {
    padding: 0.8rem 0.85rem;
  }

  .skill-name {
    font-size: 0.82rem;
  }

  .about-highlights {
    grid-template-columns: repeat(auto-fit, minmax(85px, 1fr));
    gap: 0.6rem;
  }

  .highlight-number {
    font-size: 1.5rem;
  }

  .highlight-label {
    font-size: 0.72rem;
  }

  .project-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .project-footer .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 380px) {
  .logo-name {
    display: inline-block;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
}

/* ========================================================
   ESTILOS DE IMPRESIÓN (ATS & CLEAN CV PRINT)
======================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 10pt;
  }

  .print-hide, .navbar, .footer, .btn, .filter-tabs, .contact-form-card,
  .cursor-spotlight, .ambient-glow, .hero-canvas, .card-border-beam {
    display: none !important;
  }

  .section {
    padding: 1.5rem 0 !important;
  }

  .bg-alt {
    background: transparent !important;
    border: none !important;
  }

  .about-card, .timeline-content, .contact-info-card, .project-card, .profile-card-glass {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    backdrop-filter: none !important;
  }

  .hero-title {
    color: #0f172a !important;
    font-size: 20pt !important;
  }

  .timeline::before {
    background: #cbd5e1 !important;
  }
}

/* ========================================================
   WIDGET DEL ASISTENTE VIRTUAL IA (DANIBOT)
======================================================== */
.danibot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  font-family: var(--font-main);
}

.danibot-launcher-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  position: relative;
}

/* Tooltip / Burbuja de sugerencia */
.danibot-tooltip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: danibotFloat 3.5s ease-in-out infinite alternate;
  white-space: nowrap;
  pointer-events: auto;
}

@keyframes danibotFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

.danibot-tooltip-close {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.2s;
}

.danibot-tooltip-close:hover {
  color: var(--text-main);
}

/* Botón flotante */
.danibot-toggle-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  box-shadow: 0 10px 25px -5px var(--primary-glow), 0 0 20px rgba(56, 189, 248, 0.25);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.danibot-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 30px -4px var(--primary-glow), 0 0 28px rgba(56, 189, 248, 0.4);
}

.danibot-pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0.6;
  animation: danibotPulse 2.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
  pointer-events: none;
}

@keyframes danibotPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.15; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.danibot-icon-chat,
.danibot-icon-close {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.danibot-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.7);
}

.danibot-widget.is-open .danibot-icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.7);
}

.danibot-widget.is-open .danibot-icon-close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.danibot-widget.is-open .danibot-tooltip {
  display: none !important;
}

.danibot-widget.is-open .danibot-pulse-ring {
  display: none;
}

/* Ventana de Chat */
.danibot-window {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow), 0 20px 45px -10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.danibot-widget.is-open .danibot-window {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header del Chat */
.danibot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
}

.danibot-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.danibot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(129, 140, 248, 0.2));
  border: 1px solid var(--border-focus);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.danibot-online-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 6px var(--accent-glow);
}

.danibot-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.danibot-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
}

.danibot-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.danibot-status-desc {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-light);
}

.danibot-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Preguntas Sugeridas / Chips */
.danibot-suggestions {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.04);
}

.danibot-suggestions::-webkit-scrollbar {
  display: none;
}

.danibot-chip {
  flex-shrink: 0;
  padding: 5px 11px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 20px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.danibot-chip:hover {
  background: rgba(56, 189, 248, 0.12);
  color: var(--text-main);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Mensajes */
.danibot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.danibot-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: danibotMsgIn 0.25s ease-out forwards;
}

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

.danibot-msg-user {
  align-self: flex-end;
}

.danibot-msg-user .danibot-msg-bubble {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  box-shadow: 0 4px 12px var(--primary-glow);
  word-break: break-word;
}

.danibot-msg-bot {
  align-self: flex-start;
}

.danibot-msg-bot .danibot-msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 16px 16px 16px 4px;
  padding: 11px 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-word;
}

.danibot-msg-bot .danibot-msg-bubble p {
  margin: 0 0 6px 0;
}

.danibot-msg-bot .danibot-msg-bubble p:last-child {
  margin-bottom: 0;
}

.danibot-msg-bot .danibot-msg-bubble ul,
.danibot-msg-bot .danibot-msg-bubble ol {
  margin: 6px 0;
  padding-left: 18px;
}

.danibot-msg-bot .danibot-msg-bubble li {
  margin-bottom: 4px;
}

.danibot-msg-bot .danibot-msg-bubble a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.danibot-msg-time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-light);
  margin-top: 4px;
  padding: 0 4px;
}

.danibot-msg-user .danibot-msg-time {
  align-self: flex-end;
}

/* Indicador de escritura (Typing Dots) */
.danibot-typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px !important;
}

.danibot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.4;
  animation: danibotBounce 1.2s infinite ease-in-out;
}

.danibot-dot:nth-child(2) { animation-delay: 0.2s; }
.danibot-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes danibotBounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.3; }
  40% { transform: scale(1.3); opacity: 1; }
}

/* Input Form */
.danibot-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--glass);
}

.danibot-input {
  flex: 1;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.84rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: var(--font-main);
}

.danibot-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.danibot-input::placeholder {
  color: var(--text-light);
  font-size: 0.82rem;
}

.danibot-send-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  border: none;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.danibot-send-btn:not(:disabled):hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px var(--primary-glow);
}

.danibot-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Bloqueo de scroll de la página en móvil cuando DaniBot está abierto */
body.danibot-open {
  overflow: hidden !important;
  touch-action: none;
}

/* Responsividad Móvil DaniBot */
@media (max-width: 768px) {
  .danibot-widget {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 8px));
    right: calc(16px + env(safe-area-inset-right, 8px));
    z-index: 9990;
  }

  .danibot-toggle-btn {
    width: 48px;
    height: 48px;
    box-shadow: 0 4px 16px rgba(14, 165, 233, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .danibot-toggle-btn svg {
    width: 22px;
    height: 22px;
  }

  .danibot-pulse-ring {
    display: none !important;
  }

  .danibot-tooltip {
    display: none !important;
  }

  .danibot-widget.is-open {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 99999;
    bottom: 0;
    right: 0;
  }

  .danibot-widget.is-open .danibot-launcher-wrap {
    display: none;
  }

  .danibot-window {
    position: fixed;
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    bottom: 0;
    right: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
  }

  .danibot-header {
    padding: max(14px, env(safe-area-inset-top, 14px)) 16px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
  }

  .danibot-header-actions .btn-icon {
    width: 36px;
    height: 36px;
  }

  .danibot-messages {
    padding: 14px;
    gap: 12px;
  }

  .danibot-msg {
    max-width: 92%;
  }

  .danibot-input-form {
    padding: 10px 14px max(14px, env(safe-area-inset-bottom, 14px));
    background: var(--bg-card);
  }

  .danibot-input {
    font-size: 16px; /* Evita que iOS Safari haga zoom automático al enfocar */
    padding: 10px 14px;
  }

  .danibot-send-btn {
    width: 42px;
    height: 42px;
  }

  .danibot-tooltip {
    display: none !important;
  }
}
