/**
 * HeuriSight Voice Assistant Styles
 * Unified styles for the AI Avatar Right Panel and Toggle Button.
 */

/* ==========================================
   VOICE TOKENS (Theme Aware)
   ========================================== */
.voice-assistant-container,
.voice-assistant-panel,
#voice-assistant-toggle {
    --voice-surface: var(--surface-2);
    --voice-surface-elevated: var(--surface-1);
    --voice-text: var(--text-primary);
    --voice-text-secondary: var(--text-secondary);
    --voice-border: var(--border-subtle);
    
    /* Brand mapping */
    --voice-primary: var(--primary-500);
    --voice-primary-glow: rgba(59, 130, 246, 0.3);
    --voice-accent: var(--personal-ai); /* Purple */
    
    /* Status colors */
    --voice-success: var(--success);
    --voice-warning: var(--warning);
    --voice-error: var(--error);
}

/* ==========================================
   TOGGLE BUTTON
   ========================================== */
.voice-assistant-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    background: rgba(139, 92, 246, 0.1); /* Keep slight tint, maybe tokenize later */
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius);
    color: var(--voice-accent);
    transition: all 0.2s var(--ease-out);
    cursor: pointer;
    min-width: 40px;
    height: 40px;
}

.voice-assistant-toggle:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.voice-assistant-toggle.active {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* ==========================================
   RIGHT PANEL CONTAINER
   ========================================== */
.voice-assistant-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100vh;
    
    /* Theme-aware background */
    background: var(--voice-surface);
    border-left: 1px solid var(--voice-border);
    box-shadow: var(--shadow-xl);
    
    transform: translateX(0);
    transition: transform 0.3s var(--ease-out);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.voice-assistant-panel.hidden {
    transform: translateX(100%);
}

/* ==========================================
   PANEL HEADER
   ========================================== */
.voice-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--voice-border);
    background: var(--voice-surface-elevated);
    backdrop-filter: blur(10px); /* Glass effect if surface is transparent */
}

.voice-panel-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--voice-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.voice-panel-title i {
    color: var(--voice-accent);
}

.voice-panel-status {
    font-size: var(--font-size-xs);
    color: var(--voice-text-secondary);
}

.voice-panel-actions {
    display: flex;
    gap: var(--space-2);
}

.voice-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--voice-border);
    background: var(--surface-3); /* Slightly distinct from header */
    color: var(--voice-text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.voice-action-btn:hover {
    background: var(--surface-4);
    color: var(--voice-text);
    border-color: var(--text-tertiary);
}

/* ==========================================
   PANEL CONTENT
   ========================================== */
.voice-panel-content {
    flex: 1;
    padding: var(--space-5);
    overflow-y: auto;
    color: var(--voice-text);
}

/* Avatar Video Container */
#avatar-container {
    background: linear-gradient(135deg, var(--surface-1), var(--surface-2));
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--voice-border);
    position: relative;
    margin-bottom: var(--space-4);
}

#avatar-video {
    display: block;
    width: 100%;
    height: auto;
    background: transparent;
    border-radius: var(--radius-md);
}

#avatar-video.loading {
    background: rgba(0,0,0,0.1);
    min-height: 220px;
}

/* Audio Unlock Overlay */
.audio-unlock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    border-radius: var(--radius-md);
    cursor: pointer;
    z-index: 3;
}

.audio-unlock-overlay.hidden {
    display: none;
}

.audio-unlock-content {
    display: inline-flex;
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--surface-1);
    color: var(--voice-text);
    border: 1px solid var(--voice-border);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
}

.audio-unlock-content i {
    color: var(--voice-accent);
}

/* ==========================================
   CONTROLS & STATUS
   ========================================== */
.voice-controls {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.voice-control-btn {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: white; /* These buttons usually have colored backgrounds */
    border: none;
    transition: filter 0.2s;
    cursor: pointer;
}

.voice-control-btn:hover {
    filter: brightness(1.1);
}

/* Persona Info */
.voice-persona-info {
    margin-bottom: var(--space-4);
}

.voice-persona-info #voice-persona-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--voice-text);
}

.voice-persona-info #voice-persona-model {
    font-size: var(--font-size-xs);
    color: var(--voice-text-secondary);
    font-family: var(--font-family-mono, monospace);
}

/* Status Indicators */
.voice-status {
    margin-bottom: var(--space-6);
}

.voice-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--voice-text-secondary);
    margin-bottom: var(--space-2);
}

.voice-indicator.hidden {
    display: none;
}

/* Icons colors handled by utility classes in HTML (text-green-400 etc) 
   or we can enforce them here if we want strict theming.
   For now assuming HTML has semantic color classes or we override.
*/

/* Transcript */
.voice-transcript {
    margin-bottom: var(--space-6);
}

.voice-transcript .transcript-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--voice-text-secondary);
    margin-bottom: var(--space-2);
}

.transcript-content {
    background: var(--surface-3);
    padding: var(--space-3);
    border-radius: var(--radius);
    border: 1px solid var(--voice-border);
    font-size: var(--font-size-sm);
    color: var(--voice-text);
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes hs-spin {
    to { transform: rotate(360deg); }
}

@keyframes voice-icon-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes voice-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .voice-assistant-panel {
        width: 100%;
        max-width: 320px; /* Don't cover full screen on tablets, sidebar style */
    }
}

@media (max-width: 480px) {
    .voice-assistant-panel {
        width: 100%;
        max-width: 100%;
    }
}

/* ==========================================
   LIGHT MODE OVERRIDES
   ========================================== */
[data-theme="light"] .transcript-content {
    background: var(--surface-2); /* Ensure distinct from panel bg */
}

[data-theme="light"] #avatar-container {
    /* Lighter gradient for avatar bg in light mode? Or keep dark for video contrast? */
    /* Usually video/avatar looks better on dark. Let's keep it dark-ish or use specific light gradient */
    background: linear-gradient(135deg, #e0e7ff, #f3e8ff);
    border-color: var(--primary-200);
}
