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

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Contenedor principal */
.main-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Panel izquierdo (Chat) */
.chat-panel {
    flex: 0 0 65%;  /* No crecer, no encoger, base 65% */
    height: 100vh;
    background-color: #f0f0f0;
    padding: 20px;
    overflow: hidden;
}

/* Panel izquierdo (Chat) */
.chat-panel-complete {
    width: 100%; 
    height: 100vh;
    background-color: #f0f0f0;
    padding: 20px;
    overflow: hidden;
}

#chat-container {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    background-color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#chat-header {
    background-color: #ffffff;
    color: white;
    padding: 10px 15px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    display: flex;
    align-items: center;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

.header-content img {
    height: 36px;
    width: auto;
}

#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #e7ebf0;
}

.assistaan-icon {
    width: 72px;
    height: 144px;
}

.message {
    max-width: 80%;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 18px;
    line-height: 1.4;
}

.message.user {
    background-color: #effdde;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background-color: white;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

#chat-form {
    padding: 10px;
    background-color: #f5f5f5;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    display: flex;
    gap: 10px;
}

#message-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#chat-form button {
    background-color: #5682a3;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

#chat-form button:hover {
    background-color: #476e8a;
}

#chat-form button i {
    font-size: 18px;
}

/* Panel derecho */
.right-panel {
    flex: 0 0 35%;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-left: 1px solid #e0e0e0;
}

.right-panel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Acordeón de servicios */
.accordion {
    flex: 0 0 auto;
    border-bottom: 1px solid #e0e0e0;
}

.accordion-button {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.accordion-body {
    padding: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

/* JSON Viewer */
.json-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #f8f9fa;
}

.json-viewer-header {
    padding: 10px 15px;
    background-color: #f1f1f1;
    border-bottom: 1px solid #e0e0e0;
}

.json-viewer-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

#json-tree {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
}

/* Servicios Grid */
.services-container {
    width: 100%;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    padding: 5px;
}

/* Estilos para los iconos de servicio */
.service-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #f8f9fa;
}

.service-icon:hover {
    background-color: #e9ecef;
    transform: translateY(-2px);
}

.service-icon i {
    font-size: 24px;
    margin-bottom: 8px;
}

.service-icon span {
    font-size: 12px;
    text-align: center;
    color: #495057;
}

