/* Voice Chat Interface Styles */

.voice-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 8px;
}

/* All voice control buttons - consistent circular design */
.voice-mic-button,
.voice-tts-button,
.voice-send-button {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: #f5f5f5;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    box-sizing: border-box;
}

.voice-mic-button:hover,
.voice-tts-button:hover,
.voice-send-button:hover {
    background: #e9ecef;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}

.voice-mic-button:active,
.voice-tts-button:active,
.voice-send-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Recording state - pulsing red */
.voice-mic-button.recording {
    background: #dc3545 !important;
    color: white !important;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2);
}

/* TTS playing state - solid primary color */
.voice-tts-button.playing {
    background: #0d6efd !important;
    color: white !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.2);
}

.voice-send-button {
    background: #B89A5F;
    color: white;
}

.voice-send-button:hover {
    background: #9a7d47;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Recording UI */
.voice-recording-ui {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 0; /* Remove padding when not recording */
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    display: none; /* Hide by default */
}

.voice-recording-ui.active {
    display: block; /* Show when active */
    padding: 8px 15px; /* Add padding when shown */
}

.voice-recording-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    background: rgba(184, 154, 95, 0.1);
    border: 1px solid rgba(184, 154, 95, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 0; /* Remove margins for consistent spacing */
}

.recording-pulse {
    width: 12px;
    height: 12px;
    background: #B89A5F;
    border-radius: 50%;
    animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
    0% { opacity: 0.6; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 0.6; transform: scale(0.8); }
}

.recording-text {
    font-size: 14px;
    color: #B89A5F;
    font-weight: 500;
}

.recording-timer {
    font-size: 14px;
    color: #666;
    font-family: 'Monaco', 'Menlo', monospace;
    margin-left: auto;
}

.voice-waveform {
    display: none;
    background: rgba(184, 154, 95, 0.05);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

#waveform-canvas {
    border-radius: 4px;
    background: transparent;
}

/* TTS Buttons */
.tts-button {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin-left: 8px;
}

.tts-button:hover {
    background: rgba(184, 154, 95, 0.1);
}

.tts-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Message actions container */
.message-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
}

/* Voice feedback */
.voice-feedback {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    margin-top: 6px;
    display: none;
}

.voice-feedback.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.voice-feedback.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.voice-feedback.info {
    background: #cce7ff;
    border-color: #b3d9ff;
    color: #004085;
}

/* Responsive design */
@media (max-width: 768px) {
    .voice-controls {
        gap: 10px;
    }

    .voice-mic-button,
    .voice-tts-button,
    .voice-send-button {
        width: 44px;
        height: 44px;
    }

    .voice-recording-indicator {
        padding: 10px 12px;
        gap: 10px;
    }

    .recording-text, .recording-timer {
        font-size: 13px;
    }
}

/* Integration with existing chat styles - align with template structure */
.chat-input-container {
    position: relative;
    flex: 1; /* Take remaining space in flex container */
    display: flex; /* Make container a flex container for the input */
}

/* Ensure input takes full width and is properly sized */
.chat-input-container .chat-input,
#chat-input {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow input to shrink below intrinsic width */
}

.chat-input-container .voice-controls {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Template layout compatibility - ensure recording UI doesn't break flex layout */
.chat-input-area {
    align-items: center; /* Ensure all buttons are vertically centered */
}

/* Ensure voice controls don't interfere with flex layout */
.voice-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Ensure buttons maintain consistent height */
.send-btn, .voice-mic-button {
    flex-shrink: 0; /* Prevent buttons from shrinking */
    align-self: center; /* Center buttons vertically within flex container */
}

/* For input fields with padding-right, adjust to make room for voice controls */
.chat-input:has(+ .voice-controls),
#message-input:has(+ .voice-controls) {
    padding-right: 60px;
}

/* Disabled states */
.voice-mic-button:disabled,
.voice-tts-button:disabled,
.voice-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08) !important;
}

/* Voice mode indicator for content shares */
.voice-mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 2px 8px;
}

.voice-mode-indicator.voice-enabled {
    background: rgba(184, 154, 95, 0.1);
    border-color: rgba(184, 154, 95, 0.3);
    color: #B89A5F;
}

.voice-mode-indicator .icon {
    font-size: 10px;
}