/* --- VARIABLES & RESET --- */
:root {
  --neon-cyan: #00f5d4;
  --neon-blue: #00d4ff;
  --cyber-purple: #8338ec;
  --matrix-green: #FFD700;
  --dark-space: #0a192f;
  --tech-grey: #2d3748;
  --glass-bg: rgba(13, 25, 43, 0.8);
  --transition-speed: 0.3s;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--dark-space);
  color: #fff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  overflow-x: hidden;
}

/* --- TIPOGRAFÍA & UTILIDADES --- */
.text-gradient {
  background: linear-gradient(45deg, var(--matrix-green), var(--cyber-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.neon-text {
  color: var(--matrix-green);
  text-shadow: 0 0 3px var(--neon-cyan);
}

/* Sobrescribir Bootstrap text-muted para el tema oscuro */
.text-muted {
  color: #ccc !important;
}

/* --- NAVBAR --- */
.nav-glass {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 245, 212, 0.1);
}

/* Estilos Toggler Personalizado */
.navbar-toggler {
  --neon-color: #0ff;
  border: 2px solid rgba(0, 255, 255, 0.3);
  padding: 0.5rem;
  transition: all var(--transition-speed);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(0, 255, 255, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='3' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  filter: drop-shadow(0 0 5px var(--neon-color));
}

.navbar-toggler:hover {
  border-color: rgba(0, 255, 255, 0.8);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

.navbar-toggler:focus {
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.4) !important;
}

/* --- HERO SECTION --- */
.hero {
  height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.9)), url('/IMG/3.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* --- CARDS (Skills & Projects) --- */
.skill-card, .certification-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--neon-cyan);
  border-radius: 15px;
  transition: all var(--transition-speed) ease;
  height: 100%; /* Asegura igualdad de altura en grid */
}

.skill-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 0 20px var(--neon-cyan);
}

/* Estilos específicos de Proyectos */
.project-card {
  background: rgba(13, 25, 43, 0.6);
  border: 1px solid var(--cyber-purple);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
}

.project-card:hover {
  transform: perspective(1000px) rotateX(2deg) rotateY(2deg) translateY(-10px);
  box-shadow: 0 0 30px rgba(131, 56, 236, 0.4);
}

.project-card img {
  width: 70%;             /* 70% del ancho disponible */
  margin: 0 auto 15px;    /* Centrado horizontalmente */
  border-radius: 10px;
}

.project-card:hover img {
  transform: scale(1.05);
}

/* Estilos Certificados */
.certification-badge {
  position: absolute;
  top: -15px;
  right: -15px;
  background: var(--neon-cyan);
  color: var(--dark-space);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* --- BOTONES --- */
.btn-neon-whatsapp {
  background: #25d366;
  border: 2px solid #25d366;
  color: white;
  transition: all var(--transition-speed) ease;
}

.btn-neon-whatsapp:hover {
  background: transparent;
  color: #25d366;
  box-shadow: 0 0 15px #25d366;
  transform: translateY(-2px);
}

.btn-outline-neon {
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  transition: all var(--transition-speed) ease;
}

.btn-outline-neon:hover {
  background: var(--neon-cyan);
  color: var(--dark-space);
  box-shadow: 0 0 15px var(--neon-cyan);
  transform: translateY(-2px);
}

.btn-outline-cyan {
  border: 2px solid var(--neon-blue);
  color: var(--neon-blue);
  transition: all var(--transition-speed) ease;
}

.btn-outline-cyan:hover {
  background: var(--neon-blue);
  color: var(--dark-space);
  transform: translateY(-2px);
}

.btn-certificado {
  background: linear-gradient(45deg, #6f42c1, #0dcaf0);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 25px;
  transition: transform var(--transition-speed) ease;
  display: inline-flex;
  align-items: center;
}

.btn-certificado:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(13, 202, 240, 0.4);
}

/* --- SECCIÓN SOBRE MÍ --- */
.profile-img {
  max-width: 70%;
  height: auto;
  border-radius: 10% !important; /* Más estético circular */
  border: 3px solid var(--neon-cyan) !important;
  display: block;
  margin: auto;
}

.stats-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  transition: transform var(--transition-speed) ease;
}

.stats-box:hover {
  transform: translateY(-5px);
  background: linear-gradient(45deg, var(--dark-space), var(--tech-grey));
}

