/* Estilos globales */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
}

h5 {
    color: #ffffff;
}

h6 {
    color: #005da4;
    font-size: 20px;
}

.contador {
    font-weight: bold;
    color: #333;
}

.contador.alerta {
    color: #d9534f; 
}

.mensaje-flotante {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    font-weight: 500;
    text-align: center;
    opacity: 0.95;
    min-width: 300px;
}

/* Estilo para mensaje de éxito */
.mensaje-exito {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Estilo para mensaje de error */
.mensaje-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Estilos para elementos interactivos */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Estilos para la barra de navegación */
.navbar-custom {
    background-color: #005da4;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    color: #ffffff;
    font-family: Arial, sans-serif;
}

    .navbar-custom img {
        width: 100%;
        max-width: 400px;
        height: auto;
    }

.navbar-nav {
    background-color: #ffffff;
    border-radius: 6px;
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

    /* Menú activo o con hover */
    .navbar-nav .nav-link {
        position: relative;
        padding: 8px 12px;
        border-radius: 4px;
        transition: background-color 0.3s ease, color 0.3s ease;
        font-weight: 600;
    }

        /* Efecto al pasar el mouse */
        .navbar-nav .nav-link:hover {
            background-color: #e6f2fa;
            color: #005da4 !important;
        }




/* Estilos para el contenedor del chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px); /* Se ajusta dinámicamente al tamaño de la ventana */
    max-height: 80vh; /* Límite máximo para evitar que ocupe toda la pantalla */
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    overflow-y: auto;
}

.chat-box {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

/* Estilos para los mensajes en el chat */
.chat-message {
    margin-bottom: 10px;
}

    .chat-message.user .message-content {
        background-color: #d1e7dd;
        padding: 10px;
        border-radius: 8px;
        display: inline-block;
    }

    .chat-message.bot .message-content {
        background-color: #e2e3e5;
        padding: 10px;
        border-radius: 8px;
        display: inline-block;
    }

        .chat-message.bot .message-content p {
            font-size: 15px;
            line-height: 1.4;
        }

/* Estilo del contenido del mensaje */
.message-content p {
    margin: 0;
}

.chat-message .message-content p {
    word-wrap: break-word;
    margin-bottom: 1em;
    white-space: pre-wrap;
    font-size: 15px; 
    line-height: 1.4; 
}

/* Estilos para fórmulas matemáticas */
.mjx-chtml {
    max-width: 100%;
    overflow-x: auto;
}

/* Estilos para el contenedor de entrada */
.input-container {
    padding: 10px;
    border-top: 1px solid #ccc;
    background-color: #fff;
}

#pSolicitud {
    width: calc(100% - 90px);
    display: inline-block;
}

.btn-primary {
    display: inline-block;
}

/* Estilos personalizados de tarjetas */
.card-headerpersonalizado {
    background-color: #005da4;
    color: white;
    border: 2px solid;
    border-radius: 10px;
    width: 100%;
    margin-bottom: 20px;
    padding: 10px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0);
}

/* Estilos para los botones */
.btn.btn-primary {
    background-color: #47ace1;
    border-color: #47ace1;
    color: #FFFFFF;
    font-weight: 600;
}

    .btn.btn-primary:hover {
        background-color: #005da4;
        border-color: #005da4;
        color: #FFFFFF;
    }

/* Estilos para enlaces personalizados */
.link-personalizado {
    color: #47ace1;
    text-decoration: underline;
}

    .link-personalizado:hover {
        color: #005da4;
        text-decoration: underline;
    }

.texto_descargo {
    text-align: center;
    color: grey;
    font-size: 12px;
}


/* Estilo para la hora en los mensajes del chat */
.message-timestamp,
.message-time {
    font-size: 12px; 
    color: #888; 
    display: block; 
    text-align: right; 
}


/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fefefe;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    max-height: 95vh;
    overflow-y: auto;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: #005da4;
    color: white;
}

.modal-title {
    margin: 0;
    font-size: 18px;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: white;
}

.modal-body {
    padding: 16px 20px;
    font-size: 16px;
    color: #333;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #ddd;
    text-align: center;
}

    .modal-footer button {
        padding: 10px 24px;
        font-size: 16px;
        border: none;
        border-radius: 5px;
        background-color: #005da4;
        color: white;
        cursor: pointer;
    }

/* Media queries para mayor adaptabilidad */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 95%;
        min-width: unset;
        max-height: 85vh; /* Limita altura del modal para móviles medianos */
    }

    .modal-body {
        font-size: 15px;
        padding: 16px;
        max-height: 60vh; /* Área desplazable en móviles */
        overflow-y: auto;
        scroll-behavior: smooth;
    }

    .modal-footer {
        padding: 16px;
        position: sticky;
        bottom: 0;
        background-color: white;
        box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
        z-index: 1;
    }

        .modal-footer button {
            width: 100%;
        }

    /* Navbar responsive */
    .navbar-collapse {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100%;
        background-color: #fff;
        box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        z-index: 9999;
    }

        .navbar-collapse.show {
            left: 0;
        }

    .navbar-nav {
        flex-direction: column;
        text-align: center;
        width: 100%;
    }

        .navbar-nav .nav-item {
            margin-bottom: 10px;
        }
}

@media (max-width: 480px) {
    .modal-content {
        max-height: 85vh; /* Aún más compacto para pantallas muy pequeñas */
    }

    .modal-header, .modal-footer {
        padding: 12px 16px;
    }

    .modal-title {
        font-size: 16px;
    }

    .close {
        font-size: 22px;
    }

    .modal-body {
        padding: 14px;
        font-size: 14px;
        max-height: 60vh;
        overflow-y: auto;
        scroll-behavior: smooth;
    }

    .chat-container {
        height: calc(100vh - 160px); /* Ajusta según altura real */
        max-height: 75vh;
    }

    .chat-message .message-content {
        padding: 8px 12px;
        font-size: 14px;
    }

    .input-container {
        flex-direction: column;
        gap: 8px;
    }

    #pSolicitud {
        width: 100%;
        margin-bottom: 8px;
    }

    .btn-primary {
        width: 100%;
    }
}

#loadingMessageBubble {
    display: none;
    background-color: #e2e3e5;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 15px;
    max-width: 85%;
    margin: 10px auto 0 auto;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: fadeIn 0.3s ease-in-out;
}

    #loadingMessageBubble span#dots {
        font-weight: bold;
        display: inline-block;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}