/* =========================================
VARIABLES GLOBALES
========================================= */
:root {
--bg-dark: #050505;
--bg-card: #0f1115;
--bg-glass: rgba(15, 17, 21, 0.7);

--primary-cyan: #00f2ff;
--primary-green: #29ffbf;

--text-main: #ffffff;
--text-muted: #9ca3af;

--accent-gradient: linear-gradient(135deg, var(--primary-cyan), var(--primary-green));

/* Variables compatibles para el chat */
--vertex-cyan: var(--primary-cyan);
--vertex-blue: #0088ff;
--vertex-dark: var(--bg-card);
--vertex-border: rgba(255, 255, 255, 0.05);
--vertex-text: var(--text-main);
--vertex-muted: var(--text-muted);

--glass: rgba(255, 255, 255, 0.03);
--transition: all 0.3s ease;
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}

html {
scroll-behavior: smooth;
}

body {
font-family: 'Inter', sans-serif;
background: var(--bg-dark);
color: var(--text-main);
overflow-x: hidden; /* Previene scroll horizontal accidental */
line-height: 1.6;
position: relative;
width: 100%;
}

/* =========================================
UTILIDADES VISUALES
========================================= */
.bg-grid {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
linear-gradient(var(--glass) 1px, transparent 1px),
linear-gradient(90deg, var(--glass) 1px, transparent 1px);
background-size: 50px 50px;
z-index: -2;
}

.badge {
display: inline-block;
background: rgba(0, 242, 255, 0.1);
color: var(--primary-cyan);
padding: 6px 18px;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 700;
border: 1px solid var(--primary-cyan);
margin-bottom: 1.5rem;
letter-spacing: 1px;
}

/* Toast Notifications */
#toast-container {
position: fixed;
top: 20px;
right: 20px;
z-index: 10000;
display: flex;
flex-direction: column;
gap: 10px;
pointer-events: none; /* Allows clicking through if empty */
}

.toast {
background: rgba(15, 17, 21, 0.95);
backdrop-filter: blur(10px);
border-left: 4px solid var(--primary-cyan);
color: white;
padding: 15px 25px;
border-radius: 4px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
transform: translateX(120%);
transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
font-size: 0.9rem;
pointer-events: auto;
}

.toast.show {
transform: translateX(0);
}

.toast.success {
border-color: var(--primary-green);
}

/* =========================================
NAVIGATION
========================================= */
nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 5%;
position: sticky;
top: 0;
z-index: 2000;
backdrop-filter: blur(15px);
background: rgba(5, 5, 5, 0.95);
border-bottom: 1px solid var(--vertex-border);
width: 100%;
box-sizing: border-box;
}

.logo-container {
display: flex;
align-items: center;
gap: 10px;
font-family: 'Space Grotesk', sans-serif;
font-weight: 700;
font-size: clamp(1rem, 3vw, 1.2rem);
z-index: 2100;
color: white;
text-decoration: none;
}

.logo-img {
height: 35px;
width: auto;
object-fit: contain;
}

.logo-text {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 1px;
}

.logo-container.no-logo .logo-text {
  display: inline-block;
}

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

.nav-links a {
color: var(--text-main);
text-decoration: none;
font-size: 0.9rem;
transition: 0.3s;
white-space: nowrap;
}

.nav-links a:hover {
color: var(--primary-cyan);
}

.nav-contact-btn {
border: 1px solid var(--primary-cyan);
padding: 0.5rem 1rem;
border-radius: 8px;
color: var(--primary-cyan) !important;
font-weight: 600;
transition: var(--transition);
}

.nav-contact-btn:hover {
background: var(--primary-cyan);
color: #000 !important;
box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
}

.menu-toggle {
display: none;
font-size: 2rem;
cursor: pointer;
color: var(--primary-cyan);
z-index: 2100;
background: none;
border: none;
}

