/* Tooltip Menu Styles */
.esl-article-source-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.esl-tooltip-container {
    position: relative;
    display: inline-block;
}

.esl-article-source {
    margin-top: 1.5em;
    font-size: 0.9em;
    color: #7f8c8d;
    text-align: right;
    padding-top: 1em;
    border-top: 1px dotted #bdc3c7;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
}

.esl-article-source a,
.esl-source-link-trigger {
    color: #800080; /* Purple */
    text-decoration: none;
    border-bottom: 1px dotted #800080;
    cursor: pointer;
}

.esl-article-source a:hover,
.esl-source-link-trigger:hover {
    color: #9b59b6;
    border-bottom-color: #9b59b6;
}

.esl-tooltip-menu {
    display: none;
    position: absolute;
    bottom: 125%;
    right: 0;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    width: 160px;
    padding: 6px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.esl-tooltip-container.tooltip-visible .esl-tooltip-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.esl-tooltip-option {
    display: block;
    padding: 10px 14px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.esl-tooltip-option:hover {
    background-color: #f5f5f5;
    color: #800080;
}

/* Modal Styles */
.txtify-modal {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.6); 
}

.txtify-modal-content {
    background-color: #fefefe;
    margin: 5% auto; 
    padding: 25px;
    border: 1px solid #888;
    width: 80%;
    max-width: 800px;
    border-radius: 8px;
    position: relative;
}

.txtify-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.txtify-modal-close:hover,
.txtify-modal-close:focus {
    color: black;
    text-decoration: none;
}

#txtify-modal-body {
    margin-top: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

#txtify-modal-body .user-clicked-highlight {
    background-color: #e6e6fa; /* Lavender */
}

#txtify-modal-body .clickable-word {
    cursor: pointer;
}

/* Loading Spinner Styles */
.txtify-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 5px solid #f3f3f3;
    border-top: 5px solid #800080; /* Purple */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#txtify-modal-body img {
    max-width: 100%;
    height: auto;
    max-height: 400px;
    display: block;
    margin: 1em auto;
    border-radius: 5px;
}

body.txtify-modal-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .txtify-modal-content {
        width: 95%;
        height: 95%;
        margin: 2.5%;
        border-radius: 8px;
    }

    #txtify-modal-body {
        max-height: calc(100vh - 70px); /* Adjust to account for header/padding */
    }
}