/* Colores específicos para cada servicio */
.gmail-icon { color: #EA4335; }
.cal-icon { color: #4285F4; }
.salesforce-icon { color: #00A1E0; }
.hubspot-icon { color: #FF7A59; }
.jira-icon { color: #0052CC; }
.outlook-icon { color: #0078D4; }
.custom-icon { color: #6c757d; }

/* Estilo para el scrollbar */
.services-container::-webkit-scrollbar {
    width: 6px;
}

.services-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.services-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.services-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animación para los iconos */
.service-icon i {
    transition: transform 0.2s ease;
}

.service-icon:hover i {
    transform: scale(1.1);
}

/* Badge para servicios conectados */
.service-icon.connected::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* Visualizador JSON */
.json-viewer {
    flex: 1;
    background-color: #f8f9fa;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
}

.json-viewer-header {
    padding: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.json-toggle {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0 5px;
    margin-right: 5px;
    font-family: monospace;
}

#json-tree {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 10px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    flex: 1;
    overflow-y: auto;
    transition: background-color 0.3s;
}

.json-key {
    color: #881391;
    font-weight: bold;
}

.json-string { 
    color: #1A1AA6; 
}

.json-number { 
    color: #1C00CF; 
}

.json-boolean { 
    color: #0000FF; 
}

.json-null { 
    color: #808080; 
}

/* Estilos para los botones de expandir/colapsar en el JSON viewer */
.json-toggle {
    cursor: pointer;
    background: none;
    border: none;
    color: #555;
    font-family: monospace;
    font-size: 12px;
    padding: 2px 5px;
    margin-right: 5px;
}

.json-toggle:hover {
    color: #000;
}

/* Estilo para el botón de sesión */
#session-button {
    background-color: #4CAF50;
    border: none;
    color: white;
    padding: 5px 10px;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    margin-left: auto;  /* Esto lo empujará hacia la derecha */
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

#session-button:hover {
    background-color: #45a049;
}

/* Estilos para el JSON viewer actualizado */
.json-viewer::after {
    content: 'Última actualización';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 12px;
    color: #666;
    background: #fff;
    padding: 2px 5px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s;
}

.json-viewer.updated::after {
    opacity: 1;
}

#json-tree {
    transition: background-color 0.3s;
}

/* Estilos para el estado inicial del JSON viewer */
#json-tree {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 15px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.json-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.updating {
    animation: highlight 0.3s ease-out;
}

@keyframes highlight {
    0% { background-color: #ffffff; }
    50% { background-color: #f0f8ff; }
    100% { background-color: #ffffff; }
}

/* Estilos para el editor JSON */
.json-editor-container {
    height: 200px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.json-editor {
    height: 100%;
}

/* Estilos para servicios conectados */
.service-icon.connected {
    position: relative;
}

.service-icon.connected::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* Estilos para el mensaje de procesamiento */
.processing-animation {
    width: 70%;
    margin-left: 0;  /* Alinear a la izquierda como mensaje del asistente */
    padding: 0.5rem 1rem;
}

.message.processing {
    width: 100%;
    background-color: #e3eaff;  /* Azul claro */
    margin-bottom: 0;
}

.message.processing .message-wrapper {
    flex-direction: row;
    background-color: #e3eaff;  /* Mismo azul claro */
    border-radius: 15px 15px 15px 0;
    padding: 12px 16px;
    opacity: 0.8;
}

.message.processing .message-content {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 8px;
}

/* Animación de los puntos */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #2c3e50;  /* Azul oscuro */
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out;
}

.processing-text {
    color: #2c3e50;  /* Azul oscuro */
    font-size: 1.9rem;
    opacity: 0.8;
}

@keyframes typing {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Animación de entrada y salida */
.processing-animation.show {
    animation: fadeIn 0.3s ease-in-out;
}

.processing-animation.hide {
    animation: fadeOut 0.3s ease-in-out;
}

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

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

/* Estilos para los mensajes */
.message {
    margin-bottom: 1.5rem;
    position: relative;
    max-width: 80%;
}

.message-wrapper {
    display: flex;
    align-items: flex-start;
    background-color: transparent; /* Fondo transparente */
    padding: 8px;
    border-radius: 15px;
    gap: 12px;
}

/* Estilos para mensajes del usuario */
.message.user {
    margin-left: auto;
}

.message.user .message-wrapper {
    flex-direction: row-reverse;
}

.message.user .message-content {
    background-color: #effdde;
    color: #000;
    border-radius: 15px 15px 0 15px;
    padding: 12px 16px;
    position: relative;
}

/* Estilos para mensajes del asistente */
.message.assistant .message-content {
    background-color: #ffffff;
    color: #333;
    border-radius: 15px 15px 15px 0;
    padding: 12px 16px;
    position: relative;
}

/* Iconos de los mensajes */
.message-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .message-icon {
    background-color: #28a745;
    color: #fff;
}

.message.assistant .message-icon {
    background-color: #e8e7ec;
    color: #fff;
}

.message-icon i {
    font-size: 1.2rem;
}

.message-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Contenido del mensaje */
.message-content {
    position: relative;
    word-wrap: break-word;
    max-width: calc(100% - 48px);
}

/* Timestamp */
.message.user .message-timestamp {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: left;
}

.message.assistant .message-timestamp {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

/* Estilos para mensajes del sistema */
.message.system {
    background-color: #7b72a5;
    color: #333;
    margin: 1rem auto;
    text-align: center;
    font-style: italic;
    max-width: 60%;
    padding: 8px 16px;
    border-radius: 8px;
}

/* Estilos para código en línea */
.message code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Estilos para enlaces */
.message a {
    color: inherit;
    text-decoration: underline;
    opacity: 0.8;
}

.message a:hover {
    opacity: 1;
}

/* Animación de entrada para los mensajes */
.message {
    animation: messageSlide 0.3s ease-out;
}

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

/* Ajustes para el mensaje de procesamiento */
.message.processing {
    background: none;
    margin-bottom: 0;
}

.message.processing .message-wrapper {
    flex-direction: row;
    background-color: #e3eaff;
    border-radius: 15px 15px 15px 0;
    padding: 12px 16px;
    opacity: 0.8;
}

.processing-animation .message-icon {
    opacity: 0.7;
}

.dynamic-content-panel {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
}

.dynamic-content-header {
    margin-bottom: 15px;
}

.dynamic-content-container {
    min-height: 100px;
    padding: 10px;
}

/* Estilos para los contenedores dinámicos */
.thought, .user_query, .observation, .action, .action_input {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    margin: 8px 0;
    border-radius: 4px;
}

.thought {
    background-color: #e3eaff;
    border-left: 4px solid #3498db;
}

.thought::before {
    font-family: "Font Awesome 5 Free";
    content: "\f0eb";
    font-weight: 900;
    color: #3498db;
    font-size: 1.2em;
}

.user_query {
    background-color: #e0f2e9;
    border-left: 4px solid #4caf50;
}

.user_query::before {
    font-family: "Font Awesome 5 Free";
    content: "\f059";
    font-weight: 900;
    color: #4caf50;
    font-size: 1.2em;
}

.observation {
    background-color: #fff0d6;
    border-left: 4px solid #ff9800;
}

.observation::before {
    font-family: "Font Awesome 5 Free";
    content: "\f06e";
    font-weight: 900;
    color: #ff9800;
    font-size: 1.2em;
}

.action {
    background-color: #f3e5f5;
    border-left: 4px solid #9c27b0;
}

.action::before {
    font-family: "Font Awesome 5 Free";
    content: "\f04b";
    font-weight: 900;
    color: #9c27b0;
    font-size: 1.2em;
}

.action_input {
    background-color: #f8f0f9;
    border-left: 4px solid #ba68c8;
}

.action_input::before {
    font-family: "Font Awesome 5 Free";
    content: "\f120";
    font-weight: 900;
    color: #ba68c8;
    font-size: 1.2em;
}

/* Mantener la animación compartida */
.thought, .user_query, .observation, .action, .action_input {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Contenedor principal de razonamiento */
.reasoning-container {
    height: 70vh;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #ffffff;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
