/* ==========================================================================
   Odds Tracker Page Styles
   Location: /styles/odds-tracker.css
   ========================================================================== */

/* --- Global overrides for front.css --- */
.odds-page button {
    background-color: transparent !important;
    margin-bottom: 0 !important;
}
.odds-page table tr:hover {
    background-color: transparent;
    cursor: default;
}
.odds-page table {
    margin-bottom: 0;
}

/* --- Layout --- */
.odds-page {
    padding-top: 80px;
    padding-bottom: 60px;
    max-width: 100%;
}

/* --- Controls Row --- */
.odds-controls {
    display: flex;
    align-items: center;
}
.odds-controls .btn-group .btn {
    /* Match /players default Bootstrap sizing */
}
.odds-controls .form-control {
    /* Inherits global pill styling from front.css */
}
.odds-controls .gap-2 > * {
    margin-right: 8px;
}

/* --- Book Filter Multiselect --- */
.odds-page .edges-multiselect {
    position: relative;
    display: inline-block;
}
.odds-page .edges-ms-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 0.74rem;
    font-weight: 600;
    border-radius: 20px;
    border: 1px solid #dee2e6;
    background: #fff !important;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}
.odds-page .edges-ms-btn:hover,
.odds-page .edges-ms-btn.open {
    border-color: #007bff;
    color: #007bff;
}
.odds-page .edges-ms-arrow {
    font-size: 0.55rem;
    transition: transform 0.2s;
}
.odds-page .edges-ms-btn.open .edges-ms-arrow {
    transform: rotate(180deg);
}
.odds-page .edges-ms-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 160px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 100;
    padding: 6px 0 0 0;
    overflow: hidden;
}
.odds-page .edges-ms-dropdown.show {
    display: block;
}
.odds-page .edges-ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    font-size: 0.76rem;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
    margin: 0;
    white-space: nowrap;
}
.odds-page .edges-ms-option:hover {
    background: #f0f7ff;
}
.odds-page .edges-ms-actions {
    display: flex;
    border-top: 1px solid #e9ecef;
    margin-top: 4px;
}
.odds-page .edges-ms-select-all,
.odds-page .edges-ms-clear {
    flex: 1;
    padding: 5px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
}
.odds-page .edges-ms-select-all {
    color: #28a745;
    border-right: 1px solid #e9ecef;
}
.odds-page .edges-ms-select-all:hover {
    background: #f0fff4;
}
.odds-page .edges-ms-clear {
    color: #dc3545;
}
.odds-page .edges-ms-clear:hover {
    background: #fff5f5;
}
.odds-page .edges-ms-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* --- Tabs --- */
.odds-tabs {
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 0;
}
.odds-tabs .nav-link {
    font-weight: 600;
    font-size: 14px;
    color: #555;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 20px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.odds-tabs .nav-link:hover {
    color: #007bff;
    border-bottom-color: #007bff;
}
.odds-tabs .nav-link.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: transparent;
}
.odds-attribution {
    display: flex;
    align-items: center;
    padding: 0 10px;
}
.odds-attribution span {
    font-size: 10px;
    color: #bbb;
}
.odds-attribution a {
    color: #bbb;
    text-decoration: underline;
}
.odds-attribution a:hover {
    color: #999;
}

/* --- Table Wrapper --- */
.odds-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e0e0e0;
    border-top: none;
    background: #fff;
}

/* --- Odds Table --- */
.odds-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
    table-layout: auto;
}
.odds-table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #333;
    padding: 8px 10px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* =====================================================
   GAMES TABLE: Sticky columns order = time | rot | team
   Widths: time=70, rot=44, team=170  → total=284
   ===================================================== */
