/* Entry meta styling */
.entry-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    position: relative; /* Important for popup positioning */
}

/* Author meta wrapper - NOT clickable */
.author-meta-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    position: relative; /* Important for popup positioning */
}

.author-meta-image {
    width: 48px;
    height: 48px;
    border-radius: 100px;
    object-fit: cover;
}

.written-by-text {
    letter-spacing: 0;
    padding-left: 10px;
}

.post-meta-wrap {
    border-top: 2px solid #F7F7F7;
    border-bottom: 2px solid #F7F7F7;
    padding: 19px 0;
    margin-top: 19px;
    letter-spacing: 0 !important;
    gap: 3px;
}

/* Author name trigger - ONLY THIS IS CLICKABLE */
.author-name-trigger {
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline;
    position: relative;
    color: #3A307F;
    font-weight: bold;
    text-decoration: underline;
}
.author-name-trigger:hover{
    color: #3A307F;
}

.meta-separator {
    color: #333333;
}

/* Tooltip-style popup - ALL POSITIONING IN CSS */
.author-popup {
    position: absolute;
    bottom: 75%;
    left: 125px;
    margin-bottom: 5px;
    width: 100%;
    max-width: 320px;
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
    z-index: 99999;
    display: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.author-popup-content{
    max-height: 190px;
    overflow-y: auto;
}
/* Responsive positioning - show below on small screens or when not enough space above */
@media (max-height: 600px) {
    .author-popup {
        bottom: auto;
        top: 100%;
        margin-bottom: 0;
        margin-top: 10px;
    }
}

/* Optional: Arrow pointing to trigger */
.author-popup::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #fff;
}

/* Arrow for bottom position (when popup is below trigger) */
@media (max-height: 600px) {
    .author-popup::before {
        bottom: auto;
        top: -8px;
        border-top: none;
        border-bottom: 8px solid #fff;
    }
}

.author-popup * {
    max-width: 100%;
}

.author-popup-close {
    position: absolute;
    top: 7px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #ffffff;
    font-size: 16px;
    color: #333333;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    z-index: 10;
    line-height: 1;
    padding: 0;
    margin: 0;
}

.author-popup-close:hover {
    background: #ffffff;
    color: #333333;
}

.author-popup-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    padding-right: 20px;
    border-bottom: 1px solid #E3E3E3;
}

.author-popup-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.author-popup-info h3 {
    margin: 3px 0 3px 0 !important;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.author-popup-info p {
    margin: 0;
    font-size: 14px;
    color: #333333;
    line-height: 1.3;
}

.author-popup-bio {
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    letter-spacing: 0;
}

/* RTL Support for Arabic */

[dir="rtl"] .author-popup {
    left: auto;
    right: 84px;
}

[dir="rtl"] .author-popup::before {
    left: auto;
    right: 20px;
}

[dir="rtl"] .author-popup-header,
.rtl .author-popup-header {
    padding-right: 0;
    padding-left: 20px;
}

[dir="rtl"] .author-popup-close,
.rtl .author-popup-close {
    right: auto;
    left: 10px;
}
[dir="rtl"] .written-by-text{
    padding-left: 0;
    padding-right: 10px;
}
.author-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: none;
}
/* Mobile responsiveness */
@media (max-width: 768px) {
    .author-popup {
        bottom: auto;
        top: 90%;
        left: 0;
        max-width: 100%;
    }
    .author-popup-content {
        max-height: 250px;
        overflow-y: auto;
    }
    .author-popup::before{
        top: -10px;
        bottom: 0;
        left: 110px;
        border-bottom: 10px solid #fff;
        border-top: unset;
    }
    .author-popup-overlay {
        display: none;
    }
    .author-popup-bio{
        text-align: left;
    }
    .single.single-post .entry-header-text.text-center{
        padding-left: 0;
        padding-right: 0;
    }
    .post-meta-wrap{
        padding: 10px 0;
    }
    .author-meta-image{
        width: 32px;
        height: 32px;
    }
    .written-by-text, .author-name-trigger, .post-meta-wrap{
        font-size: 12px !important;
    }
    [dir="rtl"] .author-popup{
        right: 0;
    }
    [dir="rtl"] .author-popup::before{
        top: -10px;
        bottom: 0;
        left: 0;
        right: 80px;
        border-bottom: 10px solid #fff;
        border-top: unset;
    }
    [dir="rtl"] .author-popup-bio{
        text-align: right;
    }
}