/* ============================================
   GEX Dashboard Styles
   ============================================ */

/* Page-level background — only on the dashboard route */
body:has(.dashboard-container) {
    background-color: var(--theme-bg-page, var(--theme-bg-primary));
}

.dashboard-container {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: 0 20px 2rem;
    background-color: var(--theme-bg-primary);
}

@media (min-width: 992px) {
    .dashboard-container {
        margin-top: 12px;
        margin-bottom: 24px;
        border-radius: 16px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 2px 12px rgba(0, 0, 0, 0.04);
    }
}

/* Sticky controls bar below header — elevated surface to separate from nav.
   Negative margins + matching padding break out of .dashboard-container's padding
   so the bar stretches edge-to-edge like the header. */
.dashboard-controls {
    position: sticky;
    top: 56px;
    z-index: 1029;
    background: var(--theme-bg-primary);
    border-bottom: 1px solid var(--theme-border-secondary);
    margin-left: -20px;
    margin-right: -20px;
    padding: 0.5rem 20px;
}

@media (max-width: 767.98px) {
    .dashboard-controls {
        top: 50px;
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        padding: 0.5rem 0.5rem;
    }
}

.dashboard-price {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Section headers — override Bootstrap .text-muted for better contrast */
.dashboard-section h6,
.dashboard-container > .row h6,
.dashboard-container h6.text-uppercase {
    color: var(--theme-text-secondary) !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
}

/* Sections */
.dashboard-section {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

.dashboard-section:last-of-type {
    border-bottom: none;
}

/* Gauges */
.gauge-container {
    position: relative;
    display: inline-block;
}

.gauge-large svg {
    max-width: 420px;
    width: 100%;
    height: auto;
}

.gauge-small svg {
    max-width: 300px;
    width: 100%;
    height: auto;
}

.gauge-grid svg {
    width: 100%;
    height: auto;
}

/* Gauges column: stretch to match right column, distribute evenly */
@media (min-width: 992px) {
    .dashboard-gauges-col {
        display: flex;
        flex-direction: column;
        justify-content: space-evenly;
        height: 100%;
        overflow: hidden;
    }

    .dashboard-gauge-cell {
        flex: 1 1 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        border-bottom: 1px solid var(--bs-border-color);
        padding: 0.25rem 0;
    }

    .dashboard-gauge-cell:last-child {
        border-bottom: none;
    }


    .dashboard-gauge-cell .gauge-container {
        max-height: 100%;
        overflow: hidden;
    }
}

.dashboard-gauge-cell {
    border-bottom: 1px solid var(--bs-border-color);
    padding: 0.5rem 0;
}

.dashboard-gauge-cell:last-child {
    border-bottom: none;
}

/* GEX by Strike chart widget */
.dashboard-gex-chart {
    width: 100%;
    height: 420px;
    border-radius: 8px;
    overflow: hidden;
}

.dashboard-gex-chart .drag,
.dashboard-gex-chart .nsewdrag,
.dashboard-gex-chart .cursor-crosshair {
    cursor: default !important;
}

@media (max-width: 767.98px) {
    .dashboard-gex-chart {
        height: 340px;
    }
}

/* Term bars */
.term-label {
    font-variant-numeric: tabular-nums;
}

/* Heatmap */
.heatmap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.heatmap-table th {
    padding: 4px 6px;
    text-align: center;
    color: var(--bs-secondary-color, #888);
    font-weight: 500;
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    background: var(--bs-body-bg);
}

.heatmap-label {
    padding: 4px 8px;
    font-weight: 600;
    color: var(--bs-secondary-color, #888);
    text-align: right;
    white-space: nowrap;
    min-width: 40px;
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bs-body-bg);
}

.heatmap-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bs-body-bg);
}

.heatmap-cell {
    padding: 4px 6px;
    text-align: center;
    border: 1px solid var(--bs-border-color);
    border-radius: 2px;
    transition: opacity 0.15s;
    cursor: default;
}

.heatmap-cell:hover {
    opacity: 0.8;
    outline: 1px solid var(--bs-body-color);
}

/* Premium blur overlay (free tier teaser) */
.premium-blur-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.premium-blur-wrapper.blurred .premium-blur-content {
    filter: blur(6px);
    pointer-events: none;
    user-select: none;
}

.premium-blur-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

.premium-blur-cta {
    text-align: center;
    padding: 1.25rem 1.5rem;
    background: rgba(var(--bs-body-bg-rgb, 22, 27, 34), 0.92);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.premium-blur-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 0.4rem;
}

.premium-blur-text {
    font-size: 0.875rem;
    color: var(--bs-body-color);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.premium-blur-cta .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 0.4rem 1.25rem;
    transition: transform 0.15s, box-shadow 0.15s;
}

.premium-blur-cta .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Skeleton loading placeholders */
.skeleton {
    background: linear-gradient(90deg,
        var(--bs-tertiary-bg, #1a1a2e) 25%,
        var(--bs-secondary-bg, #2a2a3e) 50%,
        var(--bs-tertiary-bg, #1a1a2e) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-gauge {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 2 / 1;
    margin: 0 auto;
}

.skeleton-gauge-sm {
    max-width: 220px;
}

.skeleton-chart {
    width: 100%;
    height: 150px;
}

.skeleton-heatmap {
    width: 100%;
    height: 120px;
}

.skeleton-line {
    height: 1.2em;
    margin-bottom: 0.5rem;
}

/* ============================================
   Tippy.js Tooltip Themes (mirrors gex-components.css)
   ============================================ */

.tippy-box[data-theme~='gex-light'] {
    background-color: #ffffff;
    color: #212529;
    border: 1px solid #dee2e6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 0.8125rem;
    line-height: 1.4;
    border-radius: 6px;
}
.tippy-box[data-theme~='gex-light'][data-placement^='top'] > .tippy-arrow::before { border-top-color: #ffffff; }
.tippy-box[data-theme~='gex-light'][data-placement^='bottom'] > .tippy-arrow::before { border-bottom-color: #ffffff; }
.tippy-box[data-theme~='gex-light'][data-placement^='left'] > .tippy-arrow::before { border-left-color: #ffffff; }
.tippy-box[data-theme~='gex-light'][data-placement^='right'] > .tippy-arrow::before { border-right-color: #ffffff; }

.tippy-box[data-theme~='gex-dark'] {
    background-color: #161b22;
    color: #e6edf3;
    border: 1px solid #30363d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    font-size: 0.8125rem;
    line-height: 1.4;
    border-radius: 6px;
}
.tippy-box[data-theme~='gex-dark'][data-placement^='top'] > .tippy-arrow::before { border-top-color: #161b22; }
.tippy-box[data-theme~='gex-dark'][data-placement^='bottom'] > .tippy-arrow::before { border-bottom-color: #161b22; }
.tippy-box[data-theme~='gex-dark'][data-placement^='left'] > .tippy-arrow::before { border-left-color: #161b22; }
.tippy-box[data-theme~='gex-dark'][data-placement^='right'] > .tippy-arrow::before { border-right-color: #161b22; }

@media (max-width: 767.98px) {
    .tippy-box[data-theme~='gex-light'],
    .tippy-box[data-theme~='gex-dark'] {
        font-size: 0.75rem;
        max-width: 240px;
    }
}

/* Tooltip trigger — info icon hint */
[data-tippy-content] {
    cursor: help;
}

h6[data-tippy-content]::after,
.dashboard-section div.text-muted.small[data-tippy-content]::after,
span.text-muted.small[data-tippy-content]::after {
    content: '\24D8';  /* ⓘ circled i */
    margin-left: 4px;
    font-size: 0.7em;
    opacity: 0.35;
    vertical-align: super;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 767.98px) {
    .dashboard-price {
        font-size: 1.25rem;
    }

    .gauge-large svg {
        max-width: 260px;
    }

    .gauge-small svg {
        max-width: 180px;
    }

    .dashboard-container {
        padding: 0 0.5rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .gauge-large svg {
        max-width: 220px;
    }

    .gauge-small svg {
        max-width: 160px;
    }

    /* Heatmap mobile: stack title above buttons */
    .heatmap-header-mobile {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    /* Scroll hint for heatmap */
    .heatmap-scroll-wrapper {
        position: relative;
    }

    .heatmap-scroll-wrapper::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 24px;
        pointer-events: none;
        background: linear-gradient(to right, transparent, var(--bs-body-bg, #161b22));
        z-index: 2;
        transition: opacity 0.2s;
    }

    .heatmap-scroll-wrapper.scrolled-end::after {
        opacity: 0;
    }

    .heatmap-table {
        font-size: 0.6875rem;
    }

    .heatmap-table th {
        padding: 3px 4px;
    }

    .heatmap-cell {
        padding: 3px 4px;
    }

    .heatmap-label {
        padding: 3px 6px;
    }
}

/* ========================================
   DRIVER.JS TOUR THEME
   ======================================== */

/* --- Dark theme (default) --- */
.driver-popover.gex-tour {
    background-color: #1e1e2e;
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    max-width: 340px;
}

.driver-popover.gex-tour .driver-popover-title {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
}

.driver-popover.gex-tour .driver-popover-description {
    color: #c0c0d0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.driver-popover.gex-tour .driver-popover-description kbd {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.8em;
    color: #e0e0e0;
}

.driver-popover.gex-tour .driver-popover-progress-text {
    color: #888;
    font-size: 0.75rem;
}

.driver-popover.gex-tour .driver-popover-navigation-btns button {
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 16px;
    text-shadow: none;
}

.driver-popover.gex-tour .driver-popover-next-btn,
.driver-popover.gex-tour .driver-popover-close-btn {
    background-color: #6c5ce7;
    color: #ffffff;
    border: none;
}

.driver-popover.gex-tour .driver-popover-next-btn:hover,
.driver-popover.gex-tour .driver-popover-close-btn:hover {
    background-color: #7c6cf7;
}

.driver-popover.gex-tour .driver-popover-prev-btn {
    background-color: transparent;
    color: #c0c0d0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.driver-popover.gex-tour .driver-popover-prev-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Dark theme arrows */
.driver-popover.gex-tour .driver-popover-arrow-side-left {
    border-left-color: #1e1e2e;
}
.driver-popover.gex-tour .driver-popover-arrow-side-right {
    border-right-color: #1e1e2e;
}
.driver-popover.gex-tour .driver-popover-arrow-side-top {
    border-top-color: #1e1e2e;
}
.driver-popover.gex-tour .driver-popover-arrow-side-bottom {
    border-bottom-color: #1e1e2e;
}

/* --- Light theme --- */
[data-bs-theme="light"] .driver-popover.gex-tour {
    background-color: #ffffff;
    color: #1a1a2e;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-title {
    color: #1a1a2e;
}

[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-description {
    color: #4a4a5a;
}

[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-description kbd {
    background-color: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.15);
    color: #1a1a2e;
}

[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-progress-text {
    color: #888;
}

[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-next-btn,
[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-close-btn {
    background-color: #6c5ce7;
    color: #ffffff;
}

[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-next-btn:hover,
[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-close-btn:hover {
    background-color: #5b4bd6;
}

[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-prev-btn {
    background-color: transparent;
    color: #4a4a5a;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-prev-btn:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

/* Light theme arrows */
[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-arrow-side-left {
    border-left-color: #ffffff;
}
[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-arrow-side-right {
    border-right-color: #ffffff;
}
[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-arrow-side-top {
    border-top-color: #ffffff;
}
[data-bs-theme="light"] .driver-popover.gex-tour .driver-popover-arrow-side-bottom {
    border-bottom-color: #ffffff;
}
