/**
 * Voice Latency Indicator Styles
 * Displays real-time voice processing latency status
 */

/* Latency indicator badge */
.voice-latency-indicator {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--bs-gray-800);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

/* Good latency (< 400ms) */
.voice-latency-indicator.good {
    background: var(--bs-success);
    color: white;
}

/* Poor latency (>= 400ms) */
.voice-latency-indicator.poor {
    background: var(--bs-warning);
    color: var(--bs-dark);
    animation: pulse-warning 2s infinite;
}

/* Warning pulse animation */
@keyframes pulse-warning {
    0% {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
    }
    100% {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
}

/* Voice button positioning for indicator */
.voice-control-button,
.voice-button {
    position: relative;
}

/* Hide indicator when not listening */
.voice-control-button:not(.listening) .voice-latency-indicator,
.voice-button:not(.listening) .voice-latency-indicator {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

/* Show indicator when listening */
.voice-control-button.listening .voice-latency-indicator,
.voice-button.listening .voice-latency-indicator {
    opacity: 1;
    transform: scale(1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .voice-latency-indicator {
        font-size: 9px;
        padding: 1px 4px;
        top: -6px;
        right: -6px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) and (prefers-color-scheme: light) {
    .voice-latency-indicator {
        background: var(--bs-gray-700);
        border: 1px solid var(--bs-gray-600);
    }
    
    .voice-latency-indicator.good {
        background: var(--bs-success);
        border-color: var(--bs-success);
    }
    
    .voice-latency-indicator.poor {
        background: var(--bs-warning);
        border-color: var(--bs-warning);
    }
}

/* Performance optimization indicator */
.voice-optimization-status {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bs-dark);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.voice-optimization-status.show {
    opacity: 0.9;
    transform: translateY(0);
}

.voice-optimization-status.success {
    background: var(--bs-success);
}

.voice-optimization-status.warning {
    background: var(--bs-warning);
    color: var(--bs-dark);
}

.voice-optimization-status.error {
    background: var(--bs-danger);
}

/* Latency graph mini visualization */
.voice-latency-graph {
    display: inline-block;
    width: 40px;
    height: 16px;
    margin-left: 4px;
    vertical-align: middle;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.voice-latency-graph canvas {
    width: 100%;
    height: 100%;
}

/* Voice waveform performance indicator */
.voice-waveform.optimized {
    border-color: var(--bs-success);
}

.voice-waveform.optimized span {
    background: var(--bs-success);
}

/* Debug mode latency details */
.voice-latency-debug {
    position: fixed;
    top: 60px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    color: #0f0;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 10px;
    border-radius: 4px;
    min-width: 200px;
    z-index: 10000;
    display: none;
}

.voice-latency-debug.show {
    display: block;
}

.voice-latency-debug .metric {
    display: flex;
    justify-content: space-between;
    margin: 2px 0;
}

.voice-latency-debug .metric-label {
    color: #999;
}

.voice-latency-debug .metric-value {
    font-weight: bold;
}

.voice-latency-debug .metric-value.good {
    color: #0f0;
}

.voice-latency-debug .metric-value.warning {
    color: #ff0;
}

.voice-latency-debug .metric-value.poor {
    color: #f00;
}