/* --- STACK TECNOLÓGICO (Iconos) --- */
.text-orange { color: #E34F26 !important; }
.text-blue { color: #1572B6 !important; }
.text-yellow { color: #F7DF1E !important; }
.text-purple { color: #7952B3 !important; }
.text-cyan { color: #61DAFB !important; }
.text-sass { color: #E4405F !important; }

.skill-card li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.skill-card li i {
  transition: transform 0.3s ease, filter 0.3s ease;
}

.skill-card li:hover i {
  transform: scale(1.15);
  filter: drop-shadow(0 0 5px currentColor); /* Hace que el icono brille con su color */
}

/* --- SOCIAL ICONS --- */
.social-links a {
  text-decoration: none !important;
  margin: 0 10px;
  display: inline-block;
}

.social-icon {
  transition: all var(--transition-speed) ease;
  padding: 8px;
}

.social-icon:hover {
  transform: translateY(-3px) scale(1.1);
}

.github-icon { color: #c0c0c0 !important; }
.linkedin-icon { color: #fff !important; }
.facebook-icon { color: #1877F2 !important; }
.youtube-icon { color: #FF0000 !important; }

/* Animación Corazón */
.heartbeat {
  color: #285AEB;
  animation: heartbeat 1.5s ease-in-out infinite both;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}

/* --- CHATBOT --- */
.bot-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(145deg, #22c55e, #16a34a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  z-index: 10000;
  animation: floatBot 3s ease-in-out infinite;
}

.bot-button:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.bot-button img {
  width: 36px;
  height: 36px;
  filter: brightness(0) invert(1);
}

.wa-bot-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 16px;
  display: none; /* Hidden by default */
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: fadeUp 0.3s ease forwards;
  width: 300px; /* Ancho fijo para mejor control */
}

.bot-buttons {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bot-btn {
  background: rgba(255, 255, 255, 0.9);
  color: #128C7E;
  border: none;
  padding: 12px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  width: 100%;
}

.bot-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  background: #fff;
}

.direct-btn {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: #fff;
}

.close-btn {
  background: rgba(255, 0, 0, 0.1);
  color: #ff4d4d;
  margin-top: 5px;
}

.welcome-message {
  background: rgba(255, 255, 255, 0.85);
  padding: 12px;
  border-radius: 14px;
  text-align: center;
  color: #421bd1;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  animation: fadeInWelcome 0.5s ease;
}

.welcome-message span {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

/* --- MODAL DE CERTIFICADOS --- */
.certificado-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  padding-top: 100px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
}

.modal-content {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 800px;
  border: 3px solid #0dcaf0;
  border-radius: 10px;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #0dcaf0;
  font-size: 40px;
  cursor: pointer;
}

/* --- FOOTER --- */
footer {
  border-top: 1px solid rgba(0, 245, 212, 0.1);
  background: rgba(13, 25, 43, 0.9);
}

/* --- ANIMACIONES KEYFRAMES --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatBot {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes fadeInWelcome {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- MEDIA QUERIES (RESPONSIVE) --- */
@media (max-width: 1200px) {
  .project-card { padding: 16px; }
  .project-card h3 { font-size: 1.1rem; }
  .project-card p { font-size: 0.85rem; }
}

@media (max-width: 768px) {
  .project-card { padding: 12px; }
  .project-card h3 { font-size: 1rem; }
  .project-card p { font-size: 0.8rem; }
  
  .social-links a { margin: 0 8px; }
  .social-icon i { font-size: 1.2rem; }
  
  .wa-bot-panel {
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* CHATBOT WIDGET MODERNO */

  /* Estilos del Widget */
  .chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', sans-serif;
  }

  /* Botón de Abrir */
  .chat-launcher {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 114, 255, 0.4);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: pulse 2s infinite;
  }
  .chat-launcher:hover {
    transform: scale(1.1);
  }
  .chat-launcher svg {
    width: 30px;
    height: 30px;
    fill: white;
  }

  /* Ventana del Chat */
  .chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(15, 23, 42, 0.95); /* Slate 900 */
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8) translateY(20px);
  }

  .chat-window.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1) translateY(0);
  }

  /* Header */
  .chat-header {
    background: linear-gradient(135deg, #0072ff, #00c6ff);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .chat-header h4 {
    margin: 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
  }
  .chat-header span {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
  }
  .close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
  }

  /* Cuerpo del Chat */
  .chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .chat-body::-webkit-scrollbar { width: 4px; }
  .chat-body::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

  /* Burbujas de Mensaje */
  .message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    animation: slideUp 0.3s ease-out forwards;
  }
  .message.bot {
    background: #1e293b; /* Slate 800 */
    color: #e2e8f0;
    border-bottom-left-radius: 2px;
    align-self: flex-start;
    border: 1px solid #334155;
  }
  .message.user {
    background: linear-gradient(135deg, #0072ff, #00c6ff);
    color: white;
    border-bottom-right-radius: 2px;
    align-self: flex-end;
  }

  /* Area de Opciones/Input */
  .chat-controls {
    padding: 15px;
    border-top: 1px solid #334155;
    background: #0f172a;
  }

  /* Botones de Opción */
  .option-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .option-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
  }
  .option-btn:hover {
    background: #334155;
    border-color: #00c6ff;
  }

  /* Input de Texto */
  .text-input {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
    color: white;
    outline: none;
    box-sizing: border-box; /* Fix padding issue */
  }
  .text-input:focus {
    border-color: #00c6ff;
  }

  /* Indicador Escribiendo */
  .typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
    margin: 0 2px;
  }
  .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
  .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

  @keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 114, 255, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(0, 114, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 114, 255, 0); }
  }
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
  }

  /* --- OPTIMIZACIÓN MÓVIL: MODO PANTALLA COMPLETA --- */

