:root {
    /* Nueva paleta: Menos negro, más profundidad tecnológica */
    --primary-color: #00f2ff; /* Cian neón */
    --secondary-color: #7000ff; /* Morado eléctrico */
    --bg-dark: #0f172a; /* Azul pizarra muy profundo (más moderno que el negro) */
    --bg-card: rgba(30, 41, 59, 0.7); /* Slate con transparencia */
    --text-light: #f8fafc;
    --accent-glow: rgba(0, 242, 255, 0.15);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Rajdhani', sans-serif;
    overflow-x: hidden;
    /* Suavizado de tipografía */
    -webkit-font-smoothing: antialiased;
}

/* Fondo con más vida y menos oscuridad total */
.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(112, 0, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(0, 242, 255, 0.15) 0%, transparent 40%),
        linear-gradient(180deg, #0f172a 0%, #020617 100%);
    z-index: -1;
}

/* Cabecera estilizada */
header {
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 4px;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 15px var(--primary-color);
}

.logo span {
    color: var(--primary-color);
    filter: brightness(1.2);
}

/* Contacto arriba a la derecha */
.top-contact {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.top-contact span {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: var(--text-light);
    letter-spacing: 1px;
    opacity: 0.6;
}

.btn-sm {
    text-decoration: none;
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 14px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    background: rgba(0, 242, 255, 0.05);
}

.btn-sm:hover {
    background: var(--primary-color);
    color: #0f172a;
    box-shadow: 0 0 15px var(--primary-color);
    transform: translateY(-2px);
}

/* Hero Centrado - Texto más nítido */
main {
    min-height: 100vh;
    display: block;
}

#hero {
    height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
}

#hero h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#hero p {
    font-size: 1.4rem;
    font-weight: 300;
    max-width: 700px;
    color: #94a3b8;
    letter-spacing: 1px;
}

.glitch {
    position: relative;
    color: var(--secondary-color);
    -webkit-text-fill-color: var(--secondary-color); /* Para que no lo pise el gradient */
    text-shadow: 2px 2px var(--primary-color);
}

/* Proyectos con Glassmorphism */
#projects {
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    color: white;
    font-size: 2rem;
    letter-spacing: 5px;
    margin-bottom: 4rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    margin: 15px auto 0;
    box-shadow: 0 0 10px var(--primary-color);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 16px;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
    background: rgba(30, 41, 59, 0.9);
}

.project-card h3 {
    font-family: 'Orbitron', sans-serif;
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.project-card p {
    font-size: 1rem;
    line-height: 1.7;
    color: #cbd5e1;
    margin-bottom: 2rem;
    flex-grow: 1;
}

.project-link {
    display: inline-block;
    color: white;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 10px 0;
    border-bottom: 2px solid var(--secondary-color);
    transition: 0.3s ease;
    width: fit-content;
}

.project-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    padding-left: 10px;
}

/* Footer elegante */
footer {
    padding: 60px 0;
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 100px;
}

/* Responsividad */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    .top-contact {
        flex-wrap: wrap;
        justify-content: center;
    }
    #hero h1 { font-size: 2.8rem; }
}
/* Contenedor del Chat */
#ai-chat-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

#chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    cursor: pointer;
    box-shadow: 0 0 20px var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.ai-icon {
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    color: #0f172a;
}

#ai-chat-window {
    width: 300px;
    height: 400px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    position: absolute;
    bottom: 80px;
    right: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: 0.3s;
}

#ai-chat-window.hidden {
    display: none;
}

.chat-header {
    background: rgba(0, 242, 255, 0.1);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
}

.pulse-icon {
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.chat-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: var(--primary-color);
    letter-spacing: 2px;
}

#chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 80%;
}

.ai-msg {
    background: rgba(112, 0, 255, 0.2);
    color: #e0e0e0;
    align-self: flex-start;
    border-left: 2px solid var(--secondary-color);
}

.user-msg {
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary-color);
    align-self: flex-end;
    border-right: 2px solid var(--primary-color);
}

.chat-input-area {
    padding: 10px;
    display: flex;
    gap: 5px;
    background: rgba(0, 0, 0, 0.3);
}

#chat-input {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px;
    border-radius: 4px;
    flex-grow: 1;
    font-family: 'Rajdhani', sans-serif;
}

#send-btn {
    background: var(--primary-color);
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* Efecto Typewriter Cursor */
.cursor::after {
    content: '_'; /* Puedes cambiarlo por '|' si prefieres una barra */
    display: inline-block;
    margin-left: 5px;
    font-weight: bold;
    color: var(--primary-color);
    animation: blink 1s step-end infinite;
}

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