/* --- Variables de Color y Estilos Base --- */
:root {
    --primary-color: #007aff;
    --background-color: #f7f7f8;
    --sidebar-bg: #ffffff;
    --chat-bg: #f7f7f8;
    --message-user-bg: #f0f2f5;
    --message-model-bg: #ffffff;
    --text-color: #202123;
    --border-color: #e5e5e5;
    --font-family: 'Poppins', sans-serif; 
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
}

/* --- ESTILOS PARA LOGIN Y REGISTRO --- */
.login-register-body {
    display: flex;
    justify-content: center;
    padding-top: 5vh;
    padding-left: 2rem;
    padding-right: 2rem;
    padding-bottom: 2rem;
    min-height: 100vh;
    background-color: #f0f2f5;
}
.login-register-wrapper { display: flex; flex-direction: column; align-items: center; gap: 2rem; width: 100%; max-width: 450px; }



.brand-title { font-size: 3rem; font-weight: 300; color: #333; text-align: center; }


.app-container { background: white; padding: 1.5rem; border-radius: 16px; box-shadow: 0 0px 0px rgba(0, 0, 0, 0); width: 100%; }
.app-container h2 { font-size: 1.5rem; font-weight: 100; margin-bottom: 1rem; text-align: center; }
.app-container .upload-form { display: flex; flex-direction: column; gap: 1.5rem; }
.app-container .form-step label { display: block; margin-bottom: 0.5rem; font-weight: 100; text-align: left; color: #555; }
.app-container input[type=email], .app-container input[type=password], .app-container input[type=text] { width: 100%; padding: 0.5rem; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s; }
.app-container input[type=email]:focus, .app-container input[type=password]:focus, .app-container input[type=text]:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2); }
.app-container .submit-button { background: var(--primary-color); color: #fff; border: none; padding: 1rem; border-radius: 8px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: background-color 0.2s; margin-top: 1rem; }
.app-container .submit-button:hover { background-color: #0056b3; }
.form-footer { text-align: center; margin-top: 1rem; margin-bottom: 0.5rem; color: #666; }
.form-footer a { color: var(--primary-color); text-decoration: none; font-weight: 100; }
.form-footer a:hover { text-decoration: underline; }

/* Estilos para el enlace de contraseña olvidada */
.form-options {
    text-align: center; /* Alineado a la derecha por defecto (para escritorio) */
    margin-top: -1rem;
    margin-bottom: -1.5rem;
}

.forgot-password-link {
    color: var(--primary-color);
    font-size: 1rem;
    text-decoration: none;
    font-weight: 100;
}

.forgot-password-link:hover {
    text-decoration: underline;
}



@media (max-width: 768px) {
    .login-register-body { padding-top: 0vh; }
    .brand-title { font-size: 0.5rem; font-weight: 300; color: #333; text-align: center; }
    
    
    .landing-brand-title0 { font-size: 0.5rem; font-weight: 300; color: #333; text-align: center; }
    
    
    .app-container { padding: 0.5rem; }
    .form-options {
        text-align: center;
        margin-top: -0.5rem; /* Le damos un espaciado más normal en móvil */
    }
}

















/* --- INICIO DE LA SOLUCIÓN DEFINITIVA PARA LA APP DE CHAT --- */
html, body.chat-body { 
    height: 100%; 
    overflow: hidden; 
}
body.chat-body {
    display: flex;
    flex-direction: column;
}

.main-chat-container { 
    display: flex;
    flex-grow: 1;
    min-height: 0;
    position: relative; /* Contenedor de anclaje para el panel móvil */
    overflow-x: hidden; /* Evita desbordamientos horizontales */
}

/* --- Panel Lateral --- */
.conversations-panel { 
    background-color: var(--sidebar-bg); 
    width: 280px; 
    height: 100%; 
    padding: 1rem; 
    border-right: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column;
    flex-shrink: 0; /* Evita que el panel se encoja */
}
.panel-main-content { display: flex; flex-direction: column; flex-grow: 1; overflow-y: hidden; }
.conversations-panel h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.new-chat-button { background: var(--primary-color); color: white; border: none; padding: 0.75rem; border-radius: 8px; font-size: 1rem; cursor: pointer; margin-bottom: 1rem; text-align: center; }
.conversations-list { list-style: none; flex-grow: 1; overflow-y: auto; padding-left: 0; }
.conversations-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; border-radius: 8px; cursor: pointer; margin-bottom: 0.5rem; overflow: hidden; }
.conversations-list li:hover { background-color: #f0f0f0; }
.conversations-list li.active { background-color: var(--primary-color); color: white; }
.conversation-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.delete-chat-btn { flex-shrink: 0; padding: 0.25rem; border-radius: 4px; opacity: 0; transition: opacity 0.2s ease, background-color 0.2s ease; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.conversations-list li:hover .delete-chat-btn { opacity: 1; }
.delete-chat-btn:hover { background-color: rgba(0, 0, 0, 0.1); }
.conversations-list li.active .delete-chat-btn:hover { background-color: rgba(255, 255, 255, 0.2); }
.panel-footer { flex-shrink: 0; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--border-color); }
.delete-all-button { background: none; border: 1px solid #e57373; color: #e57373; padding: 0.75rem; border-radius: 8px; font-size: 0.9rem; cursor: pointer; width: 100%; transition: background-color 0.2s ease, color 0.2s ease; margin-bottom: 1rem; }
.delete-all-button:hover { background-color: #e57373; color: white; }
.user-menu { display: flex; align-items: center; justify-content: space-between; }
.user-email-display { display: flex; align-items: center; gap: 0.75rem; overflow: hidden; }
.user-icon { font-size: 1.2rem; }
.user-email-text { font-size: 0.9rem; font-weight: 500; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-button { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background-color: transparent; border: none; color: #c94040; font-size: 1.2rem; cursor: pointer; text-decoration: none; transition: background-color 0.2s ease; flex-shrink: 0; }
.logout-button:hover { background-color: #fbebee; }
.logout-icon { font-weight: bold; transform: rotate(180deg); }

/* --- Área Principal del Chat --- */
.chat-area { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    position: relative;
    width: 100%; /* Ocupa el 100% del espacio que le deja el panel */
}
.sidebar-toggle-btn { display: none; position: absolute; top: 1rem; left: 1rem; z-index: 20; background: #ffffff; border: 1px solid var(--border-color); border-radius: 8px; width: 44px; height: 44px; font-size: 1.8rem; cursor: pointer; align-items: center; justify-content: center; line-height: 1; }
.welcome-screen { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 1rem; }
.welcome-screen h1 { font-size: 2rem; margin-bottom: 1rem; }
.chat-messages { flex-grow: 1; overflow-y: auto; padding: 2rem; display: flex; flex-direction: column; gap: 1.5rem; }
.message { padding: 0.75rem; border-radius: 12px; max-width: 80%; line-height: 1.6; display: flex; gap: 1rem; align-items: flex-start; }
.message-user { background-color: var(--message-user-bg); align-self: flex-end; }
.message-model { background-color: var(--message-model-bg); align-self: flex-start; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.message-avatar { font-size: 1.5rem; padding-top: 0.25rem; }
.chat-input-form { padding: 1rem; border-top: 1px solid var(--border-color); background-color: var(--chat-bg); display: flex; flex-direction: column; gap: 0.5rem; width: 100%; max-width: 100%; }
#file-preview-area { display: flex; flex-wrap: wrap; gap: 0.5rem; max-height: 80px; overflow-y: auto; }
#messageForm { display: flex; align-items: center; background-color: white; border-radius: 12px; padding: 0.5rem; box-shadow: 0 2px 8px rgba(0,0,0,0.1); width: 100%; }
#messageForm textarea { flex-grow: 1; border: none; resize: none; font-family: var(--font-family); font-size: 1rem; padding: 0.5rem; background: transparent; min-width: 0; }
#messageForm textarea:focus { outline: none; }
.attach-file-button { font-size: 1.5rem; cursor: pointer; color: #8e8e93; padding: 0.5rem; }
.send-button { background-color: var(--primary-color); color: white; border: none; border-radius: 8px; width: 36px; height: 36px; font-size: 1.5rem; cursor: pointer; flex-shrink: 0; }
.file-preview-item { background: #e9e9eb; color: #333; padding: 0.3rem 0.6rem; border-radius: 12px; font-size: 0.8rem; white-space: nowrap; }

/* --- Media Queries --- */
@media (max-width: 768px) {
    .sidebar-toggle-btn { display: flex; }
    .conversations-panel { 
        position: absolute; 
        left: 0; top: 0; z-index: 10; 
        transform: translateX(-100%); 
        transition: transform 0.3s ease-in-out;
        height: 100%; 
        box-shadow: 4px 0 15px rgba(0,0,0,0.1); 
    }
    .conversations-panel.open { 
        transform: translateX(0); 
    }
    .chat-messages { padding: 1rem; }
}

.message-content-wrapper { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; }
.message-files-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 0.5rem; }
.message-files-container a { text-decoration: none; color: inherit; display: block; }
.message-file-item { display: flex; align-items: center; font-size: 0.9rem; border-radius: 6px; overflow: hidden; cursor: pointer; transition: background-color 0.2s ease; }
.message-files-container a:hover .message-file-item:not(:has(img)) { background-color: rgba(0, 0, 0, 0.08); }
.message-file-item:not(:has(img)) { gap: 0.6rem; background-color: rgba(0, 0, 0, 0.04); padding: 0.5rem; }
.message-user .message-file-item:not(:has(img)) { background-color: rgba(0, 122, 255, 0.08); }
.message-user a:hover .message-file-item:not(:has(img)) { background-color: rgba(0, 122, 255, 0.15); }
.message-file-icon { font-size: 1.2rem; line-height: 1; }
.message-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-image-thumbnail { width: 100%; height: auto; object-fit: cover; border-radius: 6px; border: 1px solid rgba(0,0,0,0.1); display: block; }
.message-content { white-space: pre-wrap; padding-top: 0.25rem; }
.message-files-container + .message-content { padding-top: 0; }
.message-retry-btn { background: #ffc107; color: black; border: none; border-radius: 50%; width: 32px; height: 32px; font-size: 1.2rem; cursor: pointer; margin-top: 0.5rem; align-self: flex-end; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s, transform 0.2s; }
.message-retry-btn:hover { background: #ffca2c; transform: scale(1.1); }
.message-retry-btn:disabled { background: #e0e0e0; cursor: not-allowed; transform: none; animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* --- ESTILOS PARA EL FOOTER --- */
.site-footer { text-align: center; }
.landing-body .site-footer, .login-register-body .site-footer { position: fixed; bottom: 0; left: 0; width: 100%; padding: 1rem; z-index: 100; color: rgba(255, 255, 255, 0.6); }
.landing-body .site-footer a, .login-register-body .site-footer a { color: rgba(255, 255, 255, 1); text-decoration: none; transition: color 0.2s ease; }
.landing-body .site-footer a:hover, .login-register-body .site-footer a:hover { color: black; }
.chat-body .site-footer { color: #888; background-color: var(--background-color); padding: 0.75rem 1rem; border-top: 1px solid var(--border-color); flex-shrink: 0; }
.chat-body .site-footer a { color: #555; text-decoration: none; font-weight: 100; transition: color 0.2s ease; }
.chat-body .site-footer a:hover { color: var(--primary-color); }
.site-footer p { margin: 0; font-size: 0.8rem; }

/* --- ESTILOS PARA LA LANDING PAGE --- */
body.landing-body {
    overflow: hidden;
}
.video-background { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; overflow: hidden; }
.video-background video { min-width: 100%; min-height: 100%; width: auto; height: auto; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.hero-container { height: 100vh; width: 100%; display: flex; justify-content: center; align-items: center; position: relative; z-index: 1; }
.hero-container::before { content: ''; position: absolute; top: -100; left: 0; width: 0%; height: 0%; background-color: rgba(0, 0, 0, 0.5); z-index: -1; }
.hero-content { text-align: center; color: white; padding: 20px; }







.landing-brand-title { font-size: clamp(2rem, 10vw, 1rem); font-weight: 100; margin: 0; line-height: 1.1; letter-spacing: -2px; color: black; }
.landing-brand-title span { color: #ff4d4d; }

.landing-brand-title0 { font-size: clamp(6rem, 10vw, 6rem); font-weight: 100; margin: 0; line-height: 1.1; letter-spacing: -2px; color: white; }
.landing-brand-title0 span { font-size: 11rem; color: #ff4d4d; }

.landing-brand-title2 { font-size: clamp(2rem, 10vw, 2rem); font-weight: 100; margin: 0; line-height: 1.1; letter-spacing: -2px; color: black; }
.landing-brand-title2 span { font-size: 4.5rem; color: #ff4d4d; }


/* --- Media Queries --- */
@media (max-width: 768px) {
    .sidebar-toggle-btn { display: flex; }
    .conversations-panel { 
        position: absolute; 
        left: 0; top: 0; z-index: 10; 
        transform: translateX(-100%); 
        transition: transform 0.3s ease-in-out;
        height: 100%; 
        box-shadow: 4px 0 15px rgba(0,0,0,0.1); 
    }
    
    .landing-brand-title0 { font-size: clamp(3rem, 10vw, 3rem); font-weight: 100; margin: 0; line-height: 1.1; letter-spacing: -2px; color: white; }
	.landing-brand-title0 span { font-size: 6.5rem; color: #ff4d4d; }
    
    .conversations-panel.open { 
        transform: translateX(0); 
    }
    .chat-messages { padding: 1rem; }
}




.subtitle { font-size: clamp(1.2rem, 4vw, 2.5rem); font-weight: 400; margin-top: 10px; margin-bottom: 40px; letter-spacing: 1px; text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5); }
.cta-button { display: inline-block; padding: 16px 40px; background-color: var(--primary-color); color: white; text-decoration: none; font-size: 1.1rem; font-weight: 600; border-radius: 50px; transition: all 0.3s ease; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); }
.cta-button:hover { transform: translateY(-5px); box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3); }





      
/* --- INICIO: ESTILOS FINALES PARA MICRÓFONO --- */
.mic-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px; /* Un tamaño cómodo para hacer clic */
    height: 44px;
    cursor: pointer;
}

.mic-container i {
    font-size: 1.5rem;
    color: #8e8e93; /* Color por defecto (OFF) */
    transition: color 0.2s ease; /* Transición suave opcional */
}

/* Cuando el contenedor tiene la clase 'is-listening', el icono cambia */
.mic-container.is-listening i {
    color: #ff4d4d; /* Color rojo (ON) */
}
/* --- FIN: ESTILOS FINALES PARA MICRÓFONO --- */

    




/* --- Estilos Mejorados para el Botón de Escuchar --- */
.message-speak-btn {
    background: #e0e0e0;
    color: #555; /* Gris por defecto (apagado) */
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 0.75rem;
    align-self: flex-start;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.message-speak-btn:hover {
    background: #d1d1d1;
    transform: scale(1.1);
}

/* Cuando está hablando */
.message-speak-btn.is-speaking {
    background-color: var(--primary-color); /* Azul (activo) */
    color: white;
}




/* --- Añadir a la sección de ESTILOS PARA LOGIN Y REGISTRO --- */

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* El input necesita padding a la derecha para no solaparse con el icono */
.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    padding-right: 2.5rem; /* Espacio para el icono */
}

/* Estilos para el icono del ojo */
.password-wrapper i {
    position: absolute;
    right: 1rem;
    cursor: pointer;
    color: #a0a0a0; /* Un gris sutil */
    transition: color 0.2s;
}

.password-wrapper i:hover {
    color: var(--primary-color);
}


