/* styles.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%);
    min-height: 100vh;
    color: #333;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.logo {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.slogan {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 模式选择器 */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.mode-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
}

.mode-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(255,255,255,0.4);
    box-shadow: 0 4px 15px rgba(255,255,255,0.2);
}

.emoji {
    font-size: 1.3em;
}

/* 模式内容 */
.mode-content {
    display: none;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 错误提示样式 */
.error-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ff4d4f;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    max-width: 80%;
}

/* 成功提示样式 */
.success-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #52c41a;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    max-width: 80%;
    animation: fadeIn 0.3s ease-out;
}

.success-icon {
    font-size: 24px;
}

.success-message {
    flex-grow: 1;
    font-weight: 500;
}

.success-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
}

/* 详细错误提示样式 */
.detailed-error-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border: 1px solid #ff4d4f;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 2000;
    max-width: 90%;
    width: 450px;
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
}

.error-header {
    background-color: #ff4d4f;
    color: white;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-suggestions {
    padding: 15px;
    color: #333;
    font-size: 14px;
}

.error-suggestions ul {
    margin-top: 8px;
    padding-left: 20px;
}

.error-suggestions li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.error-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.error-message {
    flex-grow: 1;
    font-size: 16px;
    font-weight: 500;
}

.error-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
}

.mode-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 摄像头容器 */
.camera-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin-bottom: 20px;
    border-radius: 15px;
    overflow: hidden;
    background: #f0f0f0;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

#cameraCanvas {
    display: none;
}

/* 控制面板 */
.control-panel {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 20px;
    background: #4CAF50;
    color: white;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
}

.control-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.control-btn:disabled:hover {
    transform: none;
}

/* 结果面板 */
.result-panel {
    text-align: center;
    margin-bottom: 20px;
}

.result-panel h3 {
    margin-bottom: 15px;
    color: #333;
}

.result-text {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 15px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #4CAF50;
}

/* 置信度条 */
.confidence-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.confidence-text {
    font-size: 0.9em;
    color: #666;
}

/* 音频面板 */
.audio-panel {
    text-align: center;
}

audio {
    width: 100%;
    margin-top: 10px;
}

/* 动画容器 */
.animation-container {
    position: relative;
    width: 100%;
    height: 300px;
    margin-bottom: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
}

#signCanvas {
    width: 100%;
    height: 100%;
}

.emotion-display {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.9);
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

/* 语音控制面板 */
.voice-control-panel {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

/* 字幕层 */
.subtitle-layer {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.subtitle-text {
    font-size: 1.1em;
    font-weight: 500;
}
/* 状态指示器 */
.status-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    color: white;
    z-index: 1000;
}

.status-indicator.online {
    background-color: #4CAF50;
}

.status-indicator.offline {
    background-color: #f44336;
}

/* 错误提示样式 */
.error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f44336;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    max-width: 80%;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.error-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.error-message {
    flex-grow: 1;
    font-size: 14px;
    line-height: 1.4;
}

.error-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.error-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.status-indicator.online {
    background: #4CAF50;
    color: white;
}

.status-indicator.offline {
    background: #f44336;
    color: white;
}

/* 离线提示 */
.offline-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1em;
    z-index: 2000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { top: -50px; opacity: 0; }
    to { top: 20px; opacity: 1; }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }
    
    .logo {
        font-size: 2em;
    }
    
    .mode-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .control-panel {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 250px;
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .mode-btn {
        border: 2px solid white;
    }
    
    .control-btn {
        border: 2px solid #333;
    }
}