/**
 * Gesture Config Panel & Debug Overlay Styles (April 2026)
 */

/* ========== Debug Overlay ========== */
.gesture-debug-overlay {
    position: fixed;
    bottom: 160px; /* above gesture canvas preview */
    left: 10px;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(88, 166, 255, 0.4);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #e6edf3;
    z-index: 10000;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.gesture-debug-overlay.hidden {
    display: none;
}

.gesture-debug-overlay .debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(88, 166, 255, 0.3);
    padding-bottom: 6px;
    margin-bottom: 6px;
    pointer-events: auto;
}

.gesture-debug-overlay .debug-header span {
    color: #58a6ff;
    font-weight: 600;
    font-size: 12px;
}

.gesture-debug-overlay .debug-header .debug-fps {
    color: #3fb950;
}

.gesture-debug-overlay .debug-hide-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #8b949e;
    cursor: pointer;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: auto;
}

.gesture-debug-overlay .debug-hide-btn:hover {
    color: #e6edf3;
    border-color: rgba(255, 255, 255, 0.4);
}

.gesture-debug-overlay .debug-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 0;
    margin-bottom: 2px;
}

.gesture-debug-overlay .debug-section:last-child {
    border-bottom: none;
}

.gesture-debug-overlay .debug-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.gesture-debug-overlay .debug-label {
    color: #8b949e;
    min-width: 50px;
}

.gesture-debug-overlay .debug-value {
    color: #e6edf3;
    text-align: right;
}

.gesture-debug-overlay .debug-value.warn {
    color: #d29922;
}

.gesture-debug-overlay .debug-value.error {
    color: #f85149;
}

.gesture-debug-overlay .debug-value.good {
    color: #3fb950;
}

.gesture-debug-overlay .debug-skip-reason {
    color: #f85149;
    font-size: 10px;
    padding: 3px 0;
    word-break: break-all;
}

.gesture-debug-overlay .debug-history {
    font-size: 10px;
    color: #8b949e;
}

.gesture-debug-overlay .debug-history .history-entry {
    display: flex;
    justify-content: space-between;
}

.gesture-debug-overlay .debug-history .history-time {
    color: #6e7681;
}

.gesture-debug-overlay .debug-history .history-action {
    color: #58a6ff;
}

/* ========== Config Panel ========== */
.gesture-config-panel {
    position: fixed;
    top: 80px;
    right: 10px;
    width: 320px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: rgba(13, 17, 23, 0.95);
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 10px;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    color: #e6edf3;
    z-index: 10001;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.gesture-config-panel.hidden {
    display: none;
}

.gesture-config-panel .config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.gesture-config-panel .config-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e6edf3;
}

.gesture-config-panel .config-close-btn {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    line-height: 1;
}

.gesture-config-panel .config-close-btn:hover {
    color: #f85149;
}

/* Tabs */
.gesture-config-panel .config-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 12px;
}

.gesture-config-panel .config-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #8b949e;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s, border-color 0.2s;
}

.gesture-config-panel .config-tab:hover {
    color: #e6edf3;
}

.gesture-config-panel .config-tab.active {
    color: #58a6ff;
    border-bottom-color: #58a6ff;
}

/* Tab Content */
.gesture-config-panel .config-content {
    padding: 12px 16px;
}

.gesture-config-panel .config-tab-content {
    display: none;
}

.gesture-config-panel .config-tab-content.active {
    display: block;
}

/* Slider Group */
.gesture-config-panel .slider-group {
    margin-bottom: 14px;
}

.gesture-config-panel .slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}

.gesture-config-panel .slider-label span:first-child {
    color: #8b949e;
}

.gesture-config-panel .slider-label .slider-value {
    color: #58a6ff;
    font-family: 'SF Mono', monospace;
    font-size: 11px;
    min-width: 50px;
    text-align: right;
}

.gesture-config-panel input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
}

.gesture-config-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #58a6ff;
    cursor: pointer;
    border: 2px solid rgba(13, 17, 23, 0.8);
}

.gesture-config-panel input[type="range"]::-webkit-slider-thumb:hover {
    background: #79c0ff;
    transform: scale(1.1);
}

/* Preset Buttons */
.gesture-config-panel .preset-group {
    margin: 14px 0;
}

.gesture-config-panel .preset-group label {
    display: block;
    font-size: 12px;
    color: #8b949e;
    margin-bottom: 6px;
}

.gesture-config-panel .preset-buttons {
    display: flex;
    gap: 8px;
}

.gesture-config-panel .preset-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid rgba(88, 166, 255, 0.3);
    border-radius: 6px;
    background: rgba(88, 166, 255, 0.08);
    color: #8b949e;
    cursor: pointer;
    font-size: 11px;
    text-align: center;
    transition: all 0.2s;
}

.gesture-config-panel .preset-btn:hover {
    background: rgba(88, 166, 255, 0.15);
    color: #e6edf3;
}

.gesture-config-panel .preset-btn.active {
    background: rgba(88, 166, 255, 0.25);
    border-color: #58a6ff;
    color: #58a6ff;
}

/* Action Buttons */
.gesture-config-panel .config-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.gesture-config-panel .config-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #e6edf3;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.gesture-config-panel .config-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.gesture-config-panel .config-btn.primary {
    background: rgba(88, 166, 255, 0.15);
    border-color: rgba(88, 166, 255, 0.4);
    color: #58a6ff;
}

.gesture-config-panel .config-btn.primary:hover {
    background: rgba(88, 166, 255, 0.25);
}

/* Debug Toggles */
.gesture-config-panel .toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.gesture-config-panel .toggle-group label {
    font-size: 12px;
    color: #8b949e;
}

.gesture-config-panel .toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
}

.gesture-config-panel .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gesture-config-panel .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    transition: background 0.2s;
}

.gesture-config-panel .toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: #e6edf3;
    border-radius: 50%;
    transition: transform 0.2s;
}

.gesture-config-panel .toggle-switch input:checked + .toggle-slider {
    background: #58a6ff;
}

.gesture-config-panel .toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* Gear Button (next to recalibrate) */
#gestureConfigBtn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #8b949e;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

#gestureConfigBtn:hover {
    color: #e6edf3;
    background: rgba(255, 255, 255, 0.15);
}

/* Responsive */
@media (max-width: 480px) {
    .gesture-config-panel {
        width: calc(100% - 20px);
        right: 10px;
        top: 60px;
    }

    .gesture-debug-overlay {
        width: 240px;
        font-size: 10px;
    }
}
