/* =============================================
 * Blockspot Coin Voting Widget
 * ============================================= */

/* ─────────────────────────────────────────────
   PRODUCTION WIDGET STYLES
───────────────────────────────────────────── */

.bscv-widget {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* ── Buttons ── */

.bscv-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bscv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    line-height: 1;
    font-family: inherit;
    touch-action: manipulation;
    white-space: nowrap;
}

.bscv-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.bscv-btn svg {
    flex-shrink: 0;
}

/* Bullish — default pre-vote */
.bscv-btn-bullish {
    background: #ecfdf5;
    color: #16a34a;
}
.bscv-btn-bullish:hover:not(.bscv-btn-active):not(.bscv-loading) {
    background: #d1fae5;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.15);
}

/* Bearish — default pre-vote */
.bscv-btn-bearish {
    background: #fef2f2;
    color: #ef4444;
}
.bscv-btn-bearish:hover:not(.bscv-btn-active):not(.bscv-loading) {
    background: #fee2e2;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

/* Active (current vote) */
.bscv-btn-bullish.bscv-btn-active {
    background: #10b981;
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.bscv-btn-bearish.bscv-btn-active {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Inactive (the other button after voting — clickable to change vote) */
.bscv-btn-inactive {
    background: #f3f4f6;
    color: #9ca3af;
    cursor: pointer;
}
.bscv-btn-inactive:hover {
    background: #e5e7eb;
    color: #6b7280;
}

/* Loading state */
.bscv-btn.bscv-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* ── Pre-vote teaser (blurred bar) ── */

.bscv-teaser {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    align-self: stretch;
}

.bscv-bar-blurred {
    position: relative;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    display: flex;
    flex-shrink: 0;
}

.bscv-bar-bullish-blurred {
    background: #10b981;
    height: 100%;
}

.bscv-bar-bearish-blurred {
    background: #f87171;
    height: 100%;
}

.bscv-blur-overlay {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background: rgba(209, 213, 219, 0.5);
    border-radius: 999px;
}

.bscv-teaser-text {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

/* ── Post-vote results (revealed bar) ── */

.bscv-results {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    align-self: stretch;
}

.bscv-bar {
    flex: 1 1 0;
    min-width: 40px;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    display: flex;
    background: #f3f4f6;
}

.bscv-bar-bullish-fill {
    background: #10b981;
    height: 100%;
    border-radius: 999px 0 0 999px;
    transition: width 0.7s ease;
}

.bscv-bar-bearish-fill {
    background: #f87171;
    height: 100%;
    border-radius: 0 999px 999px 0;
    transition: width 0.7s ease;
}

.bscv-results-text {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}

.bscv-results-text .bscv-pct {
    font-weight: 600;
    color: #374151;
}

/* ── Prevote layout: buttons top, teaser below ── */

.bscv-prevote {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
    align-self: stretch;
}

/* ── Postvote: always column ── */

.bscv-postvote {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
    align-self: stretch;
}

/* Hide the change-vote buttons — once voted, the progress bar takes the
   buttons' top slot so overall widget height stays compact and the content
   below (disclaimer / other page elements) doesn't shift on vote. */
.bscv-postvote .bscv-buttons {
    display: none;
}

/* ── Animations ── */

.bscv-postvote.bscv-reveal {
    animation: bscvFadeIn 0.4s ease forwards;
}

@keyframes bscvFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Attention effects ── */

@keyframes bscvShimmer {
    0%, 100% { box-shadow: 0 0 0 0 transparent; }
    50%      { box-shadow: 0 0 10px 2px var(--bscv-glow); }
}

.bscv-prevote .bscv-btn-bullish { --bscv-glow: rgba(16, 185, 129, 0.35); --bscv-glow-solid: #10b981; --bscv-btn-bg: #ecfdf5; }
.bscv-prevote .bscv-btn-bearish { --bscv-glow: rgba(239, 68, 68, 0.35); --bscv-glow-solid: #ef4444; --bscv-btn-bg: #fef2f2; }

.bscv-prevote.bscv-attn-shimmer .bscv-btn {
    animation: bscvShimmer 0.75s ease 2;
}

@keyframes bscvBounce {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.08); }
    50%  { transform: scale(0.97); }
    70%  { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.bscv-prevote.bscv-attn-bounce .bscv-btn-bullish {
    animation: bscvBounce 0.6s ease;
}
.bscv-prevote.bscv-attn-bounce .bscv-btn-bearish {
    animation: bscvBounce 0.6s ease 0.1s both;
}

@keyframes bscvWiggle {
    0%, 100% { transform: translateX(0); }
    15%      { transform: translateX(-3px); }
    30%      { transform: translateX(3px); }
    45%      { transform: translateX(-2px); }
    60%      { transform: translateX(2px); }
    75%      { transform: translateX(-1px); }
    90%      { transform: translateX(1px); }
}

.bscv-prevote.bscv-attn-wiggle .bscv-btn {
    animation: bscvWiggle 0.5s ease;
}

.bscv-prevote.bscv-attn-wiggle .bscv-btn-bullish {
    box-shadow: 0 0 12px 3px rgba(16, 185, 129, 0.3);
}
.bscv-prevote.bscv-attn-wiggle .bscv-btn-bearish {
    box-shadow: 0 0 12px 3px rgba(239, 68, 68, 0.3);
}

@keyframes bscvBorderLightA {
    0%    { offset-distance: 0%;   opacity: 1; }
    46%   { offset-distance: 100%; opacity: 1; }
    47%   { offset-distance: 100%; opacity: 0; }
    100%  { offset-distance: 100%; opacity: 0; }
}

@keyframes bscvBorderLightB {
    0%    { offset-distance: 0%; opacity: 0; }
    53%   { offset-distance: 0%; opacity: 0; }
    54%   { offset-distance: 0%; opacity: 1; }
    100%  { offset-distance: 100%; opacity: 1; }
}

.bscv-prevote.bscv-attn-borderlight .bscv-btn {
    position: relative;
}

.bscv-prevote.bscv-attn-borderlight .bscv-btn::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bscv-glow-solid);
    box-shadow: 0 0 8px 3px var(--bscv-glow-solid), 0 0 18px 6px var(--bscv-glow);
    offset-path: inset(0px round 15px);
    offset-rotate: 0deg;
    opacity: 0;
    pointer-events: none;
}

.bscv-prevote.bscv-attn-borderlight .bscv-btn-bullish::before {
    animation: bscvBorderLightA 5s linear 1;
}

.bscv-prevote.bscv-attn-borderlight .bscv-btn-bearish::before {
    animation: bscvBorderLightB 5s linear 1;
}

/* ─────────────────────────────────────────────
   WIDGET WRAPPER
───────────────────────────────────────────── */

.bscv-card {
    background: #fff;
    padding: 4px 20px 16px;
}

.bscv-vote-again {
    font-size: 11px;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.bscv-card-voting {
    display: flex;
    align-items: center;
}

/* ─────────────────────────────────────────────
   SHARE ROW — appears after vote
───────────────────────────────────────────── */

.bscv-share {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.bscv-share-reveal {
    animation: bscvShareIn 0.3s ease both;
}

@keyframes bscvShareIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bscv-share-label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
    line-height: 28px;
}

.bscv-share-btns {
    display: flex;
    gap: 6px;
}

.bscv-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    padding: 0;
}

.bscv-share-btn svg {
    width: 14px;
    height: 14px;
}

.bscv-share-btn:hover,
.bscv-share-btn:focus,
.bscv-share-btn:active {
    border-color: #d1d5db;
    background: #f3f4f6;
    color: #6b7280;
    outline: none;
}

.bscv-share-x:hover, .bscv-share-x:active { color: #000; }
.bscv-share-tg:hover, .bscv-share-tg:active { color: #229ED9; }
.bscv-share-wa:hover, .bscv-share-wa:active { color: #25D366; }
.bscv-share-copy:hover, .bscv-share-copy:active { color: #1DB0E1; }

.bscv-share-copy.bscv-copied {
    border-color: #10b981;
    background: #ecfdf5;
    color: #10b981;
}

/* ─────────────────────────────────────────────
   FEATURED-ON-HOMEPAGE PROGRESS BAR
───────────────────────────────────────────── */

.bscv-featured-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.bscv-featured-text-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bscv-featured-text {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
}

.bscv-featured-bar.bscv-featured-active .bscv-featured-text {
    color: #B8960C;
    font-weight: 600;
}

.bscv-hint-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 24px;
}

.bscv-featured-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    white-space: nowrap;
}
.bscv-votes-highlight {
    text-decoration: underline;
    text-decoration-style: solid;
    text-decoration-color: #111827;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}
.bscv-hint-icon {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}
.bscv-hint-icon svg {
    width: 13px;
    height: 13px;
}

.bscv-featured-bar.bscv-featured-close .bscv-featured-text {
    color: #B8960C;
    font-weight: 600;
}

.bscv-featured-reveal {
    animation: bscvFeaturedIn 0.4s ease both;
}

@keyframes bscvFeaturedIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — medium (≤ 640px)
   Card stays row but voting section tightens
───────────────────────────────────────────── */

@media (max-width: 640px) {
    .bscv-card {
        padding: 14px 16px;
    }
}

/* ─────────────────────────────────────────────
   RESPONSIVE — mobile (≤ 480px)
   Card stacks: coin info top, voting below
───────────────────────────────────────────── */

@media (max-width: 480px) {
    .bscv-card {
        padding: 14px 16px;
    }

    /* Widget fills full width, left-aligned */
    .bscv-widget {
        width: 100%;
        align-items: stretch;
    }

    .bscv-prevote,
    .bscv-postvote {
        width: 100%;
        align-items: stretch;
    }

    /* Buttons row: each button takes equal space */
    .bscv-buttons {
        width: 100%;
    }

    .bscv-btn {
        flex: 1;
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Teaser row: bar grows to fill remaining space */
    .bscv-teaser {
        width: 100%;
    }

    .bscv-bar-blurred {
        width: 100%;
        min-width: 60px;
    }

    /* Results: bar fills remaining space, text stays inline */
    .bscv-results {
        width: 100%;
    }

}

/* ─────────────────────────────────────────────
   RESPONSIVE — extra small (≤ 360px)
───────────────────────────────────────────── */

@media (max-width: 360px) {
    .bscv-card {
        padding: 12px 14px;
    }

    .bscv-btn {
        font-size: 12px;
        padding: 9px 10px;
        gap: 4px;
    }
}

/* ─────────────────────────────────────────────
   ACCESSIBILITY
───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .bscv-postvote.bscv-reveal {
        animation: none;
    }

    .bscv-bar-bullish-fill,
    .bscv-bar-bearish-fill {
        transition: none;
    }

    .bscv-prevote[class*="bscv-attn-"] .bscv-btn,
    .bscv-prevote[class*="bscv-attn-"] .bscv-btn::before {
        animation: none;
    }

    .bscv-share-reveal {
        animation: none;
    }

    .bscv-featured-fill {
        transition: none;
    }

    .bscv-featured-reveal {
        animation: none;
    }
}

.bscv-noscript {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
}

.bscv-error-msg {
    font-size: 12px;
    color: #ef4444;
    margin: 6px 0 0;
    text-align: center;
}