#games-table thead th.time-header {
    text-align: center;
    width: 70px;
    min-width: 70px;
    position: sticky;
    left: 0;
    z-index: 4;
    background: #f8f9fa;
}
#games-table thead th.rot-header {
    text-align: center;
    width: 44px;
    min-width: 44px;
    position: sticky;
    left: 70px;
    z-index: 4;
    background: #f8f9fa;
}
#games-table thead th.game-info-header {
    text-align: left;
    min-width: 170px;
    position: sticky;
    left: 114px;
    z-index: 4;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
}
/* Date label in header row */
th.date-in-header {
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
#games-table tbody td.time-cell {
    background: #fff;
    position: sticky;
    left: 0;
    z-index: 1;
    width: 70px;
    min-width: 70px;
    padding: 6px 6px;
}
#games-table tbody td.rot-cell {
    text-align: center;
    background: #fff;
    position: sticky;
    left: 70px;
    z-index: 1;
    width: 44px;
    min-width: 44px;
    padding: 6px 4px;
}
#games-table tbody td.game-info {
    text-align: left;
    font-weight: 600;
    background: #fff;
    position: sticky;
    left: 114px;
    z-index: 1;
    min-width: 170px;
    border-right: 2px solid #dee2e6;
}

/* =====================================================
   PROPS TABLE: Sticky columns order = time | player
   Widths: time=70, player=200  → total=270
   ===================================================== */
#props-table thead th.time-header {
    text-align: center;
    width: 70px;
    min-width: 70px;
    position: sticky;
    left: 0;
    z-index: 4;
    background: #f8f9fa;
}
#props-table thead th.player-info-header {
    text-align: left;
    min-width: 200px;
    position: sticky;
    left: 70px;
    z-index: 4;
    background: #f8f9fa;
    border-right: 2px solid #dee2e6;
}
#props-table tbody td.time-cell {
    background: #fff;
    position: sticky;
    left: 0;
    z-index: 1;
    width: 70px;
    min-width: 70px;
    padding: 6px 6px;
}
#props-table tbody td.player-info {
    text-align: left;
    font-weight: 600;
    background: #fff;
    position: sticky;
    left: 70px;
    z-index: 1;
    border-right: 2px solid #dee2e6;
    min-width: 200px;
}

/* Book header columns */
.odds-table thead th.book-header {
    min-width: 100px;
}
.book-logo {
    vertical-align: middle;
    object-fit: contain;
    border-radius: 3px;
}
.book-header .book-logo {
    margin-right: 3px;
}
.best-book-col .book-logo {
    margin-right: 2px;
}

/* Body cells default */
.odds-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    text-align: center;
    vertical-align: middle;
    transition: background-color 0.3s ease;
}

/* --- Time cell shared styles --- */
.time-date {
    font-size: 11px;
    font-weight: 600;
    color: #444;
    line-height: 1.4;
}
.time-clock {
    font-size: 10px;
    color: #888;
    line-height: 1.4;
}

/* --- Rotation numbers --- */
.rot-num {
    font-size: 11px;
    color: #999;
    font-weight: 400;
    line-height: 1.6;
    min-width: 36px;
    text-align: center;
}

/* Game date separator row */
.odds-table .date-separator td {
    background: #f0f2f5;
    font-weight: 700;
    font-size: 11px;
    color: #666;
    padding: 2px 10px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    border-top: 1px solid #dee2e6;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.3;
}

