/**
 * Markets 2 - catalog, asset pages, in-article market blocks.
 * Uses the theme CSS variables so it adapts to light/dark mode.
 *
 * @package Flavor_Crypto
 */

/* ==========================================================================
   Markets index
   ========================================================================== */

.fc-mkt-layout {
    padding: var(--fc-spacing-xl) 0 var(--fc-spacing-2xl);
}

.fc-mkt-header {
    margin-bottom: var(--fc-spacing-xl);
}

.fc-mkt-subtitle {
    color: var(--fc-text-secondary);
    margin-top: var(--fc-spacing-xs);
    max-width: 70ch;
}

/* Overview cards */
.fc-mkt-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--fc-spacing-md);
    margin-bottom: var(--fc-spacing-xl);
}

.fc-mkt-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--fc-spacing-md);
    background: var(--fc-bg-secondary);
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-lg);
    min-height: 112px;
}

.fc-mkt-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fc-mkt-card__label {
    font-size: var(--fc-font-size-sm);
    color: var(--fc-text-secondary);
}

.fc-mkt-card__big {
    font-family: var(--fc-font-heading);
    font-size: clamp(1.3rem, 1rem + 0.8vw, 1.8rem);
    font-weight: 700;
    color: var(--fc-text-primary);
    line-height: 1.1;
    margin-top: auto;
}

.fc-mkt-card__unit {
    font-size: 0.55em;
    font-weight: 600;
    color: var(--fc-text-secondary);
}

.fc-mkt-card__sub {
    font-size: var(--fc-font-size-sm);
    color: var(--fc-text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
}

.fc-mkt-gas__tiers {
    color: var(--fc-text-muted);
    font-size: 0.85em;
}

/* Fear & Greed gauge */
.fc-mkt-card--sentiment {
    align-items: center;
    text-align: center;
}

.fc-mkt-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: auto;
}

.fc-mkt-gauge__svg {
    width: 100%;
    max-width: 150px;
    height: auto;
}

.fc-mkt-gauge__value {
    font-family: var(--fc-font-heading);
    font-size: 34px;
    font-weight: 700;
    fill: var(--fc-text-primary);
}

.fc-mkt-gauge__label {
    margin-top: -6px;
    font-size: var(--fc-font-size-sm);
    font-weight: 600;
    color: var(--fc-text-secondary);
}

/* Movers */
.fc-mkt-movers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--fc-spacing-lg);
    margin-bottom: var(--fc-spacing-xl);
}

.fc-mkt-movers__card {
    padding: var(--fc-spacing-lg);
    background: var(--fc-bg-secondary);
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-lg);
}

.fc-mkt-movers__title {
    font-size: var(--fc-font-size-lg);
    margin: 0 0 var(--fc-spacing-md);
}

.fc-mkt-movers__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fc-mkt-movers__item + .fc-mkt-movers__item {
    border-top: 1px solid var(--fc-border-light);
}

.fc-mkt-movers__link,
.fc-mkt-movers__item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: var(--fc-spacing-md);
    padding: var(--fc-spacing-sm) 0;
    color: inherit;
    text-decoration: none;
}

.fc-mkt-movers__coin {
    display: flex;
    align-items: center;
    gap: var(--fc-spacing-sm);
    font-weight: 600;
}

.fc-mkt-movers__coin img {
    border-radius: 50%;
}

.fc-mkt-movers__price {
    font-variant-numeric: tabular-nums;
    color: var(--fc-text-secondary);
}

.fc-mkt-movers__change {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Table */
.fc-mkt-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-lg);
}

.fc-mkt-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--fc-bg-secondary);
}

.fc-mkt-table th,
.fc-mkt-table td {
    padding: var(--fc-spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--fc-border-light);
    white-space: nowrap;
}

