/* TOKEN MARKET page — dark trading terminal (sample screen) */

.token-market-page {
    --tm-bg: #060b1a;
    --tm-panel: #0a1226;
    --tm-border: #14213d;
    --tm-text: #e8eefc;
    --tm-muted: #7d8cae;
    --tm-up: #23d5ab;
    --tm-down: #ff4d6a;
    --tm-accent: #feb900;

    background: var(--tm-bg);
    color: var(--tm-text);
    min-height: 100vh;
    font-variant-numeric: tabular-nums;
}

/* main.css styles bare <section> with its own color/background; override for the dark page */
.tm-hero,
.tm-wrap {
    color: var(--tm-text);
    background-color: transparent;
}

.token-market-page .up { color: var(--tm-up); }
.token-market-page .down { color: var(--tm-down); }
.token-market-page button { font-family: inherit; }

/* Hero title */
.tm-hero {
    padding: 110px 24px 28px;
    text-align: center;
    background: linear-gradient(180deg, #060b1a 0%, #08102a 100%);
}

.tm-hero h1 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 700;
    color: #fff;
}

.tm-wrap {
    /* width comes from Bootstrap .container so it matches the footer */
    padding-top: 8px;
    padding-bottom: 80px;
}

/* Layout */
.tm-grid {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr) 350px;
    grid-template-areas:
        "list chart order"
        "list book  order"
        "list pf    pf";
    gap: 20px;
    align-items: start;
}

.tm-list-panel { grid-area: list; align-self: stretch; }
.tm-chart-panel { grid-area: chart; }
.tm-book-panel { grid-area: book; }
.tm-order-panel { grid-area: order; align-self: stretch; }
.tm-portfolio { grid-area: pf; }

.tm-panel {
    background: var(--tm-panel);
    border: 1px solid var(--tm-border);
    border-radius: 14px;
    padding: 18px;
}

/* Logos */
.tm-logo {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
}

/* Symbol list */
.tm-search {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    padding: 0 14px;
    height: 46px;
    border: 1px solid var(--tm-border);
    border-radius: 10px;
    background: #081022;
    color: var(--tm-muted);
}

.tm-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--tm-text);
    font-size: 0.95rem;
}

.tm-search input::placeholder { color: var(--tm-muted); }

