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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    display: flex;
    padding: 10px;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eaeaea;
    flex-shrink: 0;
}

.chat-box {
    flex: 1;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    margin-bottom: 15px;
    background-color: #f9f9f9;
    min-height: 100px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 15px;
    border-radius: 18px;
    word-wrap: break-word;
    max-width: 80%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    line-height: 1.4;
}

.user-message {
    background: #e3f2fd;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.ai-message {
    background: #fff;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.loading-message {
    background: #fff3cd !important;
    border: 1px solid #ffeeba;
    animation: pulse 1.5s infinite;
}

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

.input-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #eaeaea;
    padding-top: 15px;
}

/* 顶部工具栏 */
.model-select-container {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.model-select {
    flex: 1;
    padding: 6px 8px 6px;
    padding-right: 24px;
    border: 1px solid #ddd;
    border-radius: 18px;
    font-size: 14px;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23555' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 8px center;
    color: #555;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    min-width: 85px;
}

.model-select:focus {
    border-color: #007AFF;
    outline: none;
}

/* 按钮样式 */
button {
    padding: 8px 15px;
    border: none;
    border-radius: 18px;
    font-size: 14px;
    color: white;
    height: 36px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-upload, .btn-clear {
    flex: 1;
    min-width: 85px;
}

.btn-upload {
    background: #28a745;
}

.btn-upload:hover {
    background: #218838;
}

.btn-clear {
    background: #f44336;
}

.btn-clear:hover {
    background: #d32f2f;
}

button[onclick="sendMessage()"] {
    background: #007AFF;
    height: 36px;
    align-self: center;
    min-width: 85px;
}

button[onclick="sendMessage()"]:hover {
    background: #0056b3;
}

/* 输入框 */
.input-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    position: relative;
}

textarea {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 18px;
    resize: none;
    height: 88px;
    line-height: 1.4;
    font-size: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

textarea:focus {
    outline: none;
    border-color: #007AFF;
}

/* 图片样式 */
.image-preview, .message img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.image-preview {
    margin: 10px 0;
    display: none;
}

.message img {
    margin-top: 10px;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 12px;
        border-radius: 8px;
    }
    
    .page-title {
        font-size: 18px;
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
    
    .model-select-container {
        gap: 6px;
    }
    
    .model-select, .btn-upload, .btn-clear {
        flex: 1;
        min-width: 0;
        font-size: 13px;
        padding: 6px 8px;
    }
    
    .btn-upload, .btn-clear {
        height: 32px;
    }
    
    .message {
        max-width: 85%;
    }
    
    textarea {
        height: 64px;
    }
    
    button[onclick="sendMessage()"] {
        height: 40px;
        min-width: 60px;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .container {
        padding: 10px;
        border-radius: 0;
    }
    
    .page-title {
        font-size: 16px;
        margin-bottom: 10px;
        padding-bottom: 10px;
    }
    
    .model-select-container {
        gap: 4px;
    }
    
    .model-select, .btn-upload, .btn-clear {
        font-size: 12px;
        padding: 5px 6px;
    }
    
    .model-select {
        padding-right: 20px;
    }
    
    .btn-upload, .btn-clear {
        height: 30px;
    }
    
    .message {
        max-width: 90%;
    }
    
    textarea {
        height: 60px;
    }
    
    button[onclick="sendMessage()"] {
        height: 28px;
        min-width: 70px;
    }
}