/* =========================================
SECCIONES GENERALES
========================================= */
section {
padding: 80px 5%;
max-width: 1300px;
margin: 0 auto;
width: 100%;
overflow: hidden; /* Contiene el contenido */
}

h2 {
font-family: 'Space Grotesk', sans-serif;
font-size: clamp(1.8rem, 5vw, 3rem);
text-align: center;
margin-bottom: 1rem;
color: white;
word-wrap: break-word;
}

h2 span {
background: var(--accent-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}

.section-desc {
text-align: center;
color: var(--text-muted);
max-width: 700px;
margin: 0 auto 3rem auto;
}

.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
gap: 30px;
}

.card {
background: var(--bg-card);
padding: 2.5rem 2rem;
border-radius: 24px;
border: 1px solid var(--vertex-border);
transition: var(--transition);
width: 100%;
}

.card:hover {
border-color: var(--primary-cyan);
transform: translateY(-5px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card h3 {
color: white;
margin: 1rem 0;
font-size: 1.5rem;
font-family: 'Space Grotesk';
}

.cta-button {
display: inline-block;
background: var(--accent-gradient);
color: #000;
font-weight: 700;
padding: 1.2rem 3rem;
border-radius: 50px;
text-decoration: none;
border: none;
cursor: pointer;
transition: var(--transition);
text-align: center;
font-size: 1rem;
width: 100%;
}

.cta-button:hover {
transform: scale(1.02);
box-shadow: 0 10px 20px rgba(0, 242, 255, 0.3);
}

/* =========================================
HERO
========================================= */

.hero {
position: relative;
min-height: 90vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
padding: 2rem 5%;
}

.hero video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
z-index: -2;
opacity: 0.25;
}

.hero-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(circle, transparent 20%, var(--bg-dark) 90%);
z-index: -1;
}

.hero h1 {
font-family: 'Space Grotesk', sans-serif;
font-size: clamp(2rem, 7vw, 4.5rem);
line-height: 1.1;
margin-bottom: 1.5rem;
}

