/* ═══════════════════════════════════════════════════════════════
   Cert Ticker Widget — Vertical scrolling "RECENT VERIFIED REWARDS"
   Inspired by fxpfirm.com style — fully responsive
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Widget shell ──────────────────────────────────────────── */
.ct-widget {
    --ct-bg:           #0b1120;
    --ct-header-bg:    #0f1729;
    --ct-card:         rgba(17, 27, 46, 0.9);
    --ct-border:       rgba(99, 102, 241, 0.14);
    --ct-accent:       #6366f1;
    --ct-accent2:      #818cf8;
    --ct-green:        #10b981;
    --ct-gold:         #f59e0b;
    --ct-text:         #f1f5f9;
    --ct-muted:        #64748b;
    --ct-secondary:    #94a3b8;
    --ct-font:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --ct-radius:       16px;

    /* Thumb dimensions — match server THUMB_SIZE 280×198 (1.414:1 landscape)
       Overridden per breakpoint below */
    --ct-thumb-w:      90px;
    --ct-thumb-h:      64px;   /* 90 / 1.414 ≈ 64 */
    --ct-card-gap:     8px;
    --ct-card-pad:     10px 13px;
    --ct-vp-height:    360px;

    font-family: var(--ct-font);
    background: var(--ct-bg);
    border-radius: var(--ct-radius);
    border: 1px solid var(--ct-border);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-shadow:
        0 16px 56px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(99, 102, 241, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ── Header ────────────────────────────────────────────────── */
.ct-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px 11px;
    background: var(--ct-header-bg);
    border-bottom: 1px solid var(--ct-border);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.ct-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(99, 102, 241, 0.08) 0%,
        transparent 60%);
    pointer-events: none;
}

.ct-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ct-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ct-green);
    animation: ct-pulse 2.2s ease-in-out infinite;
    flex-shrink: 0;
}

.ct-live-dot.disconnected {
    background: #ef4444;
    animation: none;
}

@keyframes ct-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
    50%       { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
}

.ct-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--ct-text);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ct-badge {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--ct-accent2);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.2px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* ── Scrollport — clips the ticker ────────────────────────── */
.ct-viewport {
    height: var(--ct-vp-height);
    overflow: hidden;
    position: relative;
    flex: 1 1 auto;
}

/* Top & bottom fade masks */
.ct-viewport::before,
.ct-viewport::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 40px;
    z-index: 5;
    pointer-events: none;
}

.ct-viewport::before {
    top: 0;
    background: linear-gradient(to bottom, var(--ct-bg) 0%, transparent 100%);
}

.ct-viewport::after {
    bottom: 0;
    background: linear-gradient(to top, var(--ct-bg) 0%, transparent 100%);
}

/* ── Scroll track ──────────────────────────────────────────── */
.ct-track {
    display: flex;
    flex-direction: column;
    gap: var(--ct-card-gap);
    padding: 10px 10px;
    will-change: transform;
}

.ct-track.ct-animating {
    animation: ct-scroll linear infinite;
}

@keyframes ct-scroll {
    0%   { transform: translateY(0); }
    100% { transform: translateY(var(--ct-scroll-dist, -50%)); }
}

/* Pause on hover */
.ct-viewport:hover .ct-track.ct-animating {
    animation-play-state: paused;
}

/* ── Individual cert card ──────────────────────────────────── */
.ct-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: var(--ct-card-pad);
    background: var(--ct-card);
    border: 1px solid var(--ct-border);
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.ct-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #10b981, #059669);
    border-radius: 10px 0 0 10px;
}

.ct-card:hover {
    border-color: rgba(99, 102, 241, 0.28);
    background: rgba(17, 27, 46, 0.98);
    transform: translateX(3px);
}

.ct-card.ct-new {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.07);
    animation: ct-newFlash 2s ease forwards;
}

@keyframes ct-newFlash {
    to {
        border-color: var(--ct-border);
        box-shadow: none;
    }
}