.fc-mkt-table thead th {
    font-size: var(--fc-font-size-sm);
    color: var(--fc-text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.fc-mkt-table tbody tr:last-child td {
    border-bottom: none;
}

.fc-mkt-table tbody tr:hover {
    background: var(--fc-bg-tertiary);
}

.fc-mkt-table__rank {
    color: var(--fc-text-muted);
    width: 48px;
}

.fc-mkt-table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.fc-mkt-table__price {
    font-weight: 600;
}

.fc-mkt-table__coin {
    display: flex;
    align-items: center;
    gap: var(--fc-spacing-md);
    color: inherit;
    text-decoration: none;
}

.fc-mkt-table__coin--nolink {
    pointer-events: none;
}

.fc-mkt-table__icon {
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
}

.fc-mkt-table__names {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.fc-mkt-table__name {
    font-weight: 600;
    color: var(--fc-text-primary);
}

.fc-mkt-table__symbol {
    font-size: var(--fc-font-size-sm);
    color: var(--fc-text-muted);
    text-transform: uppercase;
}

.fc-mkt-table__coin:hover .fc-mkt-table__name {
    color: var(--fc-gradient-end);
}

.fc-mkt-footnote {
    margin-top: var(--fc-spacing-md);
    font-size: var(--fc-font-size-sm);
    color: var(--fc-text-muted);
    text-align: center;
}

.fc-mkt-content {
    margin-top: var(--fc-spacing-2xl);
}

/* Toolbar: tabs + search + rows */
.fc-mkt-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--fc-spacing-md);
    margin-bottom: var(--fc-spacing-md);
}

.fc-mkt-tabs {
    display: inline-flex;
    gap: 4px;
    background: var(--fc-bg-secondary);
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-full);
    padding: 4px;
}

.fc-mkt-tab {
    border: 0;
    background: transparent;
    color: var(--fc-text-secondary);
    font-weight: 600;
    font-size: var(--fc-font-size-sm);
    padding: 6px 16px;
    border-radius: var(--fc-radius-full);
    cursor: pointer;
    transition: background var(--fc-transition-fast), color var(--fc-transition-fast);
}

.fc-mkt-tab:hover {
    color: var(--fc-text-primary);
}

.fc-mkt-tab.is-active {
    background: var(--fc-gradient-end);
    color: #fff;
}

.fc-mkt-toolbar__right {
    display: flex;
    align-items: center;
    gap: var(--fc-spacing-md);
    flex-wrap: wrap;
}

.fc-mkt-search {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.fc-mkt-search__icon {
    position: absolute;
    left: 12px;
    font-size: 14px;
    opacity: 0.6;
    pointer-events: none;
}

.fc-mkt-search input {
    padding: 8px 14px 8px 34px;
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-full);
    background: var(--fc-bg-secondary);
    color: var(--fc-text-primary);
    font-size: var(--fc-font-size-sm);
    min-width: 200px;
}

.fc-mkt-search input:focus {
    outline: none;
    border-color: var(--fc-gradient-end);
}

.fc-mkt-rows {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fc-font-size-sm);
    color: var(--fc-text-secondary);
    white-space: nowrap;
}

.fc-mkt-rows select {
    padding: 7px 10px;
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-md);
    background: var(--fc-bg-secondary);
    color: var(--fc-text-primary);
    font-size: var(--fc-font-size-sm);
    cursor: pointer;
}

/* Currency filter badges */
.fc-mkt-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--fc-spacing-lg);
}

.fc-mkt-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-full);
    background: var(--fc-bg-secondary);
    color: var(--fc-text-secondary);
    font-weight: 600;
    font-size: var(--fc-font-size-sm);
    cursor: pointer;
    transition: border-color var(--fc-transition-fast), color var(--fc-transition-fast), background var(--fc-transition-fast);
}

.fc-mkt-badge img {
    border-radius: 50%;
    display: block;
}

.fc-mkt-badge:hover {
    color: var(--fc-text-primary);
    border-color: var(--fc-text-muted);
}

.fc-mkt-badge.is-active {
    background: var(--fc-gradient-end);
    border-color: var(--fc-gradient-end);
    color: #fff;
}

