/* Estilos generales */
:root {
    --corvus-color: #CE7940; /* Naranja/Marrón de la Legio VII Gemina */
    --secondary-corvus-color: #803B31; /* Un tono más oscuro */
    --background-color: #282828;
    --chat-bg-color: #1a1a1a;
    --user-message-bg: #243465; /* Azul marino de la Legio VII */
    --bot-message-bg: #444;
    --text-color: #f1f1f1;
    --status-info-color: #3f51b5;
    --status-error-color: #f44336;
    --link-color: #64B5F6; /* Color para enlaces, como el de búsqueda */
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.gemini-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%; 
    width: 100%; 
    background-color: var(--chat-bg-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: hidden;
}

.chat-header {
    background-color: #333;
    color: var(--text-color);
    padding: 10px 15px;
    border-bottom: 1px solid var(--secondary-corvus-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
}

/* Estilos para el contenedor del logo y título */
.corvus-title-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Espacio entre el logo y el texto */
    flex-grow: 1;
    justify-content: center; /* Centrar el logo y título */
}

.corvus-logo {
    width: 35px;  /* Tamaño del logo */
    height: 35px;
}

.chat-header h1 {
    font-size: 1.2em;
    margin: 0;
    font-weight: 700;
    font-family: 'Cinzel', serif; /* Usar la fuente romana */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-selector select {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--secondary-corvus-color);
    border-radius: 5px;
    padding: 5px 8px;
    font-size: 0.8em;
    cursor: pointer;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
}
.status-indicator.connected {
    background-color: #4caf50; /* Verde */
}
.status-indicator.error {
    background-color: #f44336; /* Rojo */
}

.clear-chat-button {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.2em;
    cursor: pointer;
    transition: color 0.2s ease;
}
.clear-chat-button:hover {
    color: var(--corvus-color);
}
.clear-chat-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--corvus-color) var(--chat-bg-color);
}

.message {
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    max-width: 85%;
    word-wrap: break-word;
    /* Animación de entrada para mensajes */
    animation: fadeIn 0.3s ease-out;
    position: relative; /* Necesario para el botón de copiar */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    background-color: var(--user-message-bg);
    color: white;
    margin-left: auto;
    border-top-right-radius: 0;
}

.bot-message {
    background-color: var(--bot-message-bg);
    color: var(--text-color);
    margin-right: auto;
    border-top-left-radius: 0;
}

/* Estilo para el botón de "Copiar" */
.copy-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.4);
    color: #f1f1f1;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8em;
    cursor: pointer;
    opacity: 0; /* Oculto por defecto */
    transition: opacity 0.2s ease;
}

.message:hover .copy-button {
    opacity: 1; /* Visible al pasar el ratón */
}

/* Estilo para el botón de "Mostrar más" */
.show-more-button {
    background: none;
    border: none;
    color: var(--link-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9em;
    margin-top: 5px;
    display: block;
}

/* Estilo para el botón de búsqueda */
.search-button {
    display: inline-block;
    background-color: var(--corvus-color);
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    margin-top: 10px;
    transition: background-color 0.2s ease;
}
.search-button:hover {
    background-color: var(--secondary-corvus-color);
}


/* Typing Indicator */
.typing-indicator {
    margin-right: auto;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aaa;
    font-style: italic;
    font-size: 0.9em;
}

.typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #aaa;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Área de Input */
.chat-input-area {
    display: flex;
    padding: 10px 15px;
    border-top: 1px solid #333;
    background-color: #333;
    gap: 8px;
}

#user-input {
    flex-grow: 1;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid #555;
    background-color: #444;
    color: var(--text-color);
    font-size: 1em;
    outline: none;
    transition: border-color 0.2s ease; /* Efecto de foco */
}
#user-input:focus {
    border-color: var(--corvus-color); /* Resaltar en foco */
}
#user-input::placeholder {
    color: #bbb;
}

.mic-button, #send-button {
    background-color: var(--corvus-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease; /* Efecto click */
}
.mic-button:active, #send-button:active {
    transform: scale(0.95);
}

/* Animación de "onda de sonido" para el micrófono activo */
.mic-button.active {
    background-color: #f44336;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(244, 67, 54, 0); }
    100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0); }
}

.status-message {
    padding: 5px 15px;
    font-size: 0.9em;
    text-align: center;
    display: none;
    color: var(--text-color);
}
.status-message.error { background-color: var(--status-error-color); }
.status-message.info { background-color: var(--status-info-color); }

/* Para pantallas más pequeñas */
@media (max-width: 600px) {
    .gemini-chat-container {
        border-radius: 0;
        height: 100vh;
    }
    .chat-header h1 {
        font-size: 1.1em;
    }
    .model-selector {
        display: none; /* Ocultar el selector de modelo en móviles si es muy pequeño */
    }
    .chat-input-area {
        padding: 8px 10px;
    }
    #user-input {
        padding: 8px;
    }
    .mic-button, #send-button {
        width: 36px;
        height: 36px;
    }
}
