/* ──────────────────────────────────────────────────────────────────────────
   P2Pex TradingView-style chart panel (built on lightweight-charts).
   Shared by the home trade-history chart and the admin server-stats chart so
   both look like a real exchange / TradingView chart (legend overlay, top
   toolbar, bottom range bar + UTC clock).
   ────────────────────────────────────────────────────────────────────────── */

.tvc-panel {
    background: #0c0e15;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: #d1d4dc;
}

/* ── Top toolbar ─────────────────────────────────────────────────────────── */
.tvc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding: 7px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.015);
}

.tvc-tb-left,
.tvc-tb-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tvc-sym {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: .3px;
    color: #eaecef;
}

.tvc-sym-sub {
    font-size: .8rem;
    color: #9aa0ac;
}

.tvc-flag {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 auto;
}

.tvc-live {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .66rem;
    color: #9aa0ac;
}

.tvc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #26a69a;
    box-shadow: 0 0 0 0 rgba(38, 166, 154, .6);
    animation: tvcpulse 1.8s infinite;
}

@keyframes tvcpulse {
    0% { box-shadow: 0 0 0 0 rgba(38, 166, 154, .55); }
    70% { box-shadow: 0 0 0 7px rgba(38, 166, 154, 0); }
    100% { box-shadow: 0 0 0 0 rgba(38, 166, 154, 0); }
}

/* Segmented control (interval / type / metric) */
.tvc-seg {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    padding: 2px;
}

.tvc-seg-btn {
    background: transparent;
    border: none;
    color: #9aa0ac;
    border-radius: 7px;
    padding: 4px 10px;
    font-size: .76rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background .12s, color .12s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tvc-seg-btn:hover { color: #d1d4dc; background: rgba(255, 255, 255, 0.05); }
.tvc-seg-btn.on { background: #2962ff; color: #fff; }

/* A standalone select styled like the toolbar (used for metric/currency pick) */
.tvc-select {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #eaecef;
    border-radius: 9px;
    padding: 5px 10px;
    font-size: .8rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.tvc-select option { background: #0c0e15; color: #eaecef; }

.tvc-tb-label {
    font-size: .68rem;
    color: #787b86;
    font-weight: 600;
}

/* ── Chart host + legend overlay ─────────────────────────────────────────── */
.tvc-host {
    position: relative;
    width: 100%;
    background: #0c0e15;
}

.tvc-canvas { width: 100%; }

.tvc-legend {
    position: absolute;
    top: 8px;
    left: 12px;
    z-index: 4;
    pointer-events: none;
    direction: ltr;
    text-align: left;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
    max-width: calc(100% - 70px);
}

.tvc-lg-row1 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: .8rem;
}

.tvc-lg-sym { font-weight: 800; color: #eaecef; }
.tvc-lg-sub { color: #9aa0ac; font-size: .74rem; }

.tvc-lg-badge {
    background: rgba(255, 255, 255, 0.08);
    color: #cfd3dc;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: .66rem;
    font-weight: 700;
}

.tvc-ohlc { display: inline-flex; gap: 9px; flex-wrap: wrap; }
.tvc-ohlc span { display: inline-flex; gap: 3px; }
.tvc-ohlc i { color: #787b86; font-style: normal; }
.tvc-ohlc b { font-weight: 700; }
.tvc-ohlc.up b, .tvc-chg.up { color: #26a69a; }
.tvc-ohlc.down b, .tvc-chg.down { color: #ef5350; }
.tvc-chg { font-weight: 700; }

.tvc-lg-row2 {
    margin-top: 2px;
    font-size: .72rem;
    color: #787b86;
}
.tvc-lg-row2 b { color: #9aa0ac; font-weight: 700; }

.tvc-val { font-size: .9rem; }
.tvc-val b { font-weight: 800; color: #eaecef; }
.tvc-val i { color: #787b86; font-style: normal; font-size: .76rem; margin-inline-start: 2px; }

/* ── Bottom bar (range buttons + clock) ──────────────────────────────────── */
.tvc-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding: 5px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.015);
}

.tvc-ranges { display: inline-flex; gap: 1px; flex-wrap: wrap; }

.tvc-range-btn {
    background: transparent;
    border: none;
    color: #787b86;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s, color .12s;
}

.tvc-range-btn:hover { color: #d1d4dc; background: rgba(255, 255, 255, 0.05); }
.tvc-range-btn.on { color: #fff; background: rgba(41, 98, 255, .35); }

.tvc-clock {
    font-size: .72rem;
    color: #787b86;
    font-variant-numeric: tabular-nums;
    direction: ltr;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.tvc-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
    color: #787b86;
    font-size: .82rem;
    z-index: 3;
}

@media (max-width: 560px) {
    .tvc-sym-sub { display: none; }
    .tvc-seg-btn { padding: 4px 8px; font-size: .72rem; }
    .tvc-legend { font-size: .72rem; }
    .tvc-lg-row1 { gap: 6px; }
}