/* ── Thumb — landscape rectangle matching cert 1.41:1 aspect ratio ── */
.ct-thumb {
    width: var(--ct-thumb-w);
    height: var(--ct-thumb-h);
    /* fallback for browsers without aspect-ratio support */
    aspect-ratio: 280 / 198;
    border-radius: 7px;
    flex-shrink: 0;
    overflow: hidden;
    background: #0b1120; /* matches THUMB_FILL — no white flash */
    border: 1px solid rgba(99, 102, 241, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ct-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;         /* fills the rectangle — minimal crop since aspect ratios match */
    object-position: center;   /* centred — cert content is centred in template */
    border-radius: 6px;
    display: block;
}

.ct-thumb-fallback {
    font-size: 1.4rem;
    line-height: 1;
}

/* ── Card body ─────────────────────────────────────────────── */
.ct-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ct-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ct-accent2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ct-action {
    font-size: 0.75rem;
    color: var(--ct-text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ct-extra-line {
    font-size: 0.72rem;
    color: var(--ct-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.ct-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.ct-time {
    font-size: 0.65rem;
    color: var(--ct-muted);
    flex-shrink: 0;
}

.ct-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--ct-green);
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.ct-verified-badge svg {
    width: 11px;
    height: 11px;
    fill: currentColor;
}

/* ── Amount badge ──────────────────────────────────────────── */
.ct-amount {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 800;
    color: #e0eaff;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    border: 1px solid rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 20px;
    letter-spacing: -0.2px;
    white-space: nowrap;
    text-align: right;
    min-width: 0;
}

/* ── Empty state ───────────────────────────────────────────── */
.ct-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--ct-muted);
    font-size: 0.82rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ct-empty-icon {
    font-size: 2.2rem;
    opacity: 0.4;
}

/* ── Footer ────────────────────────────────────────────────── */
.ct-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--ct-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ct-header-bg);
    flex-shrink: 0;
    gap: 8px;
}

.ct-footer a {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--ct-accent2);
    text-decoration: none;
    letter-spacing: 0.2px;
    transition: color 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.ct-footer a svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
    flex-shrink: 0;
}

.ct-footer a:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

.ct-footer-status {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--ct-green);
    white-space: nowrap;
}

.ct-footer-status.disconnected {
    color: #ef4444;
}

/* ══════════════════════════════════════════════════════════
   Responsive Breakpoints
   ══════════════════════════════════════════════════════════ */

/* ── Desktop / large embed (≥ 640px) ────────────────────── */
@media (min-width: 640px) {
    .ct-widget {
        --ct-thumb-w:   100px;
        --ct-thumb-h:   71px;   /* 100 / 1.414 */
        --ct-vp-height: 380px;
        --ct-card-gap:  8px;
        --ct-card-pad:  10px 14px;
    }
}

/* ── Tablet (360px – 639px) ───────────────────────────── */
@media (max-width: 639px) {
    .ct-widget {
        --ct-thumb-w:   72px;
        --ct-thumb-h:   51px;   /* 72 / 1.414 */
        --ct-vp-height: 320px;
        --ct-card-gap:  7px;
        --ct-card-pad:  9px 12px;
        --ct-radius:    12px;
    }

    .ct-title { font-size: 0.68rem; letter-spacing: 0.5px; }
    .ct-name  { font-size: 0.78rem; }
    .ct-amount { font-size: 0.74rem; padding: 3px 7px; }
}

/* ── Mobile (< 400px) ───────────────────────────────── */
@media (max-width: 399px) {
    .ct-widget {
        --ct-thumb-w:   60px;
        --ct-thumb-h:   42px;   /* 60 / 1.414 */
        --ct-vp-height: 290px;
        --ct-card-gap:  6px;
        --ct-card-pad:  8px 10px;
    }

    /* Stack amount below body on very small screens */
    .ct-card {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .ct-amount {
        margin-left: calc(var(--ct-thumb-w) + 10px);
        font-size: 0.72rem;
        padding: 2px 7px;
    }

    .ct-name   { font-size: 0.76rem; }
    .ct-action { font-size: 0.7rem; }

    .ct-header { padding: 10px 12px 9px; }
    .ct-footer { padding: 7px 12px; }
    .ct-title  { font-size: 0.64rem; }
}
