/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.container {
    width: 100%;
    max-width: 500px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 顶部导航 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.header h1 {
    font-size: 22px;
    margin-bottom: 8px;
    font-weight: 500;
}

.status {
    font-size: 14px;
    opacity: 0.9;
    padding: 5px 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    display: inline-block;
}

.status.connected {
    background: rgba(76, 217, 100, 0.8);
}

.status.calling {
    background: rgba(255, 204, 0, 0.8);
}

/* 语音通话区域 */
.voice-container {
    padding: 40px 20px;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    display: flex;
    justify-content: space-around;
    align-items: center;
    min-height: 300px;
    position: relative;
}

/* 用户头像 */
.user-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.avatar-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.user-avatar.remote .avatar-circle {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.user-avatar.speaking .avatar-circle {
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(102, 126, 234, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

.avatar-icon {
    font-size: 50px;
}

.user-name {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

/* 音频指示器 */
.audio-indicator {
    display: none;
    align-items: flex-end;
    gap: 4px;
    height: 30px;
}

.audio-indicator.active {
    display: flex;
}

.wave {
    width: 4px;
    height: 8px;
    background: #667eea;
    border-radius: 2px;
    animation: wave-animation 1s ease-in-out infinite;
}

.wave:nth-child(2) {
    animation-delay: 0.2s;
}

.wave:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes wave-animation {
    0%, 100% {
        height: 8px;
    }
    50% {
        height: 24px;
    }
}

/* 通话时长 */
.call-duration {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    display: none;
    justify-content: space-between;
    align-items: center;
}

.call-duration.active {
    display: flex;
}

.duration-label {
    font-size: 14px;
    color: #666;
}

.duration-time {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

/* 控制按钮 */
.controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 25px 20px;
    background: #f8f9fa;
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border: none;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn .icon {
    font-size: 28px;
    margin-bottom: 2px;
}

.control-btn .label {
    font-size: 11px;
    color: #666;
}

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

.control-btn.active .label {
    color: white;
}

.control-btn.disabled {
    background: #dc3545;
}

.control-btn.disabled .icon {
    opacity: 0.5;
}

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

.hangup-btn .label {
    color: white;
}

.hangup-btn:hover {
    background: #c82333;
}

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

.speaker-btn .label {
    color: white;
}

/* 房间信息 */
.room-info {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-info p {
    font-size: 14px;
    color: #666;
}

#roomId {
    font-weight: bold;
    color: #667eea;
    margin-left: 5px;
}

.copy-btn {
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

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

/* 连接质量 */
.connection-quality {
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.quality-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffc107;
    animation: blink 2s infinite;
}

.quality-dot.good {
    background: #28a745;
    animation: none;
}

.quality-dot.poor {
    background: #dc3545;
}

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

/* 移动端适配 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .header h1 {
        font-size: 18px;
    }

    .voice-container {
        padding: 30px 15px;
        min-height: auto;
        flex: 1;
    }

    .avatar-circle {
        width: 80px;
        height: 80px;
    }

    .avatar-icon {
        font-size: 40px;
    }

    .user-name {
        font-size: 14px;
    }

    .controls {
        padding: 20px 15px;
    }

    .control-btn {
        width: 60px;
        height: 60px;
    }

    .control-btn .icon {
        font-size: 24px;
    }

    .control-btn .label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 16px;
    }

    .status {
        font-size: 12px;
        padding: 4px 12px;
    }

    .avatar-circle {
        width: 70px;
        height: 70px;
    }

    .avatar-icon {
        font-size: 35px;
    }

    .control-btn {
        width: 55px;
        height: 55px;
    }

    .control-btn .icon {
        font-size: 22px;
    }

    .room-info {
        flex-direction: column;
        gap: 10px;
        padding: 12px 20px;
    }

    .room-info p {
        font-size: 13px;
    }
}

/* 启动按钮覆盖层 */
.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.start-container {
    text-align: center;
    color: white;
    padding: 40px;
    max-width: 400px;
    width: 90%;
}

.start-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.start-container h2 {
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 500;
}

.start-hint {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 30px;
}

.start-btn {
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 500;
    color: #667eea;
    background: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-bottom: 30px;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

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

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

.room-preview {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.room-preview p {
    font-size: 14px;
    margin: 0;
    opacity: 0.95;
}

#roomIdPreview {
    font-weight: bold;
    font-size: 16px;
    letter-spacing: 1px;
}

/* 移动端适配 - 启动按钮 */
@media (max-width: 768px) {
    .start-container {
        padding: 30px 20px;
    }

    .start-icon {
        font-size: 60px;
    }

    .start-container h2 {
        font-size: 24px;
    }

    .start-hint {
        font-size: 14px;
    }

    .start-btn {
        padding: 12px 40px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .start-icon {
        font-size: 50px;
    }

    .start-container h2 {
        font-size: 20px;
    }

    .start-btn {
        padding: 10px 35px;
        font-size: 15px;
    }

    .room-preview p {
        font-size: 13px;
    }

    #roomIdPreview {
        font-size: 14px;
    }
}
