/* =========================================
   Editorly — Reading Engagement Features CSS
   ========================================= */

/* ---- Reading Progress Bar ---- */
#editorly-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 9999;
}

body.admin-bar #editorly-reading-progress {
    top: 32px;
}

@media (max-width: 782px) {
    /*
     * Hidden on phones.
     *
     * Two reasons. It adds little on a screen where the scrollbar itself is
     * the progress indicator, and it was actively wrong: WordPress switches
     * the admin bar to position:absolute below this width, so it scrolls away
     * with the page, while the 46px offset that compensated for it stayed put.
     * The result was a stray line floating in the middle of the article.
     */
    #editorly-reading-progress {
        display: none;
    }
}

#editorly-reading-progress span {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--ed-primary, #0073aa);
    transition: width 0.1s ease-out;
}

/* ---- Sticky Post Title ---- */
.editorly-sticky-title {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--ed-border, #e5e5e5);
    padding: 14px 20px;
    z-index: 998;
    transform: translateY(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.editorly-sticky-title.is-visible {
    transform: translateY(0);
}

body.admin-bar .editorly-sticky-title {
    top: 32px;
}

@media (max-width: 782px) {
    /*
     * No admin bar offset here either. Below this width WordPress switches the
     * admin bar to position:absolute, so it scrolls out of view with the page
     * while a fixed offset would stay behind and leave the bar hanging in the
     * middle of the screen. The bar belongs at the very top on a phone.
     */
    body.admin-bar .editorly-sticky-title {
        top: 0;
    }
}

.editorly-sticky-title .sticky-title-text {
    font-weight: 700;
    max-width: var(--ed-container, 1140px);
    margin: 0 auto;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Sponsored badge ---- */
.editorly-sponsored-badge {
    display: inline-block;
    background: var(--ed-accent, #f0ad4e);
    color: #402c00;
    font-size: 0.75em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ---- Affiliate Disclosure ---- */
.editorly-affiliate-disclosure {
    background: var(--ed-bg-soft, #f7f7f7);
    border-left: 4px solid var(--ed-primary, #0073aa);
    padding: var(--ed-space-sm, 16px);
    margin-bottom: var(--ed-space-md, 24px);
    font-size: 0.9em;
    color: var(--ed-text-muted, #6b6b6b);
}

.editorly-affiliate-disclosure p {
    margin: 0;
}

/* ---- Review & Rating widget ---- */
.editorly-review-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--ed-bg-soft, #f7f7f7);
    border-radius: var(--ed-radius, 8px);
    padding: var(--ed-space-sm, 16px);
    margin-bottom: var(--ed-space-md, 24px);
    flex-wrap: wrap;
}

.editorly-review-widget .review-item-name {
    font-weight: 700;
}

.editorly-review-widget .review-stars {
    color: var(--ed-accent, #f0ad4e);
    letter-spacing: 2px;
}

.editorly-review-widget .star-empty {
    color: var(--ed-border, #e5e5e5);
}

.editorly-review-widget .review-score {
    font-weight: 700;
    color: var(--ed-text-muted, #6b6b6b);
}

/* ---- Social Share buttons ---- */
.editorly-social-share {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: var(--ed-space-lg, 40px) 0;
    padding-top: var(--ed-space-md, 24px);
    border-top: 1px solid var(--ed-border, #e5e5e5);
}

.editorly-social-share .share-label {
    font-weight: 700;
    margin-right: 4px;
}

.share-btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--ed-border, #e5e5e5);
    background: #fff;
    color: var(--ed-text, #222);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.share-btn:hover {
    opacity: 0.75;
}

.share-facebook  { border-color: #1877f2; color: #1877f2; }
.share-twitter   { border-color: #000; color: #000; }
.share-pinterest { border-color: #e60023; color: #e60023; }
.share-linkedin  { border-color: #0a66c2; color: #0a66c2; }
.share-whatsapp  { border-color: #25d366; color: #25d366; }

/* ---- Fixed Left Share Bar ---- */
.editorly-fixed-share-bar {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%) translateX(-70px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 400;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.editorly-fixed-share-bar.is-visible {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
    visibility: visible;
}

.fixed-share-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--ed-panel-bg, #fff);
    border: 1px solid var(--ed-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    color: var(--ed-text);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.fixed-share-facebook  { color: #1877f2; }
.fixed-share-twitter   { color: #000; }
.fixed-share-pinterest { color: #e60023; }
.fixed-share-linkedin  { color: #0a66c2; }
.fixed-share-whatsapp  { color: #25d366; }

@media (max-width: 1200px) {
    .editorly-fixed-share-bar {
        display: none;
    }
}

/* ---- Highlight to Share popup ---- */
.editorly-highlight-share-popup {
    position: absolute;
    z-index: 9999;
}

.editorly-highlight-share-popup[hidden] {
    display: none;
}

.editorly-highlight-share-popup button {
    background: #000;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.editorly-highlight-share-popup button::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #000;
}

/* ---- Auto Load Next Post ---- */
.editorly-auto-load-loading {
    text-align: center;
    padding: var(--ed-space-lg, 40px) 0;
    color: var(--ed-text-muted, #6b6b6b);
}

#editorly-auto-load-container article {
    margin-top: var(--ed-space-xl, 64px);
    padding-top: var(--ed-space-xl, 64px);
    border-top: 2px solid var(--ed-border, #e5e5e5);
}

/* ---- Responsive ---- */
@media (max-width: 782px) {
    .editorly-social-share {
        gap: 8px;
    }

    .share-btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }
}