/* Favorite star */
.fc-mkt-table__fav {
    width: 36px;
    text-align: center;
}

.fc-mkt-fav {
    border: 0;
    background: transparent;
    color: var(--fc-border-color);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: color var(--fc-transition-fast), transform var(--fc-transition-fast);
}

.fc-mkt-fav:hover {
    transform: scale(1.15);
    color: var(--fc-text-muted);
}

.fc-mkt-fav.is-fav {
    color: #f5b701;
}

/* Circulating supply cell */
.fc-mkt-supply {
    display: inline-flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
    min-width: 120px;
}

.fc-mkt-supply__val {
    font-variant-numeric: tabular-nums;
    color: var(--fc-text-secondary);
}

.fc-mkt-supply__bar {
    width: 100%;
    height: 4px;
    border-radius: var(--fc-radius-full);
    background: var(--fc-border-light);
    overflow: hidden;
}

.fc-mkt-supply__bar > span {
    display: block;
    height: 100%;
    border-radius: var(--fc-radius-full);
    background: var(--fc-gradient-end);
}

.fc-mkt-empty {
    padding: var(--fc-spacing-xl);
    text-align: center;
    color: var(--fc-text-muted);
}

.fc-mkt-row[hidden] {
    display: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .fc-mkt-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .fc-mkt-movers {
        grid-template-columns: 1fr;
    }
}

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

@media (max-width: 640px) {
    .fc-mkt-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .fc-mkt-toolbar__right {
        justify-content: space-between;
    }
    .fc-mkt-search input {
        min-width: 0;
        width: 100%;
    }
    .fc-mkt-table__supply-col {
        display: none;
    }
}

/* ==========================================================================
   Asset page
   ========================================================================== */

.fc-asset {
    padding: var(--fc-spacing-xl) 0 var(--fc-spacing-2xl);
}

.fc-asset-hero {
    margin-bottom: var(--fc-spacing-xl);
}

.fc-asset-hero__top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--fc-spacing-md);
    margin-bottom: var(--fc-spacing-md);
}

.fc-asset-hero__main {
    min-width: 0;
}

@media (min-width: 769px) {
    .fc-asset-hero__top {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        column-gap: var(--fc-spacing-lg);
        row-gap: 0;
    }

    .fc-asset-hero__main {
        display: contents;
    }

    .fc-asset-hero__head {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .fc-asset-hero__price-row {
        grid-column: 1;
        grid-row: 2;
        margin-top: var(--fc-spacing-md);
        margin-bottom: 0;
    }

    .fc-asset-hero__ctas {
        grid-column: 2;
        grid-row: 2;
        align-self: center;
    }
}

.fc-asset-hero__ctas {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 12px;
}

.fc-asset-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 22px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-family: var(--fc-font-body);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.16);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.fc-asset-cta:hover,
.fc-asset-cta:focus-visible {
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.fc-asset-cta--mexc {
    background: #0054e9;
    border-color: rgba(255, 255, 255, 0.14);
}

.fc-asset-cta--bybit {
    background: #161825;
    border-color: rgba(255, 255, 255, 0.08);
}

.fc-asset-cta__logo {
    display: block;
    flex-shrink: 0;
    object-fit: contain;
}

.fc-asset-cta__logo--mexc {
    width: 34px;
    height: auto;
}

.fc-asset-cta__logo--bybit {
    width: 64px;
    height: auto;
}

.fc-asset-cta__label {
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.fc-asset-cta__arrow {
    margin-left: 2px;
    font-size: 1.35rem;
    line-height: 1;
    opacity: 0.95;
}

.fc-asset-hero__head {
    display: flex;
    align-items: center;
    gap: var(--fc-spacing-md);
}

.fc-asset-hero__icon {
    border-radius: 50%;
}

.fc-asset-hero__title {
    font-family: var(--fc-font-heading);
    font-size: var(--fc-font-size-3xl);
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: var(--fc-spacing-sm);
}

.fc-asset-hero__ticker {
    font-size: var(--fc-font-size-lg);
    color: var(--fc-text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.fc-asset-hero__price-row {
    display: flex;
    align-items: baseline;
    gap: var(--fc-spacing-md);
    margin: var(--fc-spacing-md) 0;
}

.fc-asset-hero__price {
    font-family: var(--fc-font-heading);
    font-size: var(--fc-font-size-4xl);
    font-weight: 800;
    color: var(--fc-text-primary);
    font-variant-numeric: tabular-nums;
}

.fc-asset-hero__change {
    font-size: var(--fc-font-size-lg);
    font-weight: 600;
}

.fc-asset-hero__change-label {
    color: var(--fc-text-muted);
    font-weight: 400;
    font-size: var(--fc-font-size-sm);
}

.fc-asset-hero__stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--fc-spacing-md);
    margin-top: var(--fc-spacing-lg);
}

.fc-asset-hero__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--fc-spacing-md);
    background: var(--fc-bg-secondary);
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-md);
}

