/*
 * Crowdfunding module styles.
 *
 * Written to sit inside any of the five HYIPLAB skins without carrying its
 * own visual identity. Two rules make that work:
 *
 * 1. Colour comes from the active theme. Every skin's color.php publishes
 *    --base-h / --base-s / --base-l on :root, derived from the admin's
 *    base_color setting, so the accent here is literally the site's accent.
 *    Fallbacks are only used if a skin ever stops publishing them.
 *
 * 2. Surfaces are neutral alphas rather than fixed colours, so the same
 *    markup reads correctly on the light skins (invester, bit_gold) and the
 *    dark ones (hyip_dark, neo_dark, crypto_hyip) without a per-skin
 *    override.
 *
 * Layout primitives (card, row, col, table, badge, progress, btn--base) come
 * from Bootstrap and the skins themselves and are not redefined here.
 */

:root {
    --cf-accent: hsl(var(--base-h, 137), var(--base-s, 98%), var(--base-l, 33%));
    --cf-accent-soft: hsla(var(--base-h, 137), var(--base-s, 98%), var(--base-l, 33%), 0.12);
    --cf-surface: rgba(128, 128, 128, 0.05);
    --cf-border: rgba(128, 128, 128, 0.25);
    --cf-muted: rgba(128, 128, 128, 1);
    --cf-radius: 10px;
}

.cf-accent { color: var(--cf-accent) !important; }
.cf-muted  { color: var(--cf-muted); }

/*
 * Creator-written rich text shown outside the campaign skin — the standalone
 * page a "View more" link leads to when no script is running. Enough to keep
 * long text readable and wide content inside its column; the skin supplies
 * everything else.
 */
.cf-prose { line-height: 1.75; }
.cf-prose > :last-child { margin-bottom: 0; }
.cf-prose img { max-width: 100%; height: auto; border-radius: var(--cf-radius); }
.cf-prose table { width: 100%; display: block; overflow-x: auto; }

/* ---------- Cards ---------- */
.cf-card {
    border: 1px solid var(--cf-border);
    border-radius: var(--cf-radius);
    background: var(--cf-surface);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: border-color .2s ease, transform .2s ease;
}
.cf-card:hover { border-color: var(--cf-accent); transform: translateY(-2px); }
.cf-card__media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--cf-surface); }
.cf-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cf-card__body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; }
.cf-card__title { font-size: 1.05rem; line-height: 1.35; margin: 0; }
.cf-card__title a { color: inherit; text-decoration: none; }
.cf-card__title a:hover { color: var(--cf-accent); }
.cf-card__foot {
    margin-top: auto; padding-top: 10px;
    border-top: 1px solid var(--cf-border);
    display: flex; justify-content: space-between; gap: 10px;
    font-size: .82rem;
}

/* ---------- Chips ---------- */
.cf-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 999px;
    background: var(--cf-accent-soft); color: var(--cf-accent);
    font-size: .74rem; font-weight: 600; letter-spacing: .02em;
    text-decoration: none; white-space: nowrap;
}
.cf-chip--plain { background: var(--cf-surface); color: inherit; border: 1px solid var(--cf-border); }
.cf-card__media .cf-chip { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(4px); }

