:root {
    --primary: #0d1117;
    --card-bg: #161b22;
    --card-subtle: #21262d;
    --border: #30363d;
    --accent: #58a6ff;
    --accent-hover: #1f6feb;
    --accent-subtle: rgba(56, 139, 253, 0.15);
    --text-primary: #f0f6fc;
    --text-secondary: #c9d1d9;
    --text-muted: #8b949e;
    --success: #3fb950;
    --success-subtle: rgba(63, 185, 80, 0.15);
    --warning: #d29922;
    --warning-subtle: rgba(210, 153, 34, 0.15);
    --danger: #f85149;
    --danger-subtle: rgba(248, 81, 73, 0.15);
    --heat-opacity: 1;
}

/* ==========================================================================
   Base Layout & Resets
   ========================================================================== */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: #0d1117;
    color: #c9d1d9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    touch-action: manipulation;
}

/* ==========================================================================
   Glass Panel & Cards (NFL Website Style)
   ========================================================================== */
.glass-panel {
    background: #161b22;
    border: 1px solid #30363d;
}

/* ==========================================================================
   Scrollbars & Mobile Touch Scrolling
   ========================================================================== */
.touch-scroll {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0d1117;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* ==========================================================================
   Sticky Columns & Headers
   ========================================================================== */
.sticky-col {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #161b22;
}

th.sticky-col {
    z-index: 20;
    background-color: #21262d;
}

.th-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.th-sortable:hover {
    color: #58a6ff;
    background-color: #21262d;
}

/* ==========================================================================
   Vulnerability Rank Badges (NBA & NFL Matching)
   Lower rank = Softer/Porous defense (Green = High Exploitability / Over Target)
   Higher rank = Stingier defense (Red = Tough Matchup / Under Target)
   ========================================================================== */
.rank-top, .rank-bad {
    background-color: rgba(63, 185, 80, calc(0.14 * var(--heat-opacity, 1))) !important;
    color: #7ee787 !important;
    border: 1px solid rgba(63, 185, 80, calc(0.30 * var(--heat-opacity, 1))) !important;
}

.rank-mid, .rank-avg {
    background-color: rgba(88, 166, 255, calc(0.10 * var(--heat-opacity, 1))) !important;
    color: #a5d6ff !important;
    border: 1px solid rgba(88, 166, 255, calc(0.20 * var(--heat-opacity, 1))) !important;
}

.rank-bot, .rank-good {
    background-color: rgba(248, 81, 73, calc(0.14 * var(--heat-opacity, 1))) !important;
    color: #ffa198 !important;
    border: 1px solid rgba(248, 81, 73, calc(0.30 * var(--heat-opacity, 1))) !important;
}

/* Table selected row */
tbody tr.selected-row {
    background-color: rgba(56, 139, 253, 0.15) !important;
    border-left: 3px solid #58a6ff;
}

/* ==========================================================================
   Rank Badge Hover Tooltips
   ========================================================================== */
.rank-badge {
    position: relative;
    cursor: help;
    display: inline-flex;
    align-items: center;
}

.rank-badge .rank-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) translateY(3px);
    white-space: nowrap;
    padding: 3px 7px;
    background: rgba(18, 22, 28, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #30363d;
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
    color: #f0f6fc;
    font-size: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 500;
    pointer-events: none;
    z-index: 120;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.rank-badge .rank-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: #30363d transparent transparent transparent;
}

.rank-badge:hover .rank-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Tooltip & Hover Stat Info Box
   ========================================================================== */
.stat-info-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    border-bottom: 1px dotted rgba(148, 163, 184, 0.45);
    padding-bottom: 1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.stat-info-trigger:hover {
    color: #ffffff;
    border-bottom-color: rgba(34, 211, 238, 0.85);
}

.stat-info-box {
    box-sizing: border-box;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: 300px;
    max-width: calc(100vw - 32px);
    padding: 10px 12px;
    background: rgba(18, 22, 28, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.85), 0 2px 6px rgba(0, 0, 0, 0.5);
    color: #c9d1d9;
    font-size: 11px;
    line-height: 1.45;
    text-transform: none;
    letter-spacing: normal;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 400;
    text-align: left;
    pointer-events: none;
    z-index: 99999;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
    transition-delay: 0s;
}

.stat-info-box.stat-info-box-pos {
    width: 360px;
    max-width: calc(100vw - 32px);
}

.stat-info-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #30363d transparent transparent transparent;
}

.stat-info-box.tooltip-down {
    bottom: auto;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
}

.stat-info-box.tooltip-down::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #30363d transparent;
}

.stat-info-trigger:hover .stat-info-box {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.12s;
}

.stat-info-trigger:hover .stat-info-box.tooltip-down {
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Radar Drawer & Overlay
   ========================================================================== */
.radar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13, 17, 23, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 60;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.radar-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 460px;
    max-width: 92vw;
    height: 100vh;
    background: #161b22;
    border-left: 1px solid #30363d;
    box-shadow: -12px 0 32px rgba(0, 0, 0, 0.7);
    z-index: 70;
    display: flex;
    flex-direction: column;
    transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}

.radar-panel.open {
    right: 0;
}

/* ==========================================================================
   Column Dropdown
   ========================================================================== */
.col-dropdown-wrap {
    position: relative;
}

.col-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
    z-index: 50;
    min-width: 220px;
    max-height: 380px;
    overflow: hidden;
}

.col-dropdown.open {
    display: flex;
    flex-direction: column;
}

.col-dropdown-actions {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #30363d;
    background: #21262d;
}

.col-dropdown-actions button {
    padding: 3px 8px;
    border: 1px solid #30363d;
    border-radius: 4px;
    background: #161b22;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: #c9d1d9;
    transition: all 0.15s;
}

.col-dropdown-actions button:hover {
    border-color: #58a6ff;
    color: #58a6ff;
}

.col-dropdown-list {
    overflow-y: auto;
    max-height: 300px;
    padding: 6px 0;
}

.col-dropdown-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    color: #c9d1d9;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s;
}

.col-dropdown-list label:hover {
    background: #21262d;
    color: #ffffff;
}

.col-dropdown-list input[type="checkbox"] {
    width: 13px;
    height: 13px;
    accent-color: #58a6ff;
}

/* ==========================================================================
   Range Slider
   ========================================================================== */
input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    height: 4px;
    background: #30363d;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #58a6ff;
    cursor: pointer;
    border: 2px solid #161b22;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* ==========================================================================
   Custom Table Styling
   ========================================================================== */
.data-table th, .data-table td {
    padding: 8px 10px;
    font-variant-numeric: tabular-nums;
}

.data-table th {
    white-space: nowrap;
}

.data-table tr {
    transition: background-color 0.12s ease;
}

.hidden {
    display: none !important;
}
