/* 基础样式设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
}

#app {
    max-width: 414px;
    margin: 0 auto;
    background-color: #e8f4ff;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    overflow-x: hidden;
}

/* 头部样式 */
.header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #ffffff;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 60px;
    z-index: 100;
    width: 414px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.back-button, .close-button {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #333;
}

.header h1 {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

/* AI助手容器 */
.assistant-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    text-align: center;
    margin-bottom: 80px; /* 增加底部边距，为固定的输入框留出空间 */
    margin-top: 60px; /* 为固定顶栏留出空间 */
}

.assistant-avatar {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.assistant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.assistant-greeting h2 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #333;
}

.assistant-greeting p {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* 快捷操作区域 */
.quick-actions {
    padding: 0 15px;
    margin-bottom: 20px;
    margin-top: -90px;
}

.action-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.action-item {
    width: 30%;
    background-color: #fff;
    border-radius: 10px;
    padding: 15px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.action-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.action-name {
    font-size: 14px;
    color: #333;
    text-align: center;
}

.action-icon {
    position: relative;
}

.badge {
    position: absolute;
    top: -18px;
    right: -38px;
    width: 16px;
    height: 16px;
    background-color: #ff4d4f;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px #fff;
}

/* 历史提问区域 */
.history-section {
    padding: 0 15px;
    margin-bottom: 70px;
}

.history-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
    font-weight: normal;
}

.history-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background-color: #fff;
    border-radius: 20px;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.history-text {
    font-size: 14px;
    color: #333;
}

.history-tag {
    font-size: 16px;
}

/* 输入区域 */
.input-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 414px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background-color: #fff;
    border-top: 1px solid #eee;
    z-index: 100;
}

.input-section input {
    flex: 1;
    height: 40px;
    border: none;
    border-radius: 20px;
    background-color: #f5f5f5;
    padding: 0 15px;
    font-size: 14px;
    outline: none;
}

.voice-input {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.voice-input img {
    width: 24px;
    height: 24px;
}

/* AI处理中状态 */
.ai-processing {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 15px 0;
    animation: fadeIn 0.3s ease-in-out;
}

.processing-indicator {
    display: flex;
    gap: 4px;
    margin-bottom: 5px;
}

.processing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #1890ff;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.processing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.processing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.processing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

.processing-text {
    font-size: 14px;
    color: #666;
}

/* 用户消息 */
.user-message {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    margin: 15px 0;
    animation: fadeIn 0.3s ease-in-out;
}

.user-message .message-content {
    background-color: #1890ff;
    color: white;
    border-radius: 12px 0 12px 12px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 70%;
}

/* AI回复 */
.ai-response {
    width: 100%;
    display: flex;
    margin: 15px 0;
    animation: fadeIn 0.3s ease-in-out;
}

.response-avatar {
    width: 36px;
    height: 36px;
    margin-right: 10px;
    flex-shrink: 0;
}

.response-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.response-content {
    background-color: #fff;
    border-radius: 0 12px 12px 12px;
    padding: 12px;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    max-width: calc(100% - 60px);
}

/* 报修确认 */
.repair-confirmation {
    width: 100%;
    background-color: #fff;
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease-in-out;
}

.confirmation-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.confirmation-header img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
}

.confirmation-header h3 {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.confirmation-content {
    margin-bottom: 15px;
}

.confirmation-content p {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.5;
}

.confirmation-content ul {
    list-style: none;
    margin-bottom: 15px;
}

.confirmation-content li {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.5;
}

.confirmation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.confirmation-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.cancel-btn {
    background-color: #f5f5f5;
    color: #666;
}

.confirm-btn {
    background-color: #1890ff;
    color: white;
}

/* 卡片式回复 */
.card-response {
    width: 100%;
    background-color: #fff;
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease-in-out;
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.card-header img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
}

.card-header h3 {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.card-content {
    margin-bottom: 15px;
}

.card-content p {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
}

/* 业主列表 */
.owner-list {
    margin-bottom: 15px;
    max-height: 250px;
    overflow-y: auto;
}

.owner-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.owner-item:last-child {
    border-bottom: none;
}

.owner-checkbox {
    margin-right: 10px;
}

.owner-checkbox input[type="checkbox"] {
    display: none;
}

.owner-checkbox label {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.owner-checkbox input[type="checkbox"]:checked + label {
    background-color: #1890ff;
    border-color: #1890ff;
}

.owner-checkbox input[type="checkbox"]:checked + label:after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.owner-info {
    flex: 1;
}

.owner-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.owner-room {
    font-size: 12px;
    color: #999;
    margin-left: 5px;
}

.owner-date, .owner-overdue {
    font-size: 12px;
    color: #666;
}

.owner-overdue {
    color: #ff4d4f;
}

/* 短信模板 */
.message-template {
    margin-top: 15px;
}

.message-template h4 {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    font-weight: normal;
}

.message-template textarea {
    width: 100%;
    height: 80px;
    padding: 10px;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
    resize: none;
}

/* 卡片操作按钮 */
.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.card-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

.select-all-btn {
    background-color: #f5f5f5;
    color: #666;
}

.send-btn {
    background-color: #1890ff;
    color: white;
}

/* 发送状态 */
.sending-status {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.sending-status span {
    font-size: 14px;
}

/* 发送成功提示 */
.send-success {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f6ffed;
    border: 1px solid #b7eb8f;
    padding: 10px 15px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideDown 0.3s ease-in-out;
}

.success-icon {
    width: 24px;
    height: 24px;
    background-color: #52c41a;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 14px;
}

.success-message h4 {
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
}

.success-message p {
    font-size: 12px;
    color: #666;
}

.send-success.fade-out {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    transition: all 0.3s ease-in-out;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 响应式调整 */
@media (max-width: 320px) {
    .action-name {
        font-size: 12px;
    }
    
    .history-text {
        font-size: 13px;
    }
}

/* 确保顶栏在所有设备上正确显示 */
@media (max-width: 414px) {
    .header {
        width: 100%;
        left: 0;
        transform: none;
    }
}
