/* Heatmap Tool Panel - Compact Design */
.tool-panel {
    position: absolute;
    top: 70px;
    right: 16px;
    width: 280px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 90px);
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.tool-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    overflow: hidden;
}

.tool-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #e8eaed;
}

.tool-icon {
    flex-shrink: 0;
}

.tool-panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #9aa0a6;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-panel-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e8eaed;
    border-color: rgba(255, 255, 255, 0.2);
}

.tool-panel-content {
    padding: 16px;
    overflow-y: auto;
    overflow-x: visible;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    touch-action: pan-y;
    overscroll-behavior: contain;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Custom scrollbar for webkit browsers */
.tool-panel-content::-webkit-scrollbar {
    width: 6px;
}

.tool-panel-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.tool-panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.tool-panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ===== COMPACT LAYOUT STYLES ===== */

/* Compact Toggle Grid */
.heatmap-toggles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.toggle-item {
    position: relative;
}

.toggle-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.toggle-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
}

.toggle-item input:checked + .toggle-label {
    background: rgba(0, 116, 255, 0.15);
    border-color: rgba(0, 116, 255, 0.3);
    color: #4fc3f7;
}

.toggle-icon {
    font-size: 16px;
    opacity: 0.8;
}

.toggle-text {
    font-size: 11px;
    font-weight: 500;
    color: #e8eaed;
    line-height: 1.2;
}

/* Compact Stats Row */
.heatmap-stats-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px;
}

.stat-compact .stat-value {
    font-size: 13px;
    font-weight: 600;
    color: #4fc3f7;
    line-height: 1.2;
    text-align: center;
    word-break: keep-all;
}

.stat-compact .stat-label {
    font-size: 10px;
    color: #9aa0a6;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    word-break: keep-all;
    hyphens: none;
}

/* Compact Legend */
.heatmap-legend-compact {
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.legend-title {
    font-size: 12px;
    font-weight: 500;
    color: #e8eaed;
    margin-bottom: 6px;
    text-align: center;
}

.legend-items {
    display: flex;
    justify-content: space-between;
    gap: 4px;
}

.legend-item-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-item-compact span:last-child {
    font-size: 10px;
    color: #9aa0a6;
    font-weight: 500;
}

/* PRO Mode Section */
.pro-mode-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: visible;
    position: relative;
}

.pro-mode-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: #e8eaed;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pro-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.pro-badge {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.toggle-arrow {
    transition: transform 0.2s ease;
    font-size: 12px;
    color: #9aa0a6;
}

.pro-mode-toggle.active .toggle-arrow {
    transform: rotate(180deg);
}

.pro-controls {
    padding: 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
    position: relative;
}

.pro-toggle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

.pro-toggle-item:not(:last-child) {
    margin-bottom: 16px;
}

.pro-toggle-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    appearance: none;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.pro-toggle-item input[type="checkbox"]:checked {
    background: #0074ff;
    border-color: #0074ff;
}

.pro-toggle-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.pro-toggle-item label {
    font-size: 12px;
    color: #e8eaed;
    cursor: pointer;
    flex: 1;
}

.pro-search {
    position: relative;
    z-index: 100;
}

.pro-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e8eaed;
    font-size: 12px;
    transition: all 0.2s ease;
    min-width: 0;
}

.pro-search-input:focus {
    outline: none;
    border-color: #0074ff;
    background: rgba(255, 255, 255, 0.08);
}

.pro-search-input::placeholder {
    color: #9aa0a6;
}

.heatmap-control-group {
    margin-bottom: 20px;
}

.heatmap-control-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #e8eaed;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
}

/* Hide default checkbox */
.heatmap-control-group input[type="checkbox"] {
    display: none;
}

/* Toggle switch container */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

/* Toggle switch slider */
.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #9aa0a6;
    top: 2px;
    left: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Checked state */
input[type="checkbox"]:checked + .toggle-switch {
    background: rgba(0, 116, 255, 0.2);
    border-color: #0074ff;
}

input[type="checkbox"]:checked + .toggle-switch::after {
    background: #0074ff;
    transform: translateX(20px);
}

/* PRO mode toggle - special styling */
#heatmap-pro-mode:checked + .toggle-switch {
    background: linear-gradient(135deg, rgba(0, 116, 255, 0.3) 0%, rgba(0, 168, 255, 0.3) 100%);
    border-color: #00a8ff;
}

#heatmap-pro-mode:checked + .toggle-switch::after {
    background: linear-gradient(135deg, #0074ff 0%, #00a8ff 100%);
}

/* Player search input */
#heatmap-player-search:focus {
    outline: none;
    border-color: #0074ff;
    background: rgba(0, 116, 255, 0.05);
}

#heatmap-player-search::placeholder {
    color: #9aa0a6;
}

/* Legend styling */
.heatmap-legend {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
}

.heatmap-legend h4 {
    margin: 0 0 12px 0;
    color: #e8eaed;
    font-size: 14px;
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #9aa0a6;
    font-size: 13px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

/* Stats section */
.heatmap-stats {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-label {
    color: #9aa0a6;
    font-size: 13px;
}

.stat-value {
    color: #e8eaed;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', monospace;
}

/* Info section */
.heatmap-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.heatmap-info small {
    color: #9aa0a6;
    font-size: 12px;
}

/* Heatmap Animation Keyframes */
@keyframes heatmap-pulse {
    0% { opacity: 0.6; }
    100% { opacity: 1.0; }
}

.heatmap-animated {
    animation: heatmap-pulse 2s ease-in-out infinite alternate !important;
}

/* Responsive */
@media (max-width: 768px) {
    .tool-panel {
        right: 8px;
        width: calc(100vw - 16px);
        max-width: none;
        max-height: 70vh;
        bottom: 8px;
        top: auto;
    }
    
    .tool-panel-content {
        padding: 16px;
        max-height: calc(70vh - 100px);
    }
    
    .tool-panel-header {
        padding: 12px 16px;
    }
}

/* Player autocomplete styles */
.player-autocomplete {
    position: relative;
}

.player-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-height: 200px;
    overflow-y: auto;
    z-index: 99999;
    display: none;
}

.player-autocomplete-dropdown.active {
    display: block !important;
}

.player-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #e8eaed;
}

.player-autocomplete-item:hover,
.player-autocomplete-item.selected {
    background: rgba(255, 255, 255, 0.1);
}

.player-autocomplete-item .player-name {
    font-weight: 500;
}

.player-autocomplete-item .player-status {
    font-size: 12px;
    color: #9aa0a6;
    margin-left: 8px;
}

.player-autocomplete-item .player-status.online {
    color: #00ff66;
}

.player-autocomplete-loading {
    padding: 12px;
    text-align: center;
    color: #9aa0a6;
    font-size: 14px;
}

.player-autocomplete-empty {
    padding: 12px;
    text-align: center;
    color: #9aa0a6;
    font-size: 14px;
}