/* GEX Heatmap page styles */

.heatmap-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.heatmap-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.heatmap-controls-left,
.heatmap-controls-center,
.heatmap-controls-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.heatmap-select {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.heatmap-select:focus {
    outline: none;
    border-color: #4a9eff;
}

.heatmap-range-group,
.heatmap-mode-group {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 2px;
}

.heatmap-range-btn,
.heatmap-mode-btn {
    background: transparent;
    color: #a0a0a0;
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.heatmap-range-btn:hover,
.heatmap-mode-btn:hover {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.1);
}

.heatmap-range-btn.active,
.heatmap-mode-btn.active {
    color: #ffffff;
    background: rgba(74, 158, 255, 0.3);
}

.heatmap-range-btn.locked,
.heatmap-mode-btn.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.heatmap-range-btn.locked::after,
.heatmap-mode-btn.locked::after {
    content: "\1F512";
    font-size: 0.6rem;
    position: absolute;
    top: 2px;
    right: 2px;
}

.heatmap-upgrade-banner {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: #ffc107;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.heatmap-upgrade-link {
    color: #ffc107;
    text-decoration: underline;
    font-weight: 600;
}

.heatmap-image-wrapper {
    position: relative;
    background: var(--theme-chart-bg);
    border-radius: 8px;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heatmap-img {
    width: 100%;
    height: auto;
    display: block;
}

.heatmap-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.heatmap-footer {
    padding: 0.5rem 0;
    font-size: 0.8rem;
    color: #808080;
    text-align: right;
}

/* Checkbox control */
.heatmap-checkbox {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #a0a0a0;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
}

.heatmap-checkbox input {
    accent-color: #4a9eff;
    cursor: pointer;
}

.heatmap-checkbox:hover span {
    color: #e0e0e0;
}

/* Hover tooltip */
.heatmap-tooltip {
    display: none;
    position: absolute;
    z-index: 20;
    pointer-events: none;
    background: rgba(10, 10, 30, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
    color: #e0e0e0;
    line-height: 1.5;
    white-space: nowrap;
    backdrop-filter: blur(6px);
}

.heatmap-tooltip b {
    color: #ffffff;
}

.heatmap-tooltip-ts {
    color: #a0a0a0;
    font-size: 0.75rem;
    margin-bottom: 2px;
}

/* ========================================
   TITLE BAND (above the PNG, inside the card)
   ======================================== */

/* Title sits INSIDE #heatmap-image-wrapper as a top sibling â€” same pattern
   .gex-ohlc-container uses â€” so it shares the card surface, border-radius,
   and there's no visual gap between the title block and the chart card. */
#heatmap-header-row.gex-chart-title {
    pointer-events: none;
}


/* ========================================
   HEATMAP VIEW â€” taller chart, no markers/slider
   ======================================== */

/* Heatmap image fills available vertical space (universal â€” desktop + mobile).
   Lifted from the mobile-only block below in Task 5 of the
   desktop full-viewport layout work. */
#gex-heatmap-view {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

/* Wrapper mirrors .gex-chart-container (used by OHLC/MC/Strike) so the
   heatmap card visually matches the other chart cards â€” same bg, border,
   and rounded corners. Flex column so the title band sits on top and the
   image area stretches to fill the rest. */
#heatmap-image-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--theme-bg-card);
    border: 1px solid var(--theme-border-primary);
    border-radius: 8px;
    overflow: hidden;
    min-height: 250px;
    position: relative;
}

/* Image area holds the PNG + loading spinner + tooltip. Centered flex so the
   PNG (object-fit:contain) is centered when its aspect ratio doesn't match. */
#heatmap-image-area {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-chart-bg);
}

#heatmap-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

#heatmap-chart-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;  /* shown by plotter once load resolves */
}

#heatmap-crosshair-v,
#heatmap-crosshair-h {
    display: none;
    position: absolute;
    z-index: 15;
    pointer-events: none;
    /* Pure white + difference blend inverts the line against whatever cell is
       behind it, so it stays visible on light-yellow, red and green alike â€”
       theme-agnostic, no per-background colour logic needed. */
    background: #fff;
    mix-blend-mode: difference;
    opacity: 0.85;
}

#heatmap-crosshair-v { width: 1px; }
#heatmap-crosshair-h { height: 1px; }

#heatmap-axis-x,
#heatmap-axis-y {
    display: none;
    position: absolute;
    z-index: 16;
    pointer-events: none;
    background: rgba(10, 10, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

/* X pill hangs below the plot, centred on the crosshair column */
#heatmap-axis-x { transform: translateX(-50%); }
/* Y pill sits just left of the plot, centred on the crosshair row */
#heatmap-axis-y { transform: translate(-100%, -50%); }

#heatmap-price-dot {
    display: none;
    position: absolute;
    z-index: 17;
    pointer-events: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid rgba(0, 0, 0, 0.75);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.7);
    transform: translate(-50%, -50%);
}

#heatmap-price-label {
    display: none;
    position: absolute;
    z-index: 18;
    pointer-events: none;
    background: rgba(10, 10, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

/* Flip marker â€” magenta, matching the F line (#ff00ff / --marker-flip-bg) */
#heatmap-flip-dot {
    display: none;
    position: absolute;
    z-index: 17;
    pointer-events: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff00ff;
    border: 1.5px solid rgba(0, 0, 0, 0.75);
    box-shadow: 0 0 6px rgba(255, 0, 255, 0.85);
    transform: translate(-50%, -50%);
}

#heatmap-flip-label {
    display: none;
    position: absolute;
    z-index: 18;
    pointer-events: none;
    background: rgba(10, 10, 30, 0.95);
    border: 1px solid rgba(255, 0, 255, 0.6);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #ff5cff;
    white-space: nowrap;
}

#heatmap-chart-tooltip {
    display: none;
    position: absolute;
    z-index: 20;
    pointer-events: none;
    background: rgba(10, 10, 30, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.5rem 0.7rem;
    font-size: 0.8rem;
    color: #e0e0e0;
    line-height: 1.5;
    white-space: nowrap;
    backdrop-filter: blur(6px);
}

/* Mobile responsive */
@media (max-width: 768px) {
    /* Hide palette toolbar control on mobile */
    #heatmap-palette-wrapper {
        display: none !important;
    }

    .heatmap-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .heatmap-controls-left,
    .heatmap-controls-center,
    .heatmap-controls-right {
        justify-content: center;
    }

    .heatmap-overlay-select {
        font-size: 0.75rem;
        padding: 4px 8px;
        min-height: 32px;
    }

    /* Mobile-only: remove border-radius so heatmap is edge-to-edge.
       Other heatmap flex rules are now universal (lifted in Task 5
       of the desktop full-viewport layout work). */
    #heatmap-image-wrapper {
        border-radius: 0 !important;
    }
}
