/**
 * 全新简化版样式 - 专注于解决滚动问题
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', sans-serif;
    background: #fafafa;
    overflow: hidden;
}

/* ========== 聊天模式页面 ========== */
.chat-page {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: white;
}

/* 顶部标题栏 - 固定60px */
.header-bar {
    height: 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.header-bar h1 {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
}

.phone-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
}

.phone-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* 顶部模式选择器 */
.mode-select-header {
    padding: 8px 35px 8px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%), url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='white' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 0 0, right 12px center;
    background-size: 100%, 10px 6px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mode-select-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.mode-select-header:focus {
    outline: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.mode-select-header option {
    background: white;
    color: #1d1d1f;
    padding: 10px;
}

/* 聊天记录区域 - 使用固定高度 */
.chat-messages {
    height: calc(100vh - 220px);
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 20px;
    background: #f5f5f7;
}

/* 强制显示滚动条 */
.chat-messages::-webkit-scrollbar {
    width: 12px;
    background: rgba(0, 0, 0, 0.05);
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Firefox滚动条 */
.chat-messages {
    scrollbar-width: auto;
    scrollbar-color: rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.05);
}

/* 欢迎消息 */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.welcome-message p {
    font-size: 20px;
    color: #86868b;
    margin-bottom: 10px;
}

.welcome-message .hint {
    font-size: 16px;
    color: #a0a0a5;
}

/* 消息样式 */
.message {
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}

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

/* 识别中动画 */
.message-content.recognizing {
    animation: recognizingPulse 1.5s ease-in-out infinite;
}

@keyframes recognizingPulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* 识别中的点点点效果 */
.message-content.recognizing::after {
    content: '';
    animation: recognizingDots 1.5s steps(4, end) infinite;
}

@keyframes recognizingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-ai {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
}

.message-user .message-content {
    background: #0071e3;
    color: white;
}

.message-ai .message-content {
    background: white;
    color: #1d1d1f;
    border: 1px solid #e0e0e0;
}

/* 底部输入区域 - 固定160px */
.input-area {
    height: 160px;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.input-hint {
    font-size: 13px;
    color: #86868b;
    margin: 0;
}

/* 录音按钮 */
.record-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0071e3 0%, #0077ed 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 6px 20px rgba(0, 113, 227, 0.3);
    transition: all 0.2s;
    user-select: none;
}

.record-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 113, 227, 0.4);
}

.record-button:active:not(:disabled) {
    transform: scale(0.95);
}

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

.record-button.recording {
    background: #ff3b30;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(255, 59, 48, 0.4);
    }
    50% {
        box-shadow: 0 6px 30px rgba(255, 59, 48, 0.6);
    }
}

.record-icon {
    font-size: 2.2em;
}

.record-text {
    font-size: 12px;
    font-weight: 500;
}

.status-text {
    font-size: 13px;
    color: #86868b;
    min-height: 18px;
    margin: 0;
}

/* 设置行 */
.settings-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.voice-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #86868b;
    cursor: pointer;
}

.voice-toggle input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.mode-select {
    padding: 6px 30px 6px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 16px;
    background: #f5f5f7;
    color: #1d1d1f;
    font-size: 13px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2386868b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* 电话模式样式 */
.phone-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
}

.phone-mode .phone-container {
    max-width: none;
    width: 100%;
    height: 100%;
    margin: 0;
}

.back-to-chat {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.back-to-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-messages {
        height: calc(100vh - 240px);
        padding: 16px;
    }

    .input-area {
        height: 180px;
    }

    .record-button {
        width: 90px;
        height: 90px;
    }

    .record-icon {
        font-size: 2em;
    }
}
