/* ─────────────────────────────────────────────
   Share Widget — CharCount
   Used on tool pages. Loaded non-blocking via footer.
   ───────────────────────────────────────────── */

/* ── Wrapper ──────────────────────────────────────── */
.share-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* ── Primary Share Button ─────────────────────────── */
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1.1rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    outline-offset: 3px;
    line-height: 1;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.share-btn:active {
    transform: scale(0.96);
}

.share-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.share-btn__icon {
    font-size: 0.9rem;
}

/* ── Popover ──────────────────────────────────────── */
.share-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    z-index: 1060;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 0.5rem;
    min-width: 200px;
    animation: sharePopoverIn 0.18s ease-out;
}

/* RTL: anchor to right side instead of left */
.share-wrap--rtl .share-popover {
    left: auto;
    right: 0;
}

@keyframes sharePopoverIn {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)  scale(1); }
}

/* On small screens, anchor popover differently to avoid overflow */
@media (max-width: 576px) {
    .share-popover {
        left: 50%;
        transform: translateX(-50%);
        bottom: calc(100% + 8px);
    }

    .share-wrap--rtl .share-popover {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

/* ── Share Action (button / link row) ─────────────── */
.share-action {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 9px;
    color: #111827;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    outline-offset: 2px;
}

.share-action:hover,
.share-action:focus-visible {
    background: #f3f4f6;
    color: #111827;
}

.share-action:focus-visible {
    outline: 2px solid #6c63ff;
}

/* ── Action icons ─────────────────────────────────── */
.share-action__icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1rem;
}

.share-action--copy   .share-action__icon { background: #eef0ff; color: #6c63ff; }
.share-action--facebook .share-action__icon { background: #e8f0fe; color: #1877f2; }
.share-action--x        .share-action__icon { background: #f0f0f0; color: #000;    }
.share-action--whatsapp .share-action__icon { background: #e6f9ee; color: #25d366; }

/* ── Copied state ─────────────────────────────────── */
.share-action--copied .share-action__label {
    color: #10b981;
    font-weight: 600;
}

.share-action--error .share-action__label {
    color: #ef4444;
}

/* Visually hidden live region (screen reader only) */
.share-action__feedback {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