.fc-asset-hero__stat-label {
    font-size: var(--fc-font-size-xs);
    color: var(--fc-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.fc-asset-hero__stat-value {
    font-weight: 700;
    color: var(--fc-text-primary);
    font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Shared market block (chart + table) - asset page + prediction articles
   ========================================================================== */

.fc-market-block {
    margin: var(--fc-spacing-xl) 0;
    padding: var(--fc-spacing-lg);
    background: var(--fc-bg-secondary);
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-lg);
}

.fc-market-block__heading {
    font-size: var(--fc-font-size-xl);
    margin: 0 0 var(--fc-spacing-md);
}

.fc-asset-chart {
    margin-bottom: var(--fc-spacing-lg);
}

.fc-asset-chart__periods {
    display: flex;
    flex-wrap: wrap;
    gap: var(--fc-spacing-xs);
    margin-bottom: var(--fc-spacing-md);
}

.fc-asset-chart__period {
    padding: 6px 14px;
    border: 1px solid var(--fc-border-color);
    background: transparent;
    color: var(--fc-text-secondary);
    border-radius: var(--fc-radius-full);
    font-size: var(--fc-font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--fc-transition-fast);
}

.fc-asset-chart__period:hover {
    color: var(--fc-text-primary);
    border-color: var(--fc-text-muted);
}

.fc-asset-chart__period.is-active {
    color: #fff;
    background: var(--fc-gradient-end);
    border-color: var(--fc-gradient-end);
}

.fc-asset-chart__canvas-wrap {
    position: relative;
    width: 100%;
    height: 320px;
}

.fc-asset-chart__canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.fc-asset-chart__status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fc-text-muted);
    font-size: var(--fc-font-size-sm);
    pointer-events: none;
}

.fc-asset-chart__tooltip {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    background: var(--fc-bg-header, #1A1A2E);
    color: #fff;
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-md);
    padding: 6px 10px;
    font-size: var(--fc-font-size-xs);
    white-space: nowrap;
    box-shadow: var(--fc-shadow-md);
}

.fc-asset-chart__tooltip strong {
    display: block;
    font-size: var(--fc-font-size-sm);
}

.fc-asset-chart__tooltip span {
    color: rgba(255, 255, 255, 0.7);
}

.fc-market-table {
    width: 100%;
    border-collapse: collapse;
}

.fc-market-table th,
.fc-market-table td {
    padding: var(--fc-spacing-sm) var(--fc-spacing-md);
    border-bottom: 1px solid var(--fc-border-light);
    text-align: left;
}

.fc-market-table th {
    color: var(--fc-text-secondary);
    font-weight: 500;
}

.fc-market-table td {
    text-align: right;
    font-weight: 600;
    color: var(--fc-text-primary);
    font-variant-numeric: tabular-nums;
}

.fc-market-table tr:last-child th,
.fc-market-table tr:last-child td {
    border-bottom: none;
}

.fc-market-block__cta {
    margin: var(--fc-spacing-md) 0 0;
}