/* --- Team Logos --- */
.team-logo {
    vertical-align: middle;
    object-fit: contain;
    margin-right: 6px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* --- Player Headshots --- */
.player-headshot {
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    flex-shrink: 0;
}

/* Game team rows */
.game-team-row {
    display: flex;
    align-items: center;
    line-height: 1.6;
}
.team-name {
    font-size: 12px;
    color: #222;
    font-weight: 600;
}

/* Player info styling */
.player-info-row {
    display: flex;
    align-items: center;
}
.player-details {
    flex: 1;
    min-width: 0;
}
.player-name {
    font-weight: 600;
    font-size: 12px;
    color: #222;
}
.player-meta {
    font-size: 10px;
    color: #888;
    margin-top: 1px;
    display: flex;
    align-items: center;
    gap: 3px;
}
.player-meta .team-logo {
    margin-right: 2px;
}

/* --- Odds Cell Formatting --- */
.odds-cell {
    min-width: 90px;
}
.game-odds-row {
    display: grid;
    grid-template-columns: 40px 1fr;
    align-items: center;
    gap: 2px;
    line-height: 1.6;
    white-space: nowrap;
}
.game-line-col {
    font-weight: 600;
    font-size: 12px;
    color: #222;
    text-align: right;
}
.game-price-col {
    font-size: 11px;
    color: #777;
    text-align: left;
}
.game-price-col.positive,
.game-price-col.negative {
    color: #555;
}
.odds-cell .odds-line {
    font-weight: 600;
    font-size: 12px;
    color: #222;
}
.odds-cell .odds-price {
    font-size: 11px;
    color: #555;
    margin-top: 1px;
}
.odds-cell .odds-price.positive,
.odds-cell .odds-price.negative {
    color: #555;
}
.odds-cell.no-data {
    color: #ccc;
}

/* Props: over/under stacked */
.prop-cell {
    min-width: 90px;
}
.prop-cell .prop-over,
.prop-cell .prop-under {
    font-size: 11px;
    line-height: 1.4;
}
.prop-cell .prop-over {
    color: #555;
}
.prop-cell .prop-under {
    color: #555;
}
.prop-cell .prop-line {
    font-weight: 600;
    font-size: 12px;
    color: #222;
}

/* --- Flash Animation for Changed Odds --- */
@keyframes odds-flash {
    0% {
        background-color: rgba(255, 235, 59, 0.5);
    }
    83% {
        background-color: rgba(255, 235, 59, 0.5);
    }
    100% {
        background-color: transparent;
    }
}

.odds-changed {
    animation: odds-flash 6s ease-out forwards;
}

/* --- Empty / Loading States --- */
.odds-table .loading-row td,
.odds-table .empty-row td {
    text-align: center;
    padding: 30px 10px;
    color: #999;
    font-size: 14px;
    font-style: italic;
}

/* --- Best Line Highlighting (per-line, not per-cell) --- */
.odds-cell .best-line,
.prop-cell .best-line,
.game-odds-row.best-line {
    background-color: rgba(0, 189, 76, 0.10);
    border-left: 2px solid #00bd4c;
    padding-left: 4px;
    margin-left: -6px;
    border-radius: 2px;
}

/* --- Best Line Summary Column --- */
.best-header,
.hold-header {
    font-size: 11px !important;
    min-width: 70px;
}
.best-header {
    min-width: 110px;
    border-left: 2px solid #dee2e6;
}
.best-summary-cell {
    min-width: 110px;
    border-left: 2px solid #dee2e6;
    background: rgba(0, 189, 76, 0.04);
}
.best-row {
    display: grid;
    grid-template-columns: 46px 40px 1fr;
    align-items: center;
    gap: 2px;
    line-height: 1.6;
    white-space: nowrap;
}
.best-line-col {
    font-weight: 600;
    font-size: 12px;
    color: #222;
    text-align: right;
}
.best-price-col {
    font-size: 11px;
    color: #777;
    text-align: right;
}
.best-book-col {
    font-size: 9px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: left;
}
.best-line-col.best-over,
.best-price-col.best-over {
    color: #555;
}
.best-line-col.best-under,
.best-price-col.best-under {
    color: #555;
}

/* --- Hold Column --- */
.hold-cell {
    min-width: 60px;
    text-align: center;
    vertical-align: middle;
    border-right: 2px solid #dee2e6;
}
.hold-value {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

/* --- Arb Opportunity --- */
.arb-cell {
    background: rgba(0, 189, 76, 0.08);
    cursor: help;
    position: relative;
}
.arb-value {
    color: #00bd4c !important;
    font-weight: 700;
}
.arb-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: #00bd4c;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 2px;
    animation: arb-pulse 1.5s ease-in-out infinite;
}

@keyframes arb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Hold info icon */
.hold-info-icon {
    font-size: 9px;
    color: #bbb;
    margin-left: 2px;
    vertical-align: middle;
}

/* Hold tooltip (JS-based, appended to body) */
.hold-cell[data-hold-tip] {
    cursor: help;
}
.hold-tooltip {
    position: fixed;
    background: #222;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 400;
    white-space: pre-line;
    z-index: 10000;
    min-width: 200px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    pointer-events: none;
}
.hold-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #222;
}
.hold-tooltip-below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #222;
}

/* Conversion methodology tooltip */
.conversion-info {
    display: inline-block;
    cursor: help;
    font-size: 13px;
    color: #888;
    vertical-align: middle;
    margin-left: 4px;
}
.conversion-info:hover {
    color: #333;
}
.conv-tooltip {
    position: fixed;
    background: #222;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    z-index: 10000;
    max-width: 380px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    pointer-events: none;
}

