/**
 * Kalshi prediction card
 * Compact, theme-integrated, animated. Fits the 320px sidebar and article width.
 */

.fc-kalshi-btc-block {
    --kalshi-green: #16a37b;
    --kalshi-blue: #3569d4;
    --kalshi-accent: #e58c42;
    margin: 0 0 var(--fc-spacing-lg, 1.5rem);
}

/* Multi-card grid */
.fc-kalshi-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.fc-kalshi-card {
    position: relative;
    display: block;
    box-sizing: border-box;
    padding: 14px 15px 12px;
    overflow: hidden;
    color: var(--fc-text-primary, #212121);
    background: var(--fc-bg-primary, #fff);
    border: 1px solid var(--fc-border-color, #e0e0e0);
    border-radius: var(--fc-radius-lg, 12px);
    box-shadow: var(--fc-shadow-card, 0 2px 8px rgba(0, 0, 0, .08));
    transition: box-shadow .2s ease;
}

.fc-kalshi-card::before {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(22, 163, 123, .06) 50%, transparent 70%);
    content: "";
    pointer-events: none;
    transform: translateX(-120%);
    animation: fc-kalshi-shimmer 6s ease-in-out infinite;
}

.fc-kalshi-card:hover {
    box-shadow: var(--fc-shadow-lg, 0 10px 15px rgba(0, 0, 0, .1));
}

.fc-kalshi-card > * {
    position: relative;
    z-index: 1;
}

/* Topline */
.fc-kalshi-card__topline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fc-kalshi-card__coin-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    background: #f7931a;
    border-radius: 7px;
}

.fc-kalshi-card__coin-name {
    color: var(--fc-text-secondary, #6c757d);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
}

.fc-kalshi-card__live {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
    color: var(--kalshi-accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
}

.fc-kalshi-card__live i {
    width: 6px;
    height: 6px;
    background: var(--kalshi-accent);
    border-radius: 50%;
    animation: fc-kalshi-pulse 1.5s ease-in-out infinite;
}

/* Title */
.fc-kalshi-card__title {
    display: block;
    margin-top: 12px;
    color: var(--fc-text-primary, #212121);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.01em;
}

.fc-kalshi-card__title strong {
    color: var(--kalshi-green);
    font-weight: 700;
}

/* Levels */
.fc-kalshi-card__levels {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.fc-kalshi-level {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
}

.fc-kalshi-level__main {
    min-width: 0;
}

.fc-kalshi-level__label {
    display: block;
    overflow: hidden;
    color: var(--fc-text-primary, #212121);
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-kalshi-level__bar {
    display: block;
    height: 3px;
    margin-top: 6px;
    overflow: hidden;
    background: var(--fc-border-light, #f0f0f0);
    border-radius: 99px;
}

.fc-kalshi-level__bar i {
    display: block;
    height: 100%;
    min-width: 4px;
    border-radius: inherit;
    transition: width .6s cubic-bezier(.2, .8, .2, 1);
}

.fc-kalshi-level--green .fc-kalshi-level__bar i {
    background: var(--kalshi-green);
}

.fc-kalshi-level--blue .fc-kalshi-level__bar i {
    background: var(--kalshi-blue);
}

.fc-kalshi-level__odds {
    color: var(--fc-text-secondary, #6c757d);
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Percentage "bet" button — the only clickable element on the card */
.fc-kalshi-bet {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    min-height: 32px;
    padding: 0 12px;
    color: var(--fc-text-primary, #212121);
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    border: 1.5px solid var(--kalshi-green);
    border-radius: 99px;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.fc-kalshi-level--green .fc-kalshi-bet {
    border-color: var(--kalshi-green);
}

.fc-kalshi-level--blue .fc-kalshi-bet {
    border-color: var(--kalshi-blue);
}

.fc-kalshi-level--green .fc-kalshi-bet:hover,
.fc-kalshi-level--green .fc-kalshi-bet:focus-visible {
    color: #fff;
    background: var(--kalshi-green);
    box-shadow: 0 4px 12px rgba(22, 163, 123, .35);
    transform: translateY(-1px);
}

.fc-kalshi-level--blue .fc-kalshi-bet:hover,
.fc-kalshi-level--blue .fc-kalshi-bet:focus-visible {
    color: #fff;
    background: var(--kalshi-blue);
    box-shadow: 0 4px 12px rgba(53, 105, 212, .35);
    transform: translateY(-1px);
}

.fc-kalshi-bet:focus-visible {
    outline: 2px solid rgba(53, 105, 212, .4);
    outline-offset: 2px;
}

.fc-kalshi-bet.is-up {
    background: rgba(22, 163, 123, .16);
    transform: scale(1.06);
}

.fc-kalshi-bet.is-down {
    background: rgba(214, 69, 69, .14);
    transform: scale(1.06);
}

/* Footer */
.fc-kalshi-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid var(--fc-border-light, #f0f0f0);
    font-size: 12px;
}

.fc-kalshi-card__timer {
    color: var(--kalshi-accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.fc-kalshi-card__volume {
    color: var(--fc-text-secondary, #6c757d);
}

.fc-kalshi-card__markets {
    margin-left: auto;
    color: var(--fc-text-secondary, #6c757d);
}

/* Placement: mobile-only (before article text) vs sidebar (desktop) */
.fc-kalshi-cards--mobile {
    display: none;
}

@media (max-width: 992px) {
    .fc-kalshi-cards--mobile {
        display: grid;
    }

    .fc-kalshi-cards--sidebar {
        display: none;
    }
}

/* Compact spacing in the sidebar: tighter gap between event cards and less
   space below the block before the next widget (e.g. Price Predictions). */
.fc-kalshi-cards--sidebar {
    gap: 8px;
    margin-bottom: 0;
}

.fc-widget-sidebar-banner:has(.fc-kalshi-cards--sidebar) {
    margin-bottom: calc(var(--fc-spacing-xl) * -0.5);
}

/* Homepage: desktop grid vs mobile-only stack */
.fc-kalshi-cards--home_mobile {
    display: none;
}

@media (max-width: 992px) {
    .fc-kalshi-cards--home {
        display: none;
    }

    .fc-kalshi-cards--home_mobile {
        display: grid;
        grid-template-columns: 1fr;
    }
}

/* Homepage desktop — one full-width card per row */
.fc-kalshi-cards--home {
    grid-template-columns: 1fr;
}

/* Gutenberg block — auto grid in wide areas */
.fc-kalshi-cards--block {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

@media (max-width: 560px) {
    .fc-kalshi-cards--block {
        grid-template-columns: 1fr;
    }
}

/* Defensive resets when the card sits inside article prose (Gutenberg block).
   Article typography turns links into gradient/underlined text, which would
   otherwise make the bet buttons invisible. */
.fc-article-content .fc-kalshi-bet {
    background: transparent;
    background-clip: border-box;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    text-decoration: none;
}

.fc-article-content .fc-kalshi-level--green .fc-kalshi-bet:hover,
.fc-article-content .fc-kalshi-level--green .fc-kalshi-bet:focus-visible {
    background: var(--kalshi-green);
}

.fc-article-content .fc-kalshi-level--blue .fc-kalshi-bet:hover,
.fc-article-content .fc-kalshi-level--blue .fc-kalshi-bet:focus-visible {
    background: var(--kalshi-blue);
}

.fc-article-content .fc-kalshi-card__title strong {
    -webkit-text-fill-color: currentColor;
}

/* Animations */
@keyframes fc-kalshi-pulse {
    0%, 100% { opacity: .45; transform: scale(.8); }
    50% { opacity: 1; transform: scale(1.15); }
}

@keyframes fc-kalshi-shimmer {
    0%, 55% { transform: translateX(-120%); }
    80%, 100% { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
    .fc-kalshi-card::before,
    .fc-kalshi-card__live i {
        animation: none;
    }

    .fc-kalshi-card,
    .fc-kalshi-level__bar i,
    .fc-kalshi-bet {
        transition: none;
    }
}
