﻿/* ══════════════════════════════════════════════════════════════
   Share component — pill trigger + popover menu
   ══════════════════════════════════════════════════════════════ */

.share-component {
    position: relative;
    display: inline-block;
    font-family: var(--font-primary);
}

/* ── Trigger ── */
.share-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--primary);
    background: linear-gradient(135deg, var(--soft-warm-gold) 0%, var(--warm-gold) 100%);
    border: 1px solid var(--burnished-gold);
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(150, 110, 60, 0.15);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

    .share-trigger:hover {
        background: linear-gradient(135deg, var(--warm-gold) 0%, var(--rich-gold) 100%);
        color: var(--pale-gold);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(150, 110, 60, 0.3);
    }

    .share-trigger:active {
        transform: translateY(0);
        box-shadow: 0 1px 4px rgba(150, 110, 60, 0.25);
    }

    .share-trigger:focus-visible {
        outline: 2px solid var(--burnished-gold);
        outline-offset: 2px;
    }

    .share-trigger i {
        font-size: 1.05em;
    }

@media (max-width: 400px) {
    .share-trigger {
        padding: 6px 10px;
    }

    .share-trigger__label {
        display: none;
    }
}

/* ── Popover ── */
.share-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; /* extends rightward — correct for our RTL placement */
    z-index: 200;
    min-width: 200px;
    max-width: calc(100vw - 24px);
    padding: 8px;
    background: #fff;
    border: 1px solid var(--border-light, #e8e4d9);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: shareMenuIn 0.15s ease-out;
}

    .share-menu[hidden] {
        display: none;
    }