/* --- Conversions Tab --- */
.conversions-wrap {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    padding: 20px;
}
.conversions-title {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    margin-bottom: 4px;
}
.conversions-subtitle {
    font-size: 12px;
    color: #888;
    margin-bottom: 16px;
}
.conversion-table {
    width: auto;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 24px;
}
.conversion-table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #333;
    padding: 8px 14px;
    text-align: center;
    white-space: nowrap;
}
.conversion-table tbody td {
    padding: 5px 14px;
    border-bottom: 1px solid #eee;
    text-align: center;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
}
.conversion-table tbody tr:hover {
    background-color: #f5f8ff;
}
.conversion-table .col-spread {
    font-weight: 700;
    color: #222;
}
.conversion-table .col-dog {
    color: #555;
}
.conversion-table .col-fav {
    color: #555;
}
.conversion-table .col-pct {
    color: #666;
    font-size: 11px;
}

/* Conversion tables side-by-side grid */
.conversion-grid {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.conversion-section {
    flex: 1;
    min-width: 280px;
}

/* MLB conversions layout */
.mlb-conversion-grid {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}
.mlb-conversion-section {
    flex: 1;
    min-width: 250px;
}
.mlb-conversion-section h4 {
    font-size: 13px;
    font-weight: 700;
    color: #444;
    margin-bottom: 10px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-wrapper > .odds-page {
        padding: 10px 16px !important;
    }
    /* content-wrapper + btn sizing handled by front.css */
    .odds-controls .d-flex {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }
    .odds-controls .d-flex > * {
        margin-right: 0;
        width: auto !important;
    }
    .odds-controls .form-control {
        flex: 1;
        min-width: 0;
    }
    /* Tables go full width */
    .odds-page .table-responsive,
    .odds-page .tab-content {
        margin-left: -16px;
        margin-right: -16px;
    }
    /* card flush handled by front.css */
    #games-table thead th.game-info-header,
    #games-table tbody td.game-info {
        min-width: 130px;
    }
    #props-table thead th.player-info-header,
    #props-table tbody td.player-info {
        min-width: 160px;
    }
}

/* ========================================================================
   LINE MOVEMENT HOVER POPOVER
   ======================================================================== */
.line-movement-popover {
    display: none;
    position: absolute;
    z-index: 1050;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px 10px;
    pointer-events: auto;
}
.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 .books-panel {
    min-width: 200px;
    max-width: 260px;
    overflow-y: auto;
    font-size: 11px;
    border-left: 1px solid #eee;
    padding-left: 8px;
}
.line-movement-popover .books-panel-header {
    font-weight: 600;
    font-size: 11px;
    color: #333;
    margin-bottom: 4px;
    padding-bottom: 3px;
    border-bottom: 1px solid #eee;
    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: #666;
    white-space: nowrap;
}
.line-movement-popover .bp-val {
    font-weight: 500;
    color: #222;
    white-space: nowrap;
    margin-left: auto;
}
.line-movement-popover .popover-header {
    font-size: 11px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.line-movement-popover canvas {
    display: block;
}
.line-movement-popover .popover-loading,
.line-movement-popover .popover-empty {
    display: none;
    text-align: center;
    padding-top: 55px;
    color: #999;
    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; }

/* Odds/prop cell: flex layout to keep content + chart icon centered together */
.odds-cell, .prop-cell {
    position: relative;
}
.odds-cell-inner, .prop-cell-inner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.odds-cell-content, .prop-cell-content {
    display: inline-block;
}
.chart-icon {
    color: #ccc;
    cursor: pointer;
    transition: color 0.15s, opacity 0.15s;
    opacity: 0.4;
    flex-shrink: 0;
    vertical-align: middle;
}
.odds-cell:hover .chart-icon,
.prop-cell:hover .chart-icon {
    opacity: 1;
}
.chart-icon:hover {
    color: #007bff;
    opacity: 1;
}

/* Popover header row with close button */
.line-movement-popover .popover-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.line-movement-popover .popover-close {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #999;
    padding: 0 2px;
    margin-left: 8px;
}
.line-movement-popover .popover-close:hover {
    color: #333;
}

/* Juice display in books panel */
.line-movement-popover .bp-juice {
    font-size: 10px;
    color: #888;
    white-space: nowrap;
    margin-left: 4px;
}