.tm-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tm-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.tm-item:hover { background: #0d1a34; }

.tm-item.active {
    background: #0e2247;
    border-color: #1d3d78;
}

.tm-item-name { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tm-item-name strong { font-size: 1rem; }
.tm-item-name span { font-size: 0.82rem; color: var(--tm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-item-px { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.tm-item-px strong { font-size: 0.98rem; }
.tm-item-px span { font-size: 0.85rem; }

.tm-empty { padding: 20px; text-align: center; color: var(--tm-muted); }

/* Chart header */
.tm-chart-head {
    display: flex;
    align-items: center;
    gap: 40px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--tm-border);
}

.tm-asset { display: flex; align-items: center; gap: 16px; }
.tm-sym { font-size: 1.7rem; font-weight: 700; letter-spacing: 0.02em; line-height: 1.1; }
.tm-name { color: var(--tm-muted); margin-top: 2px; }

.tm-link {
    margin-left: 6px;
    font-size: 1rem;
    color: var(--tm-muted);
    transition: color 0.15s;
}

.tm-link:hover { color: var(--tm-accent); }

.tm-price { font-size: 2rem; font-weight: 600; line-height: 1.1; }
.tm-change { font-size: 1.05rem; font-weight: 600; margin-top: 4px; }
.tm-change.up { color: var(--tm-up); }
.tm-change.down { color: var(--tm-down); }

.tm-badge {
    margin-left: auto;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border: 1px solid #16806b;
    border-radius: 999px;
    background: rgba(35, 213, 171, 0.08);
    color: var(--tm-up);
    font-size: 0.82rem;
}

.tm-badge-info { color: var(--tm-muted); cursor: help; }

/* Timeframe */
.tm-tf {
    display: flex;
    gap: 6px;
    margin: 16px 0 12px;
}

.tm-tf button {
    min-width: 52px;
    padding: 8px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tm-muted);
    font-size: 0.9rem;
    cursor: pointer;
}

.tm-tf button:hover { color: var(--tm-text); }
.tm-tf button.active { background: #1b3055; color: #fff; }

.tm-chart {
    height: 340px;
    width: 100%;
    overflow: hidden;
}

.tm-chart svg { display: block; }

/* Order book */
.tm-book-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.tm-book-side:first-child {
    padding-right: 28px;
    border-right: 1px solid var(--tm-border);
}

.tm-book-side:last-child { padding-left: 28px; }

.tm-book-side h3 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 700;
}

.tm-book-side h3.buy { color: var(--tm-up); }
.tm-book-side h3.sell { color: var(--tm-down); }

.tm-book { width: 100%; border-collapse: collapse; }
.tm-book th { padding: 8px 4px; font-weight: 400; font-size: 0.88rem; color: var(--tm-muted); border-bottom: 1px solid var(--tm-border); }
.tm-book td { padding: 8px 4px; border-bottom: 1px solid #0f1b33; }
.tm-book .r { text-align: right; }
.tm-book tr[data-price] { cursor: pointer; }
.tm-book tr[data-price]:hover { background: rgba(255, 255, 255, 0.04); }

/* Order form */
.tm-side {
    display: flex;
    background: #101c37;
    border-radius: 10px;
    overflow: hidden;
}

.tm-side button {
    flex: 1;
    padding: 16px 0;
    border: 0;
    background: transparent;
    color: var(--tm-muted);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
}

.tm-side button.active.buy { background: var(--tm-up); color: #04231c; }
.tm-side button.active.sell { background: var(--tm-down); color: #2b0510; }

.tm-type {
    display: flex;
    margin: 16px 0 22px;
    border: 1px solid var(--tm-border);
    border-radius: 10px;
    background: #081022;
}

.tm-type button {
    flex: 1;
    padding: 13px 0 11px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--tm-muted);
    font-size: 1rem;
    cursor: pointer;
}

.tm-type button.active {
    color: #fff;
    border-bottom-color: var(--tm-up);
}

.tm-field { margin-bottom: 22px; }
.tm-field[hidden] { display: none; }

.tm-field-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tm-token {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid var(--tm-border);
    border-radius: 10px;
    background: #081022;
    font-weight: 600;
}

.tm-token .bi { font-size: 0.8rem; color: var(--tm-muted); margin-left: 6px; }

.tm-field input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid var(--tm-border);
    border-radius: 10px;
    background: #081022;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
}

.tm-field input:focus {
    outline: none;
    border-color: #1d5f8a;
}

.tm-field input[readonly] { cursor: default; }

.tm-field-sub {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--tm-muted);
}

.tm-field-sub a { color: #2f8dff; text-decoration: none; }
.tm-field-sub a:hover { text-decoration: underline; }

.tm-submit {
    width: 100%;
    height: 56px;
    border: 0;
    border-radius: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}

.tm-submit:hover { opacity: 0.9; }
.tm-submit.buy { background: var(--tm-up); color: #04231c; }
.tm-submit.sell { background: var(--tm-down); color: #2b0510; }

/* Portfolio */
.tm-portfolio h3 { margin: 0 0 18px; font-size: 1.15rem; font-weight: 700; color: var(--tm-text); }

.tm-pf-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr auto;
    align-items: center;
    gap: 0;
}

.tm-pf-row > * { padding: 4px 32px; }
.tm-pf-row > :first-child { padding-left: 0; }
.tm-pf-item { display: flex; align-items: center; gap: 16px; border-left: 1px solid var(--tm-border); }

.tm-pf-label { color: var(--tm-muted); font-size: 0.92rem; }
.tm-pf-value { font-size: 1.7rem; font-weight: 700; margin: 4px 0; }
.tm-pf-chg { font-size: 0.95rem; font-weight: 600; }
.tm-pf-chg.up { color: var(--tm-up); }
.tm-pf-chg.down { color: var(--tm-down); }
.tm-pf-main { font-size: 1.2rem; font-weight: 600; margin: 2px 0; }
.tm-pf-sub { font-size: 0.85rem; color: var(--tm-muted); }

.tm-viewall {
    justify-self: end;
    padding: 12px 22px !important;
    border: 1px solid #1d3d78;
    border-radius: 8px;
    background: #0a1a38;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.tm-viewall:hover { background: #0e2247; color: #fff; }

.tm-disclaimer {
    margin: 24px 0 0;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #5f6e8f;
}

/* Responsive */
@media (max-width: 1399px) {
    .tm-grid {
        grid-template-columns: minmax(0, 1fr) 360px;
        grid-template-areas:
            "list  list"
            "chart order"
            "book  order"
            "pf    pf";
    }

    .tm-list-panel { align-self: start; }
    .tm-list { flex-direction: row; overflow-x: auto; }
    .tm-item { flex: 0 0 260px; }
}

@media (max-width: 900px) {
    .tm-hero h1 { font-size: 1.4rem; }
    .tm-wrap { padding-bottom: 60px; }

    .tm-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "list"
            "chart"
            "order"
            "book"
            "pf";
    }

    .tm-chart-head { flex-wrap: wrap; gap: 16px 28px; }
    .tm-badge { margin-left: 0; }
    .tm-chart { height: 280px; }

    .tm-book-panel { grid-template-columns: 1fr; gap: 24px; }
    .tm-book-side:first-child { padding-right: 0; border-right: 0; }
    .tm-book-side:last-child { padding-left: 0; }

    .tm-pf-row { grid-template-columns: 1fr; gap: 16px; }
    .tm-pf-row > * { padding: 0; }
    .tm-pf-item { border-left: 0; }
    .tm-viewall { justify-self: start; }
}
