:root {
    --bg-dark: #0a0e27;
    --bg-darker: #060818;
    --accent-cyan: #64ffda;
    --accent-blue: #00a3ff;
    --text-primary: #ccd6f6;
    --text-secondary: #8892b0;
    --glass-bg: rgba(10, 14, 39, 0.8);
    --border-color: rgba(100, 255, 218, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

.animated-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(100, 255, 218, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 163, 255, 0.05) 0%, transparent 50%),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><rect width="100" height="100" fill="none"/><path d="M0,0 L100,100 M100,0 L0,100 M25,0 L25,100 M50,0 L50,100 M75,0 L75,100 M0,25 L100,25 M0,50 L100,50 M0,75 L100,75" stroke="rgba(100, 255, 218, 0.03)" stroke-width="0.5"/></svg>');
    background-size: 100vw 100vh, 100vw 100vh, 100px 100px;
    animation: bgMove 60s linear infinite;
    z-index: -1;
}

@keyframes bgMove {
    from { transform: translate(0, 0); }
    to { transform: translate(-100px, -100px); }
}

.main-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px 0;
}

.container {
    max-width: 650px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header con Imagen --- */
.main-header {
    width: 100%;
    max-width: 900px;
    text-align: center;
    margin-bottom: 30px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.8s ease-out;
    position: relative; /* Necesario para z-index */
    z-index: 10; /* <-- CORRECCIÓN: Asegura que el header esté encima */
}

.header-image {
    position: relative;
    width: 100%;
    height: 250px;
}

.header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(10, 14, 39, 0.9), rgba(10, 14, 39, 0.4));
}

.header-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 30px;
}

.main-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-header p {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 10px auto 0;
}

/* --- Contenedor del Chat --- */
.chat-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 500px;
    animation: slideUp 0.8s ease-out 0.2s both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-header {
    background: rgba(6, 8, 24, 0.8);
    padding: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
}

.chat-header i {
    color: var(--accent-cyan);
}

.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: var(--bg-darker); }
.chat-messages::-webkit-scrollbar-thumb { background: var(--accent-cyan); border-radius: 3px; }

.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bot-message { align-items: flex-start; }
.user-message { align-items: flex-end; }

.message-bubble {
    padding: 14px 20px;
    border-radius: 20px;
    max-width: 80%;
    word-wrap: break-word;
    font-weight: 500;
}

.bot-message .message-bubble {
    background-color: rgba(136, 146, 176, 0.1);
    color: var(--text-primary);
    border-top-left-radius: 5px;
    border: 1px solid rgba(136, 146, 176, 0.2);
}

.user-message .message-bubble {
    background-color: var(--accent-cyan);
    color: var(--bg-dark);
    border-top-right-radius: 5px;
    font-weight: 600;
}

.typing-indicator { display: none; padding: 10px 20px; }
.typing-indicator.active { display: flex; align-items: center; }
.typing-indicator span {
    height: 8px; width: 8px;
    background-color: var(--accent-cyan);
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

.chat-actions {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 28px;
    border: 1px solid var(--accent-cyan);
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn:hover {
    background-color: var(--accent-cyan);
    color: var(--bg-dark);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(100, 255, 218, 0.4);
}

/* --- Sección de Resultados --- */
.results-container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    animation: slideUp 0.6s ease-out;
}
.hidden { display: none; }

.results-container h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.circular-progress {
    position: relative;
    height: 180px;
    width: 180px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 30px auto;
}
.circular-progress::before {
    content: "";
    position: absolute;
    height: 84%;
    width: 84%;
    background-color: var(--bg-dark);
    border-radius: 50%;
}
.value-container {
    position: relative;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
}
.value-container .total {
    font-size: 1.5rem;
    color: var(--text-secondary);
}
.circular-progress {
    background: conic-gradient(var(--accent-cyan) 0deg, var(--accent-cyan) calc(var(--score-deg) * 1deg), rgba(136, 146, 176, 0.2) 0deg);
}

.cta-container h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
}
.cta-container p {
    color: var(--text-secondary);
}

#email-form {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.input-group {
    display: flex;
    max-width: 450px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    overflow: hidden;
}
#email-form input[type="email"],
#email-form input[type="text"] {
    flex-grow: 1;
    padding: 15px 20px;
    border: none;
    background: rgba(136, 146, 176, 0.05);
    color: var(--text-primary);
    font-size: 1rem;
}
#email-form input[type="email"]::placeholder,
#email-form input[type="text"]::placeholder {
    color: var(--text-secondary);
}
#email-form input[type="email"]:focus,
#email-form input[type="text"]:focus {
    outline: none;
}
.btn-submit {
    padding: 15px 25px;
    border: none;
    background-color: var(--accent-cyan);
    color: var(--bg-dark);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 50px;
    margin: 0 auto;
}
.btn-submit:hover {
    background-color: var(--accent-blue);
    color: var(--text-primary);
}

/* --- Responsividad --- */
@media (max-width: 768px) {
    .main-header h1 { font-size: 1.8rem; }
    .header-image { height: 200px; }
    .chat-container { height: 450px; }
    .results-container { padding: 25px; }
    .input-group { flex-direction: column; border-radius: 8px; }
    .btn-submit { border-radius: 0 0 8px 8px; }
}