:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --primary-color: #4facfe;
    --text-color: #fff;
    --bubble-user: rgba(79, 172, 254, 0.3);
    --bubble-ai: rgba(255, 255, 255, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    height: 100vh;
    display: flex;
    justify-content: center;
    overflow: hidden; /* Evita scroll en el body, solo en el chat */
}

/* --- Fondo Animado --- */
.background-shapes .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
}
.shape-1 { top: -10%; left: -10%; width: 500px; height: 500px; background: #8e2de2; opacity: 0.4; }
.shape-2 { bottom: -10%; right: -10%; width: 600px; height: 600px; background: #4a00e0; opacity: 0.4; }

/* --- Contenedor Principal --- */
.main-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: rgba(0, 0, 0, 0.2); /* Sutil oscurecimiento central */
    backdrop-filter: blur(5px);
}

/* --- Header --- */
.glass-header {
    padding: 1rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    z-index: 10;
}

.title-container h1 { font-size: 1.2rem; display: inline-block; margin-right: 10px; }
.status-dot { display: inline-block; width: 8px; height: 8px; background: #00ff88; border-radius: 50%; box-shadow: 0 0 10px #00ff88; }
.back-btn { text-decoration: none; color: rgba(255,255,255,0.7); transition: 0.3s; }
.back-btn:hover { color: white; }

/* --- Área de Chat --- */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    scroll-behavior: smooth;
}

/* Scrollbar personalizado */
.chat-area::-webkit-scrollbar { width: 8px; }
.chat-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.message { display: flex; gap: 1rem; max-width: 80%; align-items: flex-start; }
.message.user-message { align-self: flex-end; flex-direction: row-reverse; }
.message.ai-message { align-self: flex-start; }

.avatar { font-size: 1.5rem; background: rgba(255,255,255,0.1); width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }

.bubble {
    padding: 1rem 1.5rem;
    border-radius: 18px;
    color: white;
    line-height: 1.5;
    font-size: 0.95rem;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    white-space: pre-wrap; /* Respeta saltos de línea */
}

.ai-message .bubble {
    background: var(--bubble-ai);
    border: 1px solid rgba(255,255,255,0.05);
    border-top-left-radius: 2px;
}

.user-message .bubble {
    background: var(--bubble-user);
    border: 1px solid rgba(79, 172, 254, 0.3);
    border-top-right-radius: 2px;
}

/* --- Input Area --- */
.glass-input-container {
    padding: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

textarea {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1rem;
    color: white;
    resize: none;
    outline: none;
    font-size: 1rem;
    transition: 0.3s;
    max-height: 100px;
}

textarea:focus { background: rgba(0, 0, 0, 0.4); border-color: var(--primary-color); }

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: 0.3s;
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.4);
}

button:hover { transform: scale(1.05); background: #2b95ec; }
button:disabled { background: #555; cursor: not-allowed; box-shadow: none; }

/* Animación de carga */
.typing-indicator::after { content: '...'; animation: blink 1s infinite; }
@keyframes blink { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