@keyframes shareMenuIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Items ── */
.share-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    text-align: right;
    text-decoration: none;
    color: var(--dark, #1a1a1a);
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

    .share-item:hover {
        background: var(--secondary-bg-light, rgba(248, 244, 233, 0.6));
    }

    .share-item i {
        font-size: 1.2em;
        width: 22px;
        text-align: center;
        flex-shrink: 0;
    }

    .share-item span {
        flex: 1;
    }

/* Platform icon tints */
.share-item--telegram i {
    color: #229ED9;
}

.share-item--whatsapp i {
    color: #25D366;
}

.share-item--eitaa i {
    color: #EF5E2D;
}

.share-item--bale i {
    color: #0E7DE0;
}

.share-item--rubika i {
    color: #8C4BE0;
}

.share-item--twitter i {
    color: #000;
}

.share-item--copy i {
    color: var(--burnished-gold, #966e3c);
}

/* Copy feedback */
.share-item.is-success {
    background: rgba(74, 120, 101, 0.12);
    color: var(--success, #4a7865);
}

    .share-item.is-success i {
        color: var(--success, #4a7865);
    }

.share-item.is-error {
    background: rgba(220, 53, 69, 0.08);
    color: var(--site-red, #8c2b0e);
}

/* ── Expanded variant (standalone bar) ── */
.share-component--expanded .share-trigger {
    display: none;
}

.share-component--expanded .share-menu {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    min-width: 0;
    animation: none;
}

.share-component--expanded .share-item {
    border: 1px solid var(--border-light, #e8e4d9);
    background: #fff;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.88rem;
}

    .share-component--expanded .share-item:hover {
        border-color: var(--burnished-gold, #966e3c);
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(150, 110, 60, 0.15);
    }

/* ── Standalone fallback bar (when no TOC / no chapters) ── */
.share-standalone {
    margin: var(--space-md) 0 var(--space-lg);
    padding: var(--space-md);
    background: var(--secondary-bg-light);
    border: 1px solid var(--border-light);
    border-right: 4px solid var(--burnished-gold);
    border-radius: var(--border-radius);
    text-align: center;
}

.share-standalone__label {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

/* Mobile */
@media (max-width: 576px) {
    .share-menu {
        min-width: 190px;
    }

    .share-item {
        padding: 8px 10px;
        font-size: 0.88rem;
    }
}
/* ══════════════════════════════════════════════════════════════
   Copy feedback states — success / error
   ══════════════════════════════════════════════════════════════ */

/* Base: smooth transition on all feedback states */
.share-item {
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

    /* Force icon + text to transition in sync */
    .share-item i,
    .share-item span {
        transition: color 0.18s ease, opacity 0.18s ease;
    }

    /* ── Success ── */
    .share-item.is-success {
        background: linear-gradient(135deg, rgba(74, 120, 101, 0.16) 0%, rgba(74, 120, 101, 0.24) 100%);
        color: var(--success-dark, #3a5f4e);
        font-weight: 600;
        border-color: rgba(74, 120, 101, 0.3);
        cursor: default;
        animation: shareCopiedPulse 0.4s ease-out;
    }

        .share-item.is-success i {
            color: var(--success, #4a7865) !important;
            font-size: 1.25em;
        }

        .share-item.is-success:hover {
            background: linear-gradient(135deg, rgba(74, 120, 101, 0.16) 0%, rgba(74, 120, 101, 0.24) 100%);
            transform: none;
        }

    /* ── Error ── */
    .share-item.is-error {
        background: rgba(220, 53, 69, 0.1);
        color: var(--site-red, #8c2b0e);
        font-weight: 600;
        border-color: rgba(220, 53, 69, 0.25);
        cursor: default;
        animation: shareErrorPulse 0.4s ease-out;
    }

        .share-item.is-error i {
            color: var(--site-red, #8c2b0e) !important;
            font-size: 1.25em;
        }

        .share-item.is-error:hover {
            background: rgba(220, 53, 69, 0.1);
            transform: none;
        }

/* ── Success pulse ── */
@keyframes shareCopiedPulse {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.04);
    }

    100% {
        transform: scale(1);
    }
}

/* ── Error shake ── */
@keyframes shareErrorPulse {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    50% {
        transform: translateX(3px);
    }

    75% {
        transform: translateX(-2px);
    }

    100% {
        transform: translateX(0);
    }
}
/* ══════════════════════════════════════════════════════════════
   Share menu item — hover harmonized with TOC / chapter list
   ══════════════════════════════════════════════════════════════ */

/* Base: reserve space for the accent bar */
.share-item {
    box-sizing: border-box;
    margin: 0 3px;
    border-right: 3px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

    /* Platform icons keep their brand color on hover,
   but we add a small scale for feedback */
    .share-item i {
        transition: transform 0.15s ease;
    }

    /* ── Hover — matches .toc-link:hover ── */
    .share-item:hover {
        background: rgba(44, 62, 44, 0.06);
        /*border-right-color: var(--burnished-gold, #966e3c);*/
        transform: translateX(-2px);
    }

        .share-item:hover i {
            transform: scale(1.1);
        }

    /* ── Success state: lock out hover changes ── */
    .share-item.is-success,
    .share-item.is-success:hover {
        background: linear-gradient( 135deg, rgba(74, 120, 101, 0.16) 0%, rgba(74, 120, 101, 0.24) 100%);
        border-right-color: transparent;
        transform: none;
    }

        .share-item.is-success i {
            transform: none;
        }

    /* ── Error state: same treatment ── */
    .share-item.is-error,
    .share-item.is-error:hover {
        background: rgba(220, 53, 69, 0.1);
        border-right-color: transparent;
        transform: none;
    }

        .share-item.is-error i {
            transform: none;
        }

/* ══════════════════════════════════════════════════════════════
   Expanded variant (standalone bar) — keep pill style,
   hover uses lift instead of border accent
   ══════════════════════════════════════════════════════════════ */

.share-component--expanded .share-item {
    margin: 0;
    border: 1px solid var(--border-light, #e8e4d9);
    border-right: 1px solid var(--border-light, #e8e4d9);
}

    .share-component--expanded .share-item:hover {
        background: rgba(44, 62, 44, 0.04);
        border-color: var(--burnished-gold, #966e3c);
        /*border-right-color: var(--burnished-gold, #966e3c);*/
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(150, 110, 60, 0.15);
    }

    .share-component--expanded .share-item.is-success:hover,
    .share-component--expanded .share-item.is-error:hover {
        transform: none;
        box-shadow: none;
    }
.share-item--native i {
    color: var(--burnished-gold, #966e3c);
}

.share-item--native {
    border-top: 1px dashed var(--border-light, #e8e4d9);
    margin-top: 4px;
    padding-top: 10px;
}