/* ---------- Funding meter ---------- */
.cf-meter { height: 6px; border-radius: 999px; background: var(--cf-border); overflow: hidden; }
.cf-meter__fill { height: 100%; border-radius: 999px; background: var(--cf-accent); transition: width .4s ease; }
.cf-meter__fill--done { background: #28c76f; }
.cf-stats { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; }
.cf-stats strong { display: block; font-size: .98rem; font-variant-numeric: tabular-nums; }

/* ---------- Reward tiers ---------- */
.cf-reward {
    border: 1px solid var(--cf-border);
    border-radius: var(--cf-radius);
    padding: 16px; margin-bottom: 14px;
    background: var(--cf-surface);
    transition: border-color .2s ease;
}
.cf-reward:hover { border-color: var(--cf-accent); }
.cf-reward.is-selected { border-color: var(--cf-accent); background: var(--cf-accent-soft); }
.cf-reward.is-soldout { opacity: .55; }
.cf-reward__price { font-size: 1.15rem; font-weight: 700; color: var(--cf-accent); }
.cf-reward__meta { font-size: .8rem; display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }

/* ---------- Milestones ---------- */
.cf-timeline { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; }
.cf-timeline::before {
    content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
    width: 2px; background: var(--cf-border);
}
.cf-timeline__item { position: relative; padding-bottom: 22px; }
.cf-timeline__item::before {
    content: ''; position: absolute; left: -26px; top: 5px;
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--cf-border); background: var(--cf-surface);
}
.cf-timeline__item.is-done::before { border-color: #28c76f; background: #28c76f; }
.cf-timeline__item.is-active::before { border-color: var(--cf-accent); background: var(--cf-accent); }

/* ---------- Stat tiles ---------- */
.cf-tile {
    border: 1px solid var(--cf-border); border-radius: var(--cf-radius);
    background: var(--cf-surface); padding: 16px; height: 100%;
}
.cf-tile__label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; margin-bottom: 6px; }
.cf-tile__value { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }

/* ---------- Panel ----------
   A plain bordered surface. Used by the creator screens and the homepage
   blocks for content that is not a campaign card and not a stat tile. */
.cf-panel {
    border: 1px solid var(--cf-border); border-radius: var(--cf-radius);
    background: var(--cf-surface); padding: 20px;
}

/* ---------- Homepage blocks ----------
   The blocks sit inside whichever skin is active, so they set spacing and
   inherit everything else. Nothing here overrides a skin's own rules. */
.cf-home { background: transparent; }
.cf-home .cf-panel { text-align: center; }
.cf-home h3 { margin-bottom: .25rem; }

/* ---------- Vote control ---------- */
.cf-vote { display: inline-flex; align-items: center; gap: 4px; }
.cf-vote__btn {
    border: 1px solid var(--cf-border); border-radius: 6px;
    background: transparent; color: inherit;
    width: 30px; height: 30px; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all .15s ease;
}
.cf-vote__btn:hover { border-color: var(--cf-accent); color: var(--cf-accent); }
.cf-vote__btn.is-active { border-color: var(--cf-accent); background: var(--cf-accent); color: #fff; }
.cf-vote__count { min-width: 30px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.cf-badge-tile { text-align: center; padding: 18px 12px; border: 1px solid var(--cf-border); border-radius: var(--cf-radius); height: 100%; }
.cf-badge-tile i { font-size: 2rem; color: var(--cf-accent); }
.cf-badge-tile.is-locked { opacity: .45; }
.cf-badge-tile.is-locked i { color: var(--cf-muted); }

/* ---------- Comments ---------- */
.cf-comment { border-bottom: 1px solid var(--cf-border); padding: 14px 0; }
.cf-comment:last-child { border-bottom: 0; }
.cf-comment__replies { margin-left: 26px; padding-left: 14px; border-left: 2px solid var(--cf-border); margin-top: 12px; }

/* ---------- Gallery ---------- */
.cf-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.cf-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; }

/* ---------- Leaderboard ---------- */
.cf-rank { font-weight: 700; font-variant-numeric: tabular-nums; width: 2.4rem; display: inline-block; }
.cf-rank--1 { color: #d4af37; }
.cf-rank--2 { color: #aeb6bf; }
.cf-rank--3 { color: #cd7f32; }

/* ---------- Disclosure ---------- */
.cf-notice {
    border: 1px solid var(--cf-border);
    border-left: 3px solid var(--cf-accent);
    border-radius: 6px; padding: 12px 14px; font-size: .86rem;
    background: var(--cf-surface);
}

@media (max-width: 575.98px) {
    .cf-stats { flex-wrap: wrap; }
    .cf-card__foot { flex-direction: column; gap: 4px; }
}

/* ---------- Charts ---------- */

/*
 * Chart.js needs a bounded parent to resize into: with maintainAspectRatio
 * off and no height here, the canvas grows on every resize event instead of
 * fitting. Shorter on phones so the chart does not push the table off screen.
 */
.cf-chartbox {
    position: relative;
    height: 300px;
    width: 100%;
}

@media (max-width: 575.98px) {
    .cf-chartbox { height: 220px; }
}