/* Estilos base para el contenedor del chat (puede que ya los tengas, revisa que coincidan los IDs) */
#chatWindow {
  display: none; /* Oculto por defecto */
  flex-direction: column;
  position: fixed;
  z-index: 9999;
  background-color: #ffffff;
  box-shadow: 0 5px 40px rgba(0,0,0,0.16);
  transition: all 0.3s ease;
  
  /* Estilos por defecto (Escritorio - Widget flotante) */
  bottom: 90px; /* Espacio para el botón de abrir */
  right: 20px;
  width: 380px;
  height: 600px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

/* Clase activa para mostrar el chat */
#chatWindow.active {
  display: flex;
}

/* ==========================================
   RESPONSIVE: DISPOSITIVOS MÓVILES
   ========================================== */
/* ==========================================
   RESPONSIVE: DISPOSITIVOS MÓVILES (CORREGIDO)
   ========================================== */
@media screen and (max-width: 768px) {
  
  /* 1. Contenedor Principal: Forzamos fondo y pantalla completa */
  #chatWindow {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important; /* Altura dinámica para móviles */
    
    /* --- SOLUCIÓN AL FONDO --- */
    background-color: #ffffff !important; /* Asegura que el fondo sea blanco sólido */
    
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    z-index: 99999 !important; /* Asegura que esté por encima de todo */
  }

  /* 2. Área de Mensajes: Fondo ligero para diferenciar del input */
  #chatBody {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: #f9f9f9; /* Un gris muy suave para descansar la vista */
    padding: 15px;
    padding-bottom: 20px;
  }

  /* 3. Área de Controles (Input): Fondo blanco sólido */
  #chatControls {
    position: sticky;
    bottom: 0;
    background-color: #ffffff !important; /* Fondo blanco para la zona de input */
    padding: 15px;
    border-top: 1px solid #e0e0e0; /* Línea separadora */
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05); /* Sombra suave hacia arriba */
  }

  /* 4. Botones más grandes y fáciles de tocar */
  .option-btn {
    padding: 15px 20px;
    font-size: 16px;
    margin: 5px 0;
    border-radius: 12px;
    width: 100%;
    cursor: pointer;
    background-color: #007bff; /* Color azul estándar (cámbialo si usas otro color) */
    color: #fff;
    border: none;
  }
  
  /* Efecto al tocar el botón en móvil */
  .option-btn:active {
    opacity: 0.8;
    transform: scale(0.98);
  }

  /* 5. Estilos de los mensajes */
  .message {
    max-width: 90%;
    padding: 12px 16px;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 10px;
    position: relative;
  }

  .message.bot {
    background-color: #ffffff; /* Fondo blanco para burbuja del bot */
    color: #333;
    border-radius: 0 18px 18px 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  }

  .message.user {
    background-color: #007bff; /* Fondo azul para usuario */
    color: #fff;
    border-radius: 18px 0 18px 18px;
    margin-left: auto;
  }

  /* 6. Input de texto */
  .text-input {
    width: 100%;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 16px; /* Evita zoom automático en iOS */
    box-sizing: border-box;
    background-color: #fff;
    color: #333;
  }
}

/* Estilos extra para los inputs en móvil (Evitar zoom automático en iOS) */
.text-input {
  width: 100%;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 10px;
  outline: none;
  font-size: 16px; /* Importante: 16px previene el zoom automático en Safari/iOS */
  box-sizing: border-box;
}