/* ════════════════════════════════════════════
   MARKET WATCH PANEL
   Source: style.css lines 2768–3252
   ════════════════════════════════════════════ */
.mw-panel {
    position: fixed;
    top: 50px;
    right: 0;
    width: 280px;
    bottom: 0;
    background: var(--ui-panel);
    border-left: 1px solid var(--ui-panel-border);
    display: flex;
    flex-direction: column;
    z-index: 50;
    box-shadow: -4px 0 16px rgba(0,0,0,0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    font-size: 12px;
    transform: translateX(0);
    transition: transform 0.2s ease;
}
.mw-panel.hidden {
    transform: translateX(100%);
    pointer-events: none;
    visibility: hidden;
}

/* Header */
.mw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 36px;
    background: var(--ui-button);
    border-bottom: 1px solid var(--ui-panel-border);
    flex-shrink: 0;
}
.mw-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ui-fg);
    letter-spacing: 0.3px;
}
.mw-close-btn {
    background: transparent;
    border: none;
    color: var(--ui-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
}
.mw-close-btn:hover { background: rgba(239,83,80,0.15); color: #ef5350; }

/* Hint bar */
.mw-hint {
    font-size: 10px;
    color: var(--ui-muted);
    padding: 4px 12px;
    border-bottom: 1px solid var(--ui-panel-border);
    background: var(--ui-panel);
    flex-shrink: 0;
}

/* Table wrapper — scrollable */
.mw-table-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
.mw-table-wrap::-webkit-scrollbar { width: 4px; }
.mw-table-wrap::-webkit-scrollbar-thumb { background: var(--ui-panel-border); border-radius: 2px; }

/* Table */
.mw-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.mw-table thead th {
    position: sticky;
    top: 0;
    background: var(--ui-button);
    color: var(--ui-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 5px 6px;
    border-bottom: 1px solid var(--ui-panel-border);
    text-align: right;
}
.mw-th-sym { text-align: left !important; width: 38%; }
.mw-th-num { width: 20%; }

/* Group header row */
.mw-group-row td {
    padding: 8px 10px 3px;
    font-size: 10px;
    font-weight: 700;
    color: var(--ui-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: var(--ui-panel);
    border-top: 1px solid var(--ui-panel-border);
}

/* Symbol rows */
.mw-row {
    cursor: pointer;
    transition: background 0.1s;
}
.mw-row:hover { background: rgba(38,166,154,0.07); }
.mw-row.mw-selected { background: rgba(38,166,154,0.15); }

.mw-row td {
    padding: 5px 6px;
    border-bottom: 1px solid rgba(128,128,128,0.07);
    color: var(--ui-fg);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mw-sym-cell {
    text-align: left !important;
    display: flex;
    align-items: center;
    gap: 5px;
}
.mw-dir {
    font-size: 9px;
    flex-shrink: 0;
    color: var(--ui-muted);
    min-width: 10px;
}
.mw-sym-name {
    font-weight: 600;
    font-size: 12px;
    color: var(--ui-fg);
}
.mw-num  { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--ui-fg); }
.mw-pct  { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

.mw-up .mw-sym-name { color: #26a69a; }
.mw-dn .mw-sym-name { color: #ef5350; }

/* Footer */
.mw-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    border-top: 1px solid var(--ui-panel-border);
    background: var(--ui-button);
    flex-shrink: 0;
    font-size: 10px;
    color: var(--ui-muted);
}
.mw-live-dot { color: #26a69a; font-size: 10px; }

/* ── Pane active border ── */
.pane-active { z-index: 1; }
.pane-active::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid #26a69a;
    pointer-events: none;
    z-index: 9999;
}

/* Market Watch — no-grid mode */
.mw-no-grid .mw-row td { border-bottom: none; }

/* Popup Prices floating widget */
.mw-popup-price {
    position: fixed;
    bottom: 28px;
    right: 290px;
    background: var(--ui-panel);
    border: 1px solid var(--ui-panel-border);
    border-radius: 6px;
    padding: 12px 16px 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 600;
    min-width: 160px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}
.mw-popup-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ui-fg);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--ui-panel-border);
    padding-bottom: 6px;
}
.mw-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 13px;
    color: var(--ui-muted);
    padding: 3px 0;
}
.mw-dn-val { color: #ef5350; font-weight: 700; font-variant-numeric: tabular-nums; }
.mw-up-val { color: #26a69a; font-weight: 700; font-variant-numeric: tabular-nums; }
.mw-popup-close {
    position: absolute;
    top: 6px; right: 8px;
    background: transparent;
    border: none;
    color: var(--ui-muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.mw-popup-close:hover { color: #ef5350; }

/* ─── Toast notification ─── */
.mw-toast {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #26a69a;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap;
}
.mw-toast.mw-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Specification & Tick-Chart modal overlay ─── */
.mw-spec-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 800;
}
.mw-spec-box {
    background: var(--ui-panel);
    border: 1px solid var(--ui-panel-border);
    border-radius: 6px;
    width: 340px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    overflow: hidden;
}
.mw-spec-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--ui-panel-border);
    background: var(--ui-button);
}
.mw-spec-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ui-fg);
}
.mw-spec-close {
    background: transparent;
    border: none;
    color: var(--ui-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
    line-height: 1;
}
.mw-spec-close:hover { background: rgba(239,83,80,0.15); color: #ef5350; }

/* Specification table */
.mw-spec-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}
.mw-spec-table tr:nth-child(even) { background: rgba(128,128,128,0.04); }
.mw-spec-key {
    padding: 7px 16px 7px 16px;
    font-size: 12px;
    color: var(--ui-muted);
    font-weight: 500;
    width: 40%;
    white-space: nowrap;
}
.mw-spec-val {
    padding: 7px 16px;
    font-size: 13px;
    color: var(--ui-fg);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Specification / Tick footer */
.mw-spec-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--ui-panel-border);
    background: var(--ui-button);
}
.mw-spec-btn {
    padding: 6px 16px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid var(--ui-panel-border);
    background: var(--ui-button);
    color: var(--ui-fg);
    transition: background 0.1s;
}
.mw-spec-btn:hover { background: var(--ui-button-hover); }
.mw-spec-chart-btn {
    background: var(--ui-primary, #2962ff);
    border-color: var(--ui-primary, #2962ff);
    color: #fff;
}
.mw-spec-chart-btn:hover { background: var(--ui-primary, #2962ff); border-color: var(--ui-primary, #2962ff); opacity: 0.9; }

/* Tick chart popup */
.mw-tick-body {
    padding: 14px 16px 10px;
}
.mw-tick-prices {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}
.mw-tick-bid, .mw-tick-ask, .mw-tick-spread {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.mw-tick-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--ui-muted);
    text-transform: uppercase;
}
.mw-tick-val {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.mw-tick-spread span:last-child {
    font-size: 16px;
    font-weight: 600;
    color: var(--ui-fg);
}
.mw-tick-canvas {
    display: block;
    width: 100%;
    height: 140px;
    border-radius: 4px;
    border: 1px solid var(--ui-panel-border);
}
.mw-tick-status {
    font-size: 10px;
    color: var(--ui-muted);
    text-align: center;
    margin-top: 6px;
}