.fc-market-block__cta a {
    display: inline-block;
    font-weight: 600;
    color: var(--fc-gradient-end);
}

.fc-asset-content {
    margin: var(--fc-spacing-xl) 0;
}

.fc-asset-related {
    margin-top: var(--fc-spacing-2xl);
}

/* ==========================================================================
   Inline ticker links (auto-inserted in article body)
   ========================================================================== */

a.fc-ticker-link {
    font-weight: 600;
    color: var(--fc-gradient-end);
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
}

a.fc-ticker-link:hover {
    border-bottom-style: solid;
}

/* Inline price badge: BTC ▲ $78,279 */
a.fc-ticker-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.08em 0.6em;
    margin: 0 0.12em;
    border: 1px solid var(--fc-border-color);
    border-radius: var(--fc-radius-full);
    background: var(--fc-bg-secondary);
    font-size: 0.92em;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    text-decoration: none;
    vertical-align: baseline;
    transition: border-color var(--fc-transition-fast), box-shadow var(--fc-transition-fast);
}

a.fc-ticker-badge:hover {
    border-color: var(--fc-text-muted);
    box-shadow: var(--fc-shadow-sm);
}

/* Defeat theme content-link styling that paints anchors with a gradient via
   background-clip:text + transparent fill, which would hide the badge text. */
a.fc-ticker-badge,
a.fc-ticker-badge:hover,
a.fc-ticker-badge .fc-ticker-badge__symbol,
a.fc-ticker-badge .fc-ticker-badge__arrow,
a.fc-ticker-badge .fc-ticker-badge__price {
    background: none;
    background-image: none;
    background-clip: border-box;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: currentColor;
}

a.fc-ticker-badge {
    background: var(--fc-bg-secondary);
}

.fc-ticker-badge__symbol {
    color: var(--fc-text-primary);
    -webkit-text-fill-color: var(--fc-text-primary);
    letter-spacing: 0.01em;
}

.fc-ticker-badge__arrow {
    font-size: 0.8em;
    line-height: 1;
}

.fc-ticker-badge__price {
    font-variant-numeric: tabular-nums;
}

.fc-ticker-badge--up .fc-ticker-badge__arrow,
.fc-ticker-badge--up .fc-ticker-badge__price {
    color: var(--fc-accent-green, #16C784);
    -webkit-text-fill-color: var(--fc-accent-green, #16C784);
}

.fc-ticker-badge--down .fc-ticker-badge__arrow,
.fc-ticker-badge--down .fc-ticker-badge__price {
    color: var(--fc-accent-red, #EA3943);
    -webkit-text-fill-color: var(--fc-accent-red, #EA3943);
}

.fc-ticker-badge--neutral .fc-ticker-badge__price {
    color: var(--fc-text-secondary);
    -webkit-text-fill-color: var(--fc-text-secondary);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 992px) {
    .fc-mkt-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .fc-asset-hero__stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .fc-mkt-movers {
        grid-template-columns: 1fr;
    }
    .fc-asset-hero__ctas {
        width: 100%;
        gap: 10px;
    }
    .fc-asset-cta {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
        max-width: calc(50% - 5px);
        min-height: 48px;
        padding: 0 12px;
        font-size: 0.9375rem;
        gap: 8px;
    }
    .fc-asset-cta__label {
        font-size: 0.9375rem;
    }
    .fc-asset-cta__logo--mexc {
        width: 30px;
    }
    .fc-asset-cta__logo--bybit {
        width: 56px;
    }
    .fc-asset-cta__arrow {
        font-size: 1.2rem;
    }
    .fc-asset-hero__title {
        font-size: var(--fc-font-size-2xl);
    }
    .fc-asset-hero__price {
        font-size: var(--fc-font-size-3xl);
    }
    .fc-asset-chart__canvas-wrap {
        height: 260px;
    }
    .fc-mkt-table th,
    .fc-mkt-table td {
        padding: var(--fc-spacing-sm);
    }
}

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