/* Event Card landing — tab strip + Order Book panel.
 *
 * Loaded ONLY on /events/{card_id} (card_landing). Palette is the mandated
 * exchange set: bg #0a0e17 / panel rgba(17,24,39,0.6), border
 * rgba(0,150,255,0.15), accent #00cfff, bid #0ecb81 (polished green,
 * operator directive 2026-08-04 — not the platform lime #00ff88), ask #ff4444.
 */

/* ── Tab strip ─────────────────────────────────────────────── */

.ec-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 10px 16px 0;
    background: var(--ec-bg, #0a0e17);
}

.ec-tab {
    flex: 1;
    padding: 11px 10px;
    border: 1px solid rgba(0, 150, 255, 0.15);
    border-radius: 10px;
    background: rgba(17, 24, 39, 0.6);
    color: #7d8fa3;
    font-family: var(--font-display, 'Archivo Black'), sans-serif;
    font-size: 13px;
    letter-spacing: 0.3px;
    line-height: 1;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}

.ec-tab:hover { color: #e0e8f0; }

.ec-tab.is-active {
    color: #00cfff;
    border-color: rgba(0, 207, 255, 0.55);
    background: rgba(0, 207, 255, 0.08);
}

.ec-tab:focus-visible {
    outline: 2px solid #00cfff;
    outline-offset: 2px;
}

/* ── Order Book panel ──────────────────────────────────────── */

.ec-panel-book {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px 16px;
}

.ec-panel-book[hidden] { display: none; }

.eclob-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.eclob-sym {
    font-family: var(--font-display, 'Archivo Black'), sans-serif;
    font-size: 15px;
    color: #e0e8f0;
    word-break: break-all;
}

.eclob-quote { color: #7d8fa3; }

.eclob-quotes {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #e0e8f0;
}

.eclob-q-lbl {
    color: #7d8fa3;
    margin-right: 4px;
}

.eclob-banner {
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 150, 255, 0.15);
    border-radius: 8px;
    background: rgba(17, 24, 39, 0.6);
    color: #7d8fa3;
    font-size: 12px;
    line-height: 1.5;
}

.eclob-banner[hidden] { display: none; }

.eclob-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 900px) {
    .eclob-grid { grid-template-columns: 1.15fr 1fr; }
}

/* ── Ladder ────────────────────────────────────────────────── */

.eclob-ladder {
    border: 1px solid rgba(0, 150, 255, 0.15);
    border-radius: 10px;
    background: rgba(17, 24, 39, 0.6);
    padding: 8px;
}

