/* style.css - 主样式文件 */
* {
    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%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #4f46e5 0%, #7e22ce 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

header .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* 数字人视频区域 */
.digital-human-section {
    background: #f8fafc;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.video-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: #1e293b;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

#humanVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.status-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(5px);
}

.status-listening { background: rgba(59, 130, 246, 0.8); }
.status-thinking { background: rgba(245, 158, 11, 0.8); }
.status-speaking { background: rgba(16, 185, 129, 0.8); }

.video-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-control {
    padding: 10px 20px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-control:hover {
    background: #4338ca;
    transform: translateY(-2px);
}

.select-control {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
}

/* 控制区域 */
.control-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.connection-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: #f1f5f9;
    padding: 20px;
    border-radius: 10px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-label {
    font-weight: 600;
    color: #64748b;
}

.status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.online {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.offline {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

/* 录音控制 */
.recorder-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.btn-record {
    padding: 15px;
    background: #4f46e5;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-record:hover {
    background: #4338ca;
    transform: translateY(-2px);
}

.btn-record.stop {
    background: #ef4444;
}

.btn-record.stop:hover {
    background: #dc2626;
}

.btn-record:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* 文本输入区域 */
.text-input-area {
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
}

#textInput {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 10px;
}

#textInput:focus {
    outline: none;
    border-color: #4f46e5;
}

.btn-send {
    width: 100%;
    padding: 12px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-send:hover {
    background: #0da271;
}

/* 聊天记录 */
.chat-history {
    background: white;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    overflow: hidden;
}

.chat-history h3 {
    background: #f1f5f9;
    padding: 15px 20px;
    color: #334155;
    font-size: 1.1rem;
}

.chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 20px;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    flex-direction: row-reverse;
}

.message .avatar {
    width: 40px;
    height: 40px;
    background: #4f46e5;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.message.bot .avatar {
    background: #10b981;
}

.message .content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 15px;
    background: #f1f5f9;
    position: relative;
}

.message.user .content {
    background: #4f46e5;
    color: white;
    border-radius: 15px 15px 0 15px;
}

.message.bot .content {
    background: #e2e8f0;
    color: #334155;
    border-radius: 15px 15px 15px 0;
}

.message .text {
    line-height: 1.5;
    word-wrap: break-word;
}

.message .time {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 5px;
    text-align: right;
}

.message.user .time {
    color: rgba(255, 255, 255, 0.8);
}

/* 消息提示 */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 20px;
    color: #64748b;
    font-size: 0.9rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}