:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Abstract Background Elements */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: -1;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--accent);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

nav {
    padding: 2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff, var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.logo:hover {
    opacity: 0.8;
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2rem;
    text-align: center;
    z-index: 10;
}

.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 4rem 3rem;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 1s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

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

h1 {
    font-size: 4.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--secondary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    background-size: 200% auto;
    animation: gradientMove 5s linear infinite;
}

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

p.subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.btn-group {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px -5px rgba(99, 102, 241, 0.6);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 4rem;
    text-align: left;
}

.feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.3s ease, background 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-light);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.feature-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #fff;
}

.feature-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.hero-image-container {
    margin: 1.5rem auto 2.5rem auto;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.hero-image {
    width: 240px;
    height: 240px;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    border: 4px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.hero-image:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

/* --- RESPONSIVIDAD COMPLETA --- */

/* 💻 Escritorio / Tablet Grande (max 1200px) */
@media (max-width: 1200px) {
    h1 { font-size: 4rem; }
    .glass-panel { max-width: 90%; padding: 3.5rem 2.5rem; }
}

/* 📱 Tablet Mediana Landscape (max 992px) */
@media (max-width: 992px) {
    h1 { font-size: 3.5rem; }
    p.subtitle { font-size: 1.15rem; margin-bottom: 2.5rem; }
    .hero-image { width: 200px; height: 200px; }
    .features { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
}

/* 📱 Tablet Chica Portrait (max 768px) */
@media (max-width: 768px) {
    h1 { font-size: 3rem; line-height: 1.15; }
    .glass-panel { padding: 2.5rem 1.5rem; border-radius: 20px; }
    nav { padding: 1.5rem 5%; }
    .logo { font-size: 1.8rem; }
    .btn-group { flex-direction: column; width: 100%; gap: 1rem; }
    .btn { width: 100%; text-align: center; }
    .hero-image { width: 160px; height: 160px; margin-bottom: 1.5rem; }
    .features { margin-top: 3rem; }
}

/* 📱 Celular Grande (max 576px) */
@media (max-width: 576px) {
    h1 { font-size: 2.5rem; }
    p.subtitle { font-size: 1rem; }
    .glass-panel { padding: 2rem 1.25rem; }
    .logo { font-size: 1.5rem; }
    nav { justify-content: center; } /* Centramos el logo en mobile */
    .hero-image { width: 140px; height: 140px; border-width: 3px; }
    .features { grid-template-columns: 1fr; }
}

/* 📱 Celular Chico (max 400px) */
@media (max-width: 400px) {
    h1 { font-size: 2.1rem; }
    .glass-panel { padding: 1.5rem 1rem; border-radius: 16px; }
    .btn { padding: 0.8rem 1.5rem; font-size: 1rem; }
}

/* Chatbot Widget Styles */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: hidden;
    transition: transform 0.3s ease, height 0.3s ease;
    display: flex;
    flex-direction: column;
}

.chatbot-container.collapsed {
    transform: translateY(calc(100% - 60px));
}

.chatbot-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-weight: 600;
}

.chatbot-container.collapsed .chatbot-header .chatbot-icon {
    transform: rotate(180deg);
}

.chatbot-icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.chatbot-body {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.bot-message {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}

.user-message {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-input-area {
    display: flex;
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    gap: 10px;
    background: rgba(0,0,0,0.2);
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 10px 15px;
    color: white;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.3s ease;
}

#chat-input:focus {
    border-color: var(--primary-light);
}

#chat-send {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

#chat-send:hover {
    transform: scale(1.1);
    background: var(--primary-light);
}

.typing-indicator {
    align-self: flex-start;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
    padding-left: 5px;
}

/* Chatbot Responsivo para Celulares */
@media (max-width: 576px) {
    .chatbot-container {
        width: calc(100% - 40px);
        bottom: 20px;
        right: 20px;
        z-index: 10000;
    }
    
    /* Si está abierto, que ocupe más pantalla sin desbordar */
    .chatbot-container:not(.collapsed) {
        height: calc(100vh - 120px);
        max-height: 600px;
    }
    
    .chatbot-body {
        height: 100%;
    }
}

@media (max-width: 400px) {
    .chatbot-container {
        width: calc(100% - 20px);
        bottom: 10px;
        right: 10px;
    }
}


/* Modal de Proyectos Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.project-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-light);
    transform: translateX(10px);
}

.project-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.project-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.25rem;
}

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

/* Scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