.eclob-ladder-head,
.eclob-ladder .clob-level {
    display: grid;
    grid-template-columns: 42px 1fr 1fr 46px;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.eclob-ladder-head {
    color: #7d8fa3;
    font-size: 10px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 2px 6px 6px;
}

.eclob-ladder .clob-level {
    padding: 3px 6px;
    border-radius: 4px;
}

/* Asks render ascending; column-reverse floats the best ask nearest the mid. */
.eclob-asks {
    display: flex;
    flex-direction: column-reverse;
}

.eclob-bids { display: flex; flex-direction: column; }

.eclob-ladder .clob-price.text-green,
.eclob-ladder .clob-trade-price.text-green,
.eclob-trades .text-green { color: #0ecb81; }

.eclob-ladder .clob-price.text-red,
.eclob-ladder .clob-trade-price.text-red,
.eclob-trades .text-red { color: #ff4444; }

.eclob-ladder .clob-qty,
.eclob-ladder .clob-depth-pct { color: #e0e8f0; }

.eclob-ladder .clob-depth-pct { color: #7d8fa3; text-align: right; }

.eclob-ladder .clob-badge {
    color: #7d8fa3;
    font-size: 10px;
    text-align: center;
}

.eclob-ladder .clob-badge-amm { color: #3b82f6; }

.eclob-mid-rule {
    height: 1px;
    margin: 6px 2px;
    background: rgba(0, 150, 255, 0.15);
}

.eclob-empty {
    padding: 8px 6px;
    color: #7d8fa3;
    font-size: 11px;
    text-align: center;
}

.eclob-empty[hidden] { display: none; }

/* ── Order entry — pro-terminal treatment ──────────────────────
   Mirrors exchange_pro.html's .trade-panel language exactly (panel,
   trade-tabs, ot-tabs, t-input, btn-buy/btn-sell), scoped under
   .eclob-side so the swipe deck's own chunky mobile styling of the
   shared ec-* classes is untouched everywhere else. */

.eclob-side {
    border: 1px solid var(--panel-border, rgba(0, 150, 255, 0.15));
    border-radius: 8px;
    background: rgba(19, 23, 40, 0.4);
    padding: 12px;
}

/* Micro-label titles (Time & Sales), as the pro terminal's .p-title. */
.eclob-side-title {
    font-family: inherit;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(0, 207, 255, 0.4);
    margin-bottom: 6px;
}

/* Side selector = the panel header: full-width underline tabs flush to
   the panel edges (pro .trade-tabs), not a padded pill toggle. */
.eclob-side .eclob-tabs-side {
    margin: -12px -12px 10px;
    padding: 0;
    gap: 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--panel-border, rgba(0, 150, 255, 0.15));
    border-radius: 0;
}
.eclob-side .eclob-tabs-side .ec-mode-btn {
    min-height: 0;
    padding: 10px 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(0, 207, 255, 0.4);
    transition: color 0.15s, border-color 0.15s;
}
.eclob-side .eclob-tabs-side .ec-mode-btn.is-active {
    background: none;
    box-shadow: none;
    color: #00cfff;
    border-bottom-color: #00cfff;
}

/* Order type = small chips (pro .ot-tab), not full-width pills. */
.eclob-side .eclob-tabs-type {
    padding: 0;
    gap: 4px;
    margin-bottom: 10px;
    background: none;
    border: none;
    border-radius: 0;
}
.eclob-side .eclob-tabs-type .ec-mode-btn {
    flex: 0 0 auto;
    min-height: 0;
    padding: 4px 10px;
    background: none;
    box-shadow: none;
    border: 1px solid var(--panel-border, rgba(0, 150, 255, 0.15));
    border-radius: 3px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(0, 207, 255, 0.4);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.eclob-side .eclob-tabs-type .ec-mode-btn.is-active {
    color: #00cfff;
    border-color: #00cfff;
    background: rgba(0, 207, 255, 0.08);
    box-shadow: none;
}

/* Labels and inputs: dense, dark, tabular (pro .t-label / .t-input). */
.eclob-side .ec-buy-label {
    display: block;
    font-family: inherit;
    font-size: 11px;
    color: rgba(0, 207, 255, 0.4);
    margin: 8px 0 3px;
}
.eclob-side .ec-buy-input {
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border, rgba(0, 150, 255, 0.15));
    border-radius: 5px;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s;
}
.eclob-side .ec-buy-input:focus { border-color: #00cfff; }
.eclob-side .ec-buy-input::placeholder { color: #5a6a7a; font-size: 13px; }

#eclob-price-row[hidden] { display: none; }

/* Total readout (pro .fee-row). */
.eclob-total-row {
    display: flex;
    justify-content: space-between;
    margin: 10px 0 4px;
    font-size: 11px;
    color: rgba(0, 207, 255, 0.4);
    font-variant-numeric: tabular-nums;
}

.eclob-total-row span:last-child { color: #fff; }

/* Submit: the pro terminal's gradient buy/sell buttons, incl. the
   in-flight spinner (JS sets data-busy while the order posts). */
.eclob-submit {
    position: relative;
    width: 100%;
    margin-top: 8px;
    padding: 11px;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    word-break: break-word;
    transition: opacity 0.15s, transform 0.15s;
}

.eclob-submit--buy { background: linear-gradient(135deg, #0ecb81, #0a9e66); color: #fff; }
.eclob-submit--sell { background: linear-gradient(135deg, #ff4444, #cc3333); color: #fff; }
.eclob-submit:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.eclob-submit:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.eclob-submit[data-busy]::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: eclob-btn-spin 0.6s linear infinite;
}
@keyframes eclob-btn-spin { to { transform: rotate(360deg); } }

/* "Open Pro Terminal" — a real button. This page loads ONLY this stylesheet,
   so the event-cards.css .ec-pro-terminal-btn rules never applied here and
   the anchor rendered as a bare text link (operator directive 2026-08-04). */
.eclob-side .ec-pro-terminal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 11px 14px;
    background: rgba(0, 207, 255, 0.10);
    border: 1px solid rgba(0, 207, 255, 0.40);
    border-radius: 6px;
    color: #00cfff;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.eclob-side .ec-pro-terminal-btn:hover {
    background: rgba(0, 207, 255, 0.18);
    border-color: rgba(0, 207, 255, 0.65);
}
.eclob-side .ec-pro-terminal-btn:active { transform: translateY(1px); }

.eclob-placed {
    margin-top: 8px;
    color: #0ecb81;
    font-size: 12px;
}

.eclob-placed[hidden],
#eclob-error[hidden] { display: none; }

.eclob-closed {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid rgba(0, 150, 255, 0.15);
    border-radius: 8px;
    color: #7d8fa3;
    font-size: 12px;
    line-height: 1.5;
}

/* ── Time & Sales ──────────────────────────────────────────── */

.eclob-trades {
    max-height: 220px;
    overflow-y: auto;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.eclob-trades .clob-trade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 42px;
    gap: 6px;
    padding: 2px 4px;
    color: #e0e8f0;
}

.eclob-trades .clob-trade-time { color: #7d8fa3; }

/* ── Status pill ───────────────────────────────────────────── */

.clob-status {
    font-size: 10px;
    letter-spacing: 0.5px;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid rgba(0, 150, 255, 0.15);
    color: #7d8fa3;
}

.clob-status-connected {
    color: #0ecb81;
    border-color: rgba(14, 203, 129, 0.4);
}

/* ── Not-yet-tradable states ───────────────────────────────── */

.eclob-pending {
    border: 1px solid rgba(0, 150, 255, 0.15);
    border-radius: 10px;
    background: rgba(17, 24, 39, 0.6);
    padding: 20px 16px;
    text-align: center;
}

.eclob-pending-title {
    font-family: var(--font-display, 'Archivo Black'), sans-serif;
    font-size: 14px;
    color: #00cfff;
    margin-bottom: 8px;
}

.eclob-pending p {
    margin: 0;
    color: #7d8fa3;
    font-size: 12px;
    line-height: 1.6;
}

/* The deck is a 440px swipe column (a 480px grid column at >=1280px). A
   two-panel order book needs the real page width, so while the book tab is
   open #ec-app drops the deck's width cap and single-column grid. Scoped to
   .ec-book-open so the deck's own layout is untouched. */
body.ec-book-open #ec-app {
    max-width: 1280px !important;
    display: block !important;
    height: auto !important;
    min-height: calc(100dvh - 64px);
    overflow: visible !important;
}

/* On phones the deck hides the global chrome; the book tab needs the page
   to scroll normally instead of being locked to the swipe viewport. */
@media (max-width: 640px) {
    body.ec-book-open #ec-app { height: auto !important; min-height: 100dvh; }
    body.ec-book-open .ec-bottombar,
    body.ec-book-open .ec-auth-cta { display: none !important; }
    body.ec-book-open .ec-tabs { display: flex !important; }
}

/* ── Pro-terminal motion (2026-08-04) ────────────────────────────────
   Rungs are reconciled per-price (vaix-clob-orderbook.js _renderSide):
   an unchanged rung's DOM is never touched, so these animations fire on
   exactly the rung that changed — like a terminal, not a page refresh. */

/* Depth bars glide instead of snapping. The bar is the row's
   background-image sized by background-size (see _applyDepth). */
.eclob-ladder .clob-level {
    transition: background-size 0.25s ease-out;
}

/* One-shot pulse on the changed rung: green = size up / new bid,
   red = size down / new ask. background-color sits UNDER the depth-bar
   background-image, so the pulse and the bar compose cleanly. */
@keyframes eclob-flash-up {
    from { background-color: rgba(14, 203, 129, 0.25); }
    to   { background-color: transparent; }
}
@keyframes eclob-flash-down {
    from { background-color: rgba(255, 68, 68, 0.22); }
    to   { background-color: transparent; }
}
.eclob-ladder .clob-level.eclob-flash-up {
    animation: eclob-flash-up 0.5s ease-out;
}
.eclob-ladder .clob-level.eclob-flash-down {
    animation: eclob-flash-down 0.5s ease-out;
}

/* Newest Time & Sales print pulses once as it lands. */
.eclob-trades .clob-trade-row.eclob-print-up {
    animation: eclob-flash-up 0.6s ease-out;
}
.eclob-trades .clob-trade-row.eclob-print-down {
    animation: eclob-flash-down 0.6s ease-out;
}

/* Motion is information here, but respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
    .eclob-ladder .clob-level { transition: none; }
    .eclob-ladder .clob-level.eclob-flash-up,
    .eclob-ladder .clob-level.eclob-flash-down,
    .eclob-trades .clob-trade-row.eclob-print-up,
    .eclob-trades .clob-trade-row.eclob-print-down { animation: none; }
}

