* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
}

/* Video Section */
.video-section {
    background: #f5f5f5;
    border-radius: 15px;
    padding: 20px;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

#localVideo {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
}

.video-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.8);
}

.visualizer-container {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 10px;
}

#audioVisualizer {
    width: 100%;
    height: 100px;
    display: block;
}

/* Chat Section */
.chat-section {
    display: flex;
    flex-direction: column;
    background: #f9f9f9;
    border-radius: 15px;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4444;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #44ff44;
}

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

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    min-height: 300px;
    max-height: 400px;
    background: white;
}

.message {
    margin-bottom: 15px;
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    background: #667eea;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.ai {
    background: #e9ecef;
    color: #333;
}

.message.system {
    background: #fff3cd;
    color: #856404;
    text-align: center;
    margin: 10px auto;
}

.message-time {
    font-size: 0.75em;
    opacity: 0.7;
    margin-top: 5px;
}

.welcome-message {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

.welcome-message p {
    margin: 10px 0;
}

.chat-input-section {
    padding: 20px;
    background: #f5f5f5;
}

.voice-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.text-input-container {
    display: flex;
    gap: 10px;
}

#messageInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

#messageInput:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-video {
    background: #667eea;
    color: white;
}

.btn-audio {
    background: #764ba2;
    color: white;
}

.btn-call {
    background: #28a745;
    color: white;
}

.btn-voice {
    background: #ff6b6b;
    color: white;
}

.btn-stop {
    background: #dc3545;
    color: white;
}

.btn-upload {
    background: #17a2b8;
    color: white;
}

.btn-send {
    background: #667eea;
    color: white;
    padding: 12px 30px;
}

.btn-test {
    background: #28a745;
    color: white;
}

.btn-transcribe {
    background: #ffc107;
    color: #000;
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* TTS Controls */
.tts-controls {
    padding: 20px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
}

.tts-controls h4 {
    margin-bottom: 15px;
    color: #333;
}

.tts-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.tts-settings label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
    color: #555;
}

.tts-settings select,
.tts-settings input[type="range"] {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* Settings Panel */
.settings-panel {
    padding: 20px;
    background: #f9f9f9;
    border-top: 2px solid #ddd;
}

.settings-panel h3 {
    margin-bottom: 15px;
    color: #333;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 15px;
    align-items: end;
}

.settings-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
    color: #555;
}

.settings-grid input[type="text"] {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.settings-grid input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

/* MP3 Player */
.mp3-player {
    padding: 20px;
    background: #f5f5f5;
    border-top: 2px solid #ddd;
}

.mp3-player h4 {
    margin-bottom: 15px;
    color: #333;
}

#mp3Audio {
    width: 100%;
    margin-bottom: 15px;
}

/* Recording indicator */
.recording-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: red;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .voice-controls {
        flex-wrap: wrap;
    }
    
    .tts-settings {
        grid-template-columns: 1fr;
    }
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