.hero h1 span {
background: var(--accent-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}

.hero-subtitle {
max-width: 700px;
font-size: clamp(0.9rem, 2.5vw, 1.2rem);
color: var(--text-muted);
margin-bottom: 2.5rem;
padding: 0 1rem;
}


/* =========================================
SPECIFIC SECTION STYLES
========================================= */

/* Stats */
.stats-bar {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 30px;
text-align: center;
margin-top: 40px;
}

.stat-card h3 {
font-size: clamp(2.5rem, 6vw, 3.5rem);
color: var(--primary-cyan);
font-family: 'Space Grotesk';
}

/* Pricing */
.pricing-card {
text-align: center;
position: relative;
overflow: hidden;
border: 2px solid var(--vertex-border);
display: flex;
flex-direction: column;
justify-content: space-between;
}

.pricing-card:hover {
border-color: var(--primary-cyan);
}

.pricing-card.featured {
border-color: var(--primary-cyan);
background: linear-gradient(135deg, rgba(0, 242, 255, 0.05), rgba(41, 255, 191, 0.05));
}

.pricing-badge {
position: absolute;
top: 20px;
right: -30px;
background: var(--accent-gradient);
color: #000;
padding: 5px 40px;
font-size: 0.7rem;
font-weight: 700;
transform: rotate(45deg);
}

.pricing-card .price {
font-size: 3rem;
font-weight: 700;
color: var(--primary-cyan);
font-family: 'Space Grotesk';
margin: 1rem 0;
}

.pricing-features {
list-style: none;
padding: 0;
margin: 2rem 0;
text-align: left;
flex-grow: 1;
}

.pricing-features li {
padding: 0.8rem 0;
border-bottom: 1px solid var(--vertex-border);
font-size: 0.9rem;
color: var(--text-muted);
}

.pricing-features li:before {
content: "✓";
color: var(--primary-green);
font-weight: 700;
margin-right: 10px;
}

/* Team */
.team-avatar {
width: 120px;
height: 120px;
border-radius: 50%;
border: 2px solid var(--primary-cyan);
margin-bottom: 15px;
filter: grayscale(1);
transition: 0.3s;
object-fit: cover;
}

.card:hover .team-avatar {
filter: grayscale(0);
}

/* Lab / GitHub / HTB */
.github-stats {
display: flex;
gap: 15px;
font-family: 'Space Grotesk';
font-size: 0.8rem;
color: var(--primary-green);
margin-top: 10px;
}

.htb-rank {
background: rgba(159, 239, 0, 0.1);
color: #9fef00;
padding: 4px 12px;
border-radius: 4px;
font-weight: bold;
border: 1px solid #9fef00;
display: inline-block;
}

/* Academy Video */
.video-container {
position: relative;
width: 100%;
padding-bottom: 56.25%;
border-radius: 20px;
overflow: hidden;
border: 1px solid var(--primary-cyan);
}

.video-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

/* Ecosystem Store Badges */
.store-badge {
height: 45px;
margin-top: 15px;
transition: transform 0.3s;
}

.store-badge:hover {
transform: scale(1.05);
}

/* Contact Form */
.contact-container {
max-width: 600px;
margin: 0 auto;
background: var(--bg-card);
padding: 2rem;
border-radius: 24px;
border: 1px solid var(--vertex-border);
}

input,
textarea {
width: 100%;
padding: 15px;
margin-bottom: 15px;
border-radius: 12px;
background: #000;
border: 1px solid #333;
color: white;
outline: none;
font-size: 16px;
font-family: 'Inter';
}

input:focus,
textarea:focus {
border-color: var(--primary-cyan);
}

/* =========================================
ARREGLO CHATBOT RESPONSIVE
========================================= */
#chat-toggle {
position: fixed;
bottom: 30px;
right: 30px;
width: 60px;
height: 60px;
background: linear-gradient(135deg, var(--vertex-cyan), var(--vertex-blue));
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 28px;
cursor: pointer;
z-index: 9999;
box-shadow: 0 8px 32px rgba(118, 255, 219, 0.4);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
border: none;
}

#chat-toggle:hover {
transform: scale(1.1) rotate(5deg);
}

#chat-panel {
position: fixed;
bottom: 100px;
right: 30px;
width: 400px; /* Ancho estándar desktop */
height: 600px;
max-height: 80vh;
background: var(--vertex-dark);
border-radius: 20px;
display: none; /* Oculto por defecto */
flex-direction: column;
z-index: 9998;
overflow: hidden;
border: 1px solid var(--vertex-border);
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
backdrop-filter: blur(20px);
animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
from {
opacity: 0;
transform: translateY(20px);
}

to {
opacity: 1;
transform: translateY(0);
}
}

.chat-header {
padding: 20px;
background: linear-gradient(135deg, rgba(118, 255, 219, 0.1), rgba(77, 159, 255, 0.1));
border-bottom: 1px solid var(--vertex-border);
display: flex;
justify-content: space-between;
align-items: center;
flex-shrink: 0; /* Evita que el header se encoja */
}

.chat-header-text h3 {
margin: 0;
font-size: 16px;
color: white;
}

.chat-header-text p {
margin: 0;
font-size: 12px;
color: var(--primary-cyan);
}

.chat-messages {
flex: 1; /* Ocupa todo el espacio disponible */
padding: 20px;
overflow-y: auto; /* Scroll interno */
display: flex;
flex-direction: column;
gap: 16px;
background: var(--vertex-dark);
/* Scroll personalizado sutil */
scrollbar-width: thin;
scrollbar-color: var(--vertex-cyan) transparent;
}

.chat-messages::-webkit-scrollbar {
width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
background-color: var(--vertex-cyan);
border-radius: 3px;
}

.msg {
max-width: 85%;
padding: 14px 16px;
border-radius: 16px;
font-size: 14px;
line-height: 1.5;
word-wrap: break-word;
word-break: break-word; /* Rompe palabras largas si es necesario */
}

.msg.ai {
align-self: flex-start;
background: rgba(118, 255, 219, 0.08);
color: white;
border: 1px solid var(--vertex-border);
border-bottom-left-radius: 4px;
}

.msg.user {
align-self: flex-end;
background: linear-gradient(135deg, var(--vertex-cyan), var(--vertex-blue));
color: #000;
font-weight: 600;
border-bottom-right-radius: 4px;
}

.chat-input {
padding: 16px 20px;
display: flex;
gap: 12px;
background: var(--bg-card);
border-top: 1px solid var(--vertex-border);
flex-shrink: 0; /* Mantiene el input en su lugar */
}

.chat-input input {
flex: 1;
background: rgba(255, 255, 255, 0.03);
border: 1px solid var(--vertex-border);
margin: 0;
padding: 10px 14px;
}

.chat-input button {
background: linear-gradient(135deg, var(--vertex-cyan), var(--vertex-blue));
border: none;
padding: 0 20px;
border-radius: 12px;
cursor: pointer;
color: #000;
font-weight: 600;
flex-shrink: 0;
}

.typing-indicator {
display: flex;
gap: 4px;
padding: 12px 16px;
background: rgba(0, 242, 255, 0.08);
border-radius: 16px;
width: fit-content;
margin-bottom: 10px;
}

.typing-dot {
width: 8px;
height: 8px;
background: #00f2ff;
border-radius: 50%;
animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {

0%,
100% {
transform: translateY(0);
opacity: 0.7;
}

50% {
transform: translateY(-10px);
opacity: 1;
}
}

/* =========================================
RESPONSIVE MEDIA QUERIES
========================================= */

/* Tablet & Mobile adjustments */
@media (max-width: 900px) {
.menu-toggle {
display: block;
}

.nav-links {
position: fixed;
top: 0;
right: -100%;
width: 80%;
max-width: 300px;
height: 100vh;
background: rgba(5, 5, 5, 0.98);
backdrop-filter: blur(20px);
flex-direction: column;
justify-content: center;
gap: 2.5rem;
transition: 0.4s;
z-index: 2050;
border-left: 1px solid var(--vertex-border);
}

.nav-links.active {
right: 0;
}

.nav-links a {
font-size: 1.2rem;
}

/* ARREGLO CRÍTICO DEL CHAT EN MÓVILES */
#chat-panel {
width: 95%; /* Ocupa casi todo el ancho */
left: 2.5%; /* Centrado */
right: auto;
bottom: 90px; /* Encima del botón toggle */
height: 70vh; /* Altura del 70% de la pantalla */
max-height: none; /* Elimina la altura máxima fija */
border-radius: 20px 20px 0 0; /* Estilo hoja deslizante inferior si prefieres, o normal */
}

#chat-toggle {
right: 20px;
bottom: 20px;
width: 56px;
height: 56px;
}

/* Si la pantalla es muy pequeña (iPhone SE viejos, etc) */
@media (max-height: 600px) {
#chat-panel {
height: 80vh;
bottom: 80px;
}
}
}

/* Classes de utilidad para mostrar/ocultar */
#chat-panel {
display: none;
}

#chat-panel.active {
display: flex;
}

.stat-number {
font-family: 'Space Grotesk', sans-serif;
font-size: 3.5rem;
font-weight: 700;
background: var(--accent-gradient);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 0.5rem;
}

/* =========================================
SEGURIDAD Y IFRAME (Para links externos)
========================================= */

/* Esta clase la puedes agregar al iframe o contenedor del link externo
para forzarlo a caber si se rompe el layout */
.responsive-frame-container {
width: 100%;
overflow: hidden;
position: relative;
background: #000;
}

.responsive-frame-container iframe {
width: 100%;
height: 500px;
border: none;
display: block;
}

.install-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 14px;
  margin-left: 12px;
  cursor: pointer;
  font-weight: 600;
}

.logo-container.no-logo {
  padding-left: 0 !important;
}
