/* The line-movement popover, the dark hover panel and the chart icon
   (scripts/line-movement.js), ONE copy for every page with odds cells: the
   Odds page (and its embed, the matchup odds strip, the dashboard widget) and
   the Player Stats lines bar. Since 2026-11-01; the rules are the ones
   odds-tracker.css held. */

/* --- the chart icon, and the cell that opens the chart --- */
.chart-icon {
    color: var(--tmb-blue);
    cursor: pointer;
    transition: color 0.15s, opacity 0.15s, transform 0.15s;
    opacity: 0.75;
    flex-shrink: 0;
    vertical-align: middle;
}
/* The whole cell opens the chart, not just the 12px icon, so the whole cell
   says so on hover. A cell without data has no icon and stays inert. In a
   chip row (the Player Stats bar, whose row picks the chart's book) the icon
   alone opens it, so the cell is not tinted there. */
.odds-cell:has(.chart-icon),
.prop-cell:has(.chart-icon) {
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s;
}
.odds-cell:has(.chart-icon):not(.tmb-chip-body):hover,
.prop-cell:has(.chart-icon):not(.tmb-chip-body):hover,
.odds-cell.lm-active,
.prop-cell.lm-active {
    background-color: color-mix(in srgb, var(--tmb-blue) 8%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tmb-blue) 45%, transparent);
}
.odds-cell:hover .chart-icon,
.prop-cell:hover .chart-icon,
.lm-active .chart-icon {
    color: color-mix(in srgb, var(--tmb-blue), black 30%);
    opacity: 1;
    transform: scale(1.15);
}

/* --- the popover --- */
.line-movement-popover {
    display: none;
    position: absolute;
    z-index: 1050;
    background: #fff;
    border: 1px solid var(--tmb-gray-300);
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--tmb-black-15);
    padding: 8px 10px;
    pointer-events: auto;
}
.line-movement-popover .popover-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.line-movement-popover .popover-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--tmb-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.line-movement-popover .popover-close {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: var(--tmb-gray-600);
    padding: 0 2px;
    margin-left: 8px;
}
.line-movement-popover .popover-close:hover { color: var(--tmb-gray-900); }
.line-movement-popover .popover-body {
    display: flex;
    gap: 10px;
}
.line-movement-popover .chart-wrap {
    position: relative;
    width: 260px;
    height: 220px;
    flex-shrink: 0;
}
.line-movement-popover canvas { display: block; }
.line-movement-popover .books-panel {
    min-width: 200px;
    max-width: 260px;
    overflow-y: auto;
    font-size: 11px;
    border-left: 1px solid var(--tmb-gray-300);
    padding-left: 8px;
}
.line-movement-popover .books-panel-header {
    font-weight: 600;
    font-size: 11px;
    color: var(--tmb-gray-900);
    margin-bottom: 4px;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--tmb-gray-300);
    white-space: nowrap;
}
.line-movement-popover .bp-row {
    display: flex;
    align-items: baseline;
    padding: 1px 0;
    font-size: 10.5px;
    line-height: 1.5;
    gap: 4px;
}
.line-movement-popover .bp-book { color: var(--tmb-gray-600); white-space: nowrap; }
.line-movement-popover .bp-val {
    font-weight: 500;
    color: var(--tmb-gray-900);
    white-space: nowrap;
    margin-left: auto;
}
.line-movement-popover .bp-juice {
    font-size: 10px;
    color: var(--tmb-gray-600);
    white-space: nowrap;
    margin-left: 4px;
}
.line-movement-popover .popover-loading,
.line-movement-popover .popover-empty {
    display: none;
    text-align: center;
    padding-top: 55px;
    color: var(--tmb-gray-600);
    font-size: 12px;
}
.line-movement-popover.loading .popover-body { display: none; }
.line-movement-popover.loading .popover-loading { display: block; }
.line-movement-popover.empty .popover-body { display: none; }
.line-movement-popover.empty .popover-empty { display: block; }

/* On a phone the popover is a sheet along the bottom of the screen: as a
   popup beside the tapped cell it was 516px wide on a 375px screen.
   !important: positionPopover() writes top / left inline. */
@media (max-width: 767px) {
    body .line-movement-popover {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0;
        bottom: 0;
        max-height: 80vh;
        overflow-y: auto;
        border-radius: 12px 12px 0 0;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 16px var(--tmb-black-20);
        z-index: 1060;
    }
    body .line-movement-popover .popover-body {
        flex-direction: column;
        align-items: center;
    }
    body .line-movement-popover .books-panel {
        width: 100%;
        min-width: 0;
        max-width: none;
        border-left: 0;
        padding-left: 0;
        border-top: 1px solid var(--tmb-gray-300);
        padding-top: 8px;
    }
    body .line-movement-popover .popover-close {
        font-size: 26px;
        padding: 0 6px;
    }
}

/* --- the hover panel (data-hold-tip), appended to body --- */
[data-hold-tip] { cursor: help; }
.hold-tooltip {
    position: fixed;
    pointer-events: none;
    background: var(--tmb-gray-900);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.45;
    font-weight: 400;
    white-space: pre-line;
    z-index: 10000;
    min-width: 200px;
    max-width: 340px;
    text-align: left;
    box-shadow: 0 2px 8px var(--tmb-black-20);
}
.hold-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--tmb-gray-900);
}
.hold-tooltip-below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--tmb-gray-900);
}
