/* =============================================
 * Blockspot Share Widget
 * ============================================= */

/* ── Wrap ── */

.bssh-wrap {
    position: relative;
    display: inline-block;
}

/* ── Trigger button ── */

.bssh-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    border: 1px solid #9ca3af;
    background: transparent;
    color: #9ca3af;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    touch-action: manipulation;
}

.bssh-trigger svg {
    flex-shrink: 0;
    width: 13px;
    height: 13px;
}

.bssh-trigger:hover {
    color: #1DB0E1;
    border-color: #1DB0E1;
    background: transparent;
}

.bssh-trigger:focus {
    background: transparent;
}

.bssh-trigger:focus-visible {
    outline: 2px solid #1DB0E1;
    outline-offset: 2px;
}

/* ── Backdrop (mobile only — hidden on desktop) ── */

.bssh-backdrop {
    display: none;
}

/* ── Dialog base ── */

.bssh-dialog {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 9999;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    min-width: 240px;
    padding: 16px;
}

.bssh-wrap.bssh-is-open .bssh-dialog {
    display: block;
    animation: bsshPopIn 0.15s ease forwards;
}

@keyframes bsshPopIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Handle (hidden on desktop) ── */

.bssh-handle {
    display: none;
}

/* ── Dialog header ── */

.bssh-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.bssh-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.3;
}

.bssh-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 6px;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.bssh-close svg {
    width: 16px;
    height: 16px;
}

.bssh-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ── Platform grid ── */

.bssh-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* ── Platform item ── */

.bssh-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-family: inherit;
    transition: background 0.15s;
}

.bssh-item:hover {
    background: #f9fafb;
}

.bssh-item:focus,
.bssh-close:focus {
    background: transparent;
    color: inherit;
}

.bssh-item:focus-visible {
    outline: 2px solid #1DB0E1;
    outline-offset: 2px;
}

/* ── Icon circle ── */

.bssh-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.bssh-icon svg {
    width: 16px;
    height: 16px;
}

.bssh-item:hover .bssh-icon {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Platform-specific hover colors */
.bssh-item[data-platform="x"]:hover         .bssh-icon { border-color: #000;     color: #000;     }
.bssh-item[data-platform="linkedin"]:hover  .bssh-icon { border-color: #0A66C2;  color: #0A66C2;  }
.bssh-item[data-platform="facebook"]:hover  .bssh-icon { border-color: #1877F2;  color: #1877F2;  }
.bssh-item[data-platform="whatsapp"]:hover  .bssh-icon { border-color: #25D366;  color: #25D366;  }
.bssh-item[data-platform="telegram"]:hover  .bssh-icon { border-color: #229ED9;  color: #229ED9;  }
.bssh-item[data-platform="email"]:hover     .bssh-icon { border-color: #6366f1;  color: #6366f1;  }
.bssh-item[data-platform="copy"]:hover      .bssh-icon { border-color: #1DB0E1;  color: #1DB0E1;  }

/* Copy-link copied state */
.bssh-item[data-platform="copy"].bssh-copied .bssh-icon {
    border-color: #10b981;
    color: #10b981;
}

/* ── Platform label ── */

.bssh-label {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.3;
    white-space: nowrap;
    transition: color 0.15s;
}

.bssh-item:hover .bssh-label {
    color: #374151;
}

/* ─────────────────────────────────────────────
   MOBILE — bottom sheet (< 640px)
───────────────────────────────────────────── */

@media (max-width: 639px) {

    /* Backdrop */
    .bssh-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 9998;
        background: rgba(0, 0, 0, 0.4);
    }

    .bssh-wrap.bssh-is-open .bssh-backdrop {
        display: block;
        animation: bsshBackdropIn 0.25s ease forwards;
    }

    @keyframes bsshBackdropIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }

    /* Dialog becomes bottom sheet */
    .bssh-dialog {
        position: fixed;
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        min-width: 0;
        padding: 12px 16px 24px;
        box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.16);
    }

    .bssh-wrap.bssh-is-open .bssh-dialog {
        display: block;
        animation: bsshSlideUp 0.25s ease-out forwards;
    }

    @keyframes bsshSlideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }

    /* Drag handle */
    .bssh-handle {
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 999px;
        background: #d1d5db;
        margin: 0 auto 14px;
    }

    /* 4-column grid + larger icon circles on mobile */
    .bssh-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .bssh-icon {
        width: 48px;
        height: 48px;
    }

    .bssh-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* ─────────────────────────────────────────────
   DARK MODE
───────────────────────────────────────────── */

html.bs-dark .bssh-dialog {
    background: #1f2937;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html.bs-dark .bssh-title {
    color: #f9fafb;
}

html.bs-dark .bssh-close {
    color: #6b7280;
}

html.bs-dark .bssh-close:hover {
    background: #374151;
    color: #e5e7eb;
}

html.bs-dark .bssh-item:hover {
    background: #111827;
}

html.bs-dark .bssh-icon {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

html.bs-dark .bssh-label {
    color: #9ca3af;
}

html.bs-dark .bssh-item:hover .bssh-label {
    color: #e5e7eb;
}

html.bs-dark .bssh-handle {
    background: #4b5563;
}

@media (max-width: 639px) {
    html.bs-dark .bssh-backdrop {
        background: rgba(0, 0, 0, 0.6);
    }
}

/* ─────────────────────────────────────────────
   ACCESSIBILITY
───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .bssh-trigger,
    .bssh-icon,
    .bssh-label,
    .bssh-close {
        transition: none;
    }
    .bssh-wrap.bssh-is-open .bssh-dialog,
    .bssh-wrap.bssh-is-open .bssh-backdrop {
        animation: none;
    }
}
