/* AI装配助手 - 聊天页面样式 */

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

html {
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    height: 100vh;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    width: 100%;
    padding: 0;
    margin: 0;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, #165DFF 0%, #1890FF 100%);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0e4acc 0%, #0e7afe 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(22, 93, 255, 0.3);
}

/* 头部样式 */
.standalone-header {
    background: #fff;
    color: #333;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    border-bottom: 1px solid #f0f0f0;
}

.standalone-header h1 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-points {
    font-size: 13px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    color: #e65100;
    padding: 4px 10px;
    border-radius: 20px;
}

.header-login-btn {
    background: none;
    color: #165DFF;
    border: none;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.header-login-btn:hover {
    color: #0e4acc;
    text-decoration: underline;
}

.header-new-chat-btn {
    background: #f5f5f5;
    color: #333;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header-new-chat-btn:hover {
    background: #e8e8e8;
    color: #165DFF;
}

.header-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.header-logout-btn {
    background: #f5f5f5;
    color: #666;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-more-btn {
    background: #f5f5f5;
    color: #333;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header-more-btn:hover {
    background: #e8e8e8;
}

/* 更多菜单侧边栏样式 */
.more-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.more-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.more-menu-sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 201;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.more-menu-sidebar.active {
    left: 0;
}

.more-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #165DFF 0%, #1890FF 100%);
    color: #fff;
}

.more-menu-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.more-menu-close {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.more-menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.more-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.more-menu-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
}

.more-menu-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #165DFF 0%, #1890FF 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.more-menu-user-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.more-menu-username {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.more-menu-points {
    font-size: 14px;
    color: #e65100;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.more-menu-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 16px 0;
}

.more-menu-section h4 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.more-menu-section h4 i {
    color: #165DFF;
}

.history-list {
    max-height: calc(100vh - 350px);
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 30px 0;
}

.history-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    background: #e8f4ff;
    transform: translateX(4px);
}

.history-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-time {
    font-size: 12px;
    color: #999;
}

.history-item-delete {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    float: right;
    transition: color 0.2s;
}

.history-item-delete:hover {
    color: #ff4d4f;
}

.more-menu-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
}

.more-menu-logout-btn {
    width: 100%;
    background: #fff;
    color: #ff4d4f;
    border: 1px solid #ff4d4f;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.more-menu-logout-btn:hover {
    background: #ff4d4f;
    color: #fff;
}

/* 主容器样式 */
.assistant-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 62px 15px 70px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.assistant-header {
    text-align: center;
    padding: 15px 0 10px;
    flex-shrink: 0;
}

.assistant-header p {
    color: #888;
    font-size: 14px;
    margin: 0;
}

.points-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    color: #e65100;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
}

/* 聊天区域样式 */
.chat-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px;
    background: #fff;
    border-radius: 12px 12px 0 0;
    border: 1px solid #e0e0e0;
    border-bottom: none;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.chat-area::-webkit-scrollbar { width: 6px; }
.chat-area::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* 欢迎卡片样式 */
.welcome-card {
    text-align: center;
    padding: 30px 0;
    color: #999;
}

.welcome-card .welcome-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 16px;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 20px rgba(22, 93, 255, 0.1);
}

.ai-assembly-logo {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-robot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: #4285f4;
    z-index: 3;
    animation: robotFloat 2s ease-in-out infinite;
}

.logo-screwdriver {
    position: absolute;
    top: 10%;
    right: 10%;
    font-size: 18px;
    color: #36CFC9;
    z-index: 2;
    animation: screwdriverRotate 3s linear infinite;
}

.logo-circuit {
    position: absolute;
    bottom: 10%;
    left: 10%;
    font-size: 18px;
    color: #FF7D00;
    z-index: 2;
    animation: circuitPulse 2.5s ease-in-out infinite;
}

@keyframes robotFloat {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-5px);
    }
}

@keyframes screwdriverRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes circuitPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}



.welcome-card h3 {
    font-size: 24px;
    color: #333;
    margin: 0 0 8px;
    font-weight: 600;
}

.welcome-card p {
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 24px;
    color: #888;
}

/* 推荐区域样式 */
.recommendations-section {
    margin-bottom: 24px;
}

.recommendations-section h4 {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px;
    font-weight: 500;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.recommendation-card {
    padding: 15px 10px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.recommendation-card:hover {
    border-color: #4285f4;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.1);
}

.recommendation-card p {
    font-size: 14px;
    color: #333;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 筛选器样式 */
.filters-section {
    padding: 8px 0 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
}

.filter-row {
    margin-bottom: 8px;
}

.filter-row:first-child {
    margin-bottom: 8px;
}

.filter-row::-webkit-scrollbar {
    display: none;
}

.filter-label {
    font-size: 13px;
    color: #192434;
    font-weight: 500;
    min-width: 40px;
    flex-shrink: 0;
}

.filter-tags {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.filter-tag {
    padding: 6px 14px;
    background: #f5f7fa;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    font-size: 13px;
    color: #192434;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.filter-tag.active,
.filter-tag:hover {
    background: linear-gradient(135deg, #e8f0fe 0%, #d0e4ff 100%);
    border-color: #4285f4;
    color: #4285f4;
}

/* 筛选器展开/收起按钮样式 */
.filter-toggle-row {
    display: flex;
    justify-content: center;
    margin-top: 4px;
}

.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f5f7fa;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    font-size: 12px;
    color: #192434;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-toggle-btn:hover {
    background: linear-gradient(135deg, #e8f0fe 0%, #d0e4ff 100%);
    border-color: #4285f4;
    color: #4285f4;
}

.filter-toggle-btn.expanded {
    background: linear-gradient(135deg, #e8f0fe 0%, #d0e4ff 100%);
    border-color: #4285f4;
    color: #4285f4;
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 10px;
}

.filter-toggle-btn.expanded .toggle-icon {
    transform: rotate(180deg);
}

.quick-prompts {
    display: none;
}

.quick-prompt-btn {
    padding: 8px 16px;
    border: 1px solid #d0d7de;
    background: #fff;
    border-radius: 20px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-prompt-btn:hover {
    border-color: #4285f4;
    color: #4285f4;
    background: #f0f6ff;
}

/* 消息样式 */
.msg-row {
    display: flex;
    margin-bottom: 16px;
    animation: msgFadeIn 0.3s ease;
}

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

.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.msg-row.user .msg-avatar { display: none; }
.msg-row.assistant .msg-avatar {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: #fff;
    margin-right: 10px;
}

.msg-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
}

.msg-row.user .msg-bubble {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.msg-row.user .msg-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 12px;
}

.msg-row.user .msg-bubble > * {
    position: relative;
    z-index: 1;
}

.msg-row.assistant .msg-bubble {
    background: #f5f7fa;
    color: #333;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
}

.msg-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.msg-time {
    font-size: 11px;
    color: #bbb;
}

.msg-row.user .msg-footer {
    flex-direction: row-reverse;
}

.msg-row.assistant .msg-footer {
    padding-left: 0;
}

.msg-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.msg-row:hover .msg-actions {
    opacity: 1;
}

.msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f5f7fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.msg-action-btn:hover {
    background: #e8f0fe;
    border-color: #4285f4;
    color: #4285f4;
}

.msg-action-btn i {
    font-size: 11px;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* 配件卡片样式 */
.parts-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    overflow: hidden;
}

.part-card {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    transition: all 0.2s;
    overflow: hidden;
    min-width: 0;
}

.part-card:hover {
    border-color: #4285f4;
    box-shadow: 0 2px 8px rgba(66,133,244,0.1);
}

.part-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    font-size: 16px;
}

.part-card-info { flex: 1; min-width: 0; }

.part-card-type {
    font-size: 11px;
    color: #888;
    margin-bottom: 2px;
}

.part-card-name {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.part-card-price {
    font-size: 14px;
    color: #e53935;
    font-weight: 600;
    margin-left: 10px;
    white-space: nowrap;
}

.part-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.jd-buy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    background: transparent;
    color: #e4393c;
    border: none;
    border-radius: 0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.jd-buy-btn:hover {
    background: transparent;
    transform: scale(1.1);
    box-shadow: none;
    color: #c62828;
}

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

/* 配件编辑功能样式 */
.part-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    color: #165DFF;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    gap: 4px;
}

.part-edit-btn:hover {
    background: transparent;
    transform: scale(1.1);
    color: #0E4ACC;
}

.part-edit-btn.save-btn {
    background: transparent;
    color: #00B42A;
}

.part-edit-btn.save-btn:hover {
    background: transparent;
    transform: scale(1.1);
    color: #009422;
}

.part-edit-btn.cancel-btn {
    background: transparent;
    color: #86909C;
}

.part-edit-btn.cancel-btn:hover {
    background: transparent;
    transform: scale(1.1);
    color: #6B7280;
}

.edit-part-name,
.edit-part-price,
.edit-part-url {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #E5E6EB;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.edit-part-name:focus,
.edit-part-price:focus,
.edit-part-url:focus {
    border-color: #165DFF;
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
}

.part-edit-form {
    padding: 12px;
    background-color: #F7F8FA;
    border-radius: 8px;
    margin-top: 8px;
}

.save-plan-section {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(22, 93, 255, 0.05), rgba(54, 207, 153, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(22, 93, 255, 0.1);
}

.save-plan-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: linear-gradient(135deg, #165DFF, #0E4ACC);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    gap: 8px;
}

.save-plan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(22, 93, 255, 0.3);
}

.plan-name-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #E5E6EB;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.plan-name-input:focus {
    border-color: #165DFF;
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
}

.save-plan-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* 配件选择弹窗样式 */
.part-select-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.part-select-modal.active {
    opacity: 1;
    visibility: visible;
}

.part-select-content {
    background-color: white;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.part-select-modal.active .part-select-content {
    transform: translateY(0);
}

.part-select-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E6EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.part-select-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1D2129;
}

.part-select-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #F2F3F5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #86909C;
    transition: all 0.2s;
}

.part-select-close:hover {
    background-color: #E5E6EB;
    color: #1D2129;
}

.part-select-search {
    padding: 16px 24px;
    border-bottom: 1px solid #E5E6EB;
}

.part-select-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #E5E6EB;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.part-select-search input:focus {
    border-color: #165DFF;
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
}

.part-select-list {
    padding: 24px;
    overflow-y: auto;
    max-height: 50vh;
}

.part-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid #E5E6EB;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.part-item:hover {
    border-color: #165DFF;
    background-color: #F7F8FA;
    transform: translateY(-2px);
}

.part-item.selected {
    border-color: #00B42A;
    background-color: rgba(0, 180, 42, 0.05);
}

.part-item-image {
    width: 80px;
    height: 80px;
    background-color: #F2F3F5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.part-item-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.part-item-info {
    flex: 1;
    min-width: 0;
}

.part-item-name {
    font-size: 15px;
    font-weight: 600;
    color: #1D2129;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.part-item-price {
    font-size: 18px;
    font-weight: 700;
    color: #E02020;
}

.part-select-footer {
    padding: 16px 24px;
    border-top: 1px solid #E5E6EB;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.part-select-footer button {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.part-select-cancel {
    background-color: #F2F3F5;
    color: #4E5969;
    border: none;
}

.part-select-cancel:hover {
    background-color: #E5E6EB;
}

.part-select-confirm {
    background: linear-gradient(135deg, #165DFF, #0E4ACC);
    color: white;
    border: none;
}

.part-select-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .save-plan-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .save-plan-btn {
        width: 100%;
    }
    
    .plan-name-input {
        width: 100%;
    }
    
    .part-select-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .part-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .part-item-image {
        width: 100%;
        height: 120px;
    }
}

.jd-buy-btn i,
.part-edit-btn i {
    font-size: 14px;
}

/* 响应元数据 */
.response-meta {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
}

.meta-tag.budget { background: #e3f2fd; color: #1565c0; }
.meta-tag.total { background: #e8f5e9; color: #2e7d32; }
.meta-tag.time { background: #f3e5f5; color: #7b1fa2; }

/* 响应文本 */
.response-text {
    margin-top: 10px;
    padding: 14px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #444;
    border: 1px solid #e0e5f0;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.05);
}

.response-text h1,
.response-text h2,
.response-text h3 {
    margin: 10px 0 6px;
    padding-bottom: 4px;
    border-bottom: 2px solid #e8ecf5;
    color: #2c3e50;
}

.response-text h1:first-child,
.response-text h2:first-child,
.response-text h3:first-child {
    margin-top: 0;
}

.response-text h1 { font-size: 17px; }
.response-text h2 { font-size: 15px; }
.response-text h3 { font-size: 14px; }

.response-text p {
    margin: 4px 0;
}

.response-text strong {
    color: #1a56db;
    font-weight: 600;
}

.response-text em {
    color: #666;
    font-style: italic;
}

.response-text ul,
.response-text ol {
    margin: 4px 0;
    padding-left: 20px;
    list-style: none;
}

.response-text li {
    position: relative;
    padding: 2px 0 2px 16px;
    margin-bottom: 2px;
}

.response-text li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #4285f4;
    font-weight: bold;
}

.response-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 13px;
}

.response-text th,
.response-text td {
    border: 1px solid #e0e5f0;
    padding: 6px 10px;
    text-align: left;
}

.response-text th {
    background: #e8ecf5;
    font-weight: 600;
    color: #2c3e50;
}

.response-text tr:nth-child(even) {
    background: #f8f9ff;
}

.response-text hr {
    border: none;
    border-top: 1px dashed #d0d7de;
    margin: 8px 0;
}

.response-text br + br {
    display: block;
    content: '';
    margin-top: 4px;
}

/* 导入按钮 */
.import-btn-wrap {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.import-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.import-btn.primary {
    background: linear-gradient(to right, #4285f4, #34a853);
    color: #fff;
}

.import-btn.primary:hover { opacity: 0.9; transform: translateY(-1px); }

/* 总价摘要 */
.total-price-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 8px;
    margin-top: 10px;
}

.total-price-summary .label {
    font-size: 14px;
    color: #2e7d32;
    font-weight: 500;
}

.total-price-summary .price {
    font-size: 20px;
    color: #1b5e20;
    font-weight: bold;
}

/* 输入区域 */
.input-area {
    padding: 15px;
    padding-bottom: calc(15px + 70px); /* 底部安全距离 */
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.input-row {
    display: flex;
    gap: 0;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.input-wrapper textarea {
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    padding: 12px 68px 12px 16px; /* 右侧留出发送按钮空间 */
    border: 2px solid #e0e7ff;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
    background: #f8fafc;
    color: #1e293b;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.input-wrapper textarea::placeholder {
    color: #94a3b8;
}

.input-wrapper textarea:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.send-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: absolute;
    right: 6px;
    bottom: 4px;
    overflow: hidden;
}

.send-btn i {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.send-btn:hover i {
    color: #3b82f6;
    transform: scale(1.1);
}

.send-btn:hover {
    transform: translateY(-2px);
}

.send-btn:active {
    transform: translateY(0) scale(0.95);
}

.send-btn:disabled {
    color: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.input-hint {
    font-size: 12px;
    color: #aaa;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.points-deducted-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #fff3e0;
    color: #e65100;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 6px;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: space-around;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 20px;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
}

.nav-item.active,
.nav-item:hover {
    color: #4285f4;
}

.nav-item i {
    font-size: 20px;
}

.nav-item span {
    font-size: 11px;
}

.nav-item.active {
    background: linear-gradient(135deg, #e8f0fe 0%, #d0e4ff 100%);
}

.nav-item.active i {
    position: relative;
}

.nav-item.active i::before {
    filter: drop-shadow(0 2px 4px rgba(66, 133, 244, 0.3));
}

/* 响应式设计 - 平板 */
@media (max-width: 768px) {
    html, body {
        overflow: hidden;
        overscroll-behavior: none;
        position: fixed;
        width: 100%;
        touch-action: pan-y;
    }
    .standalone-header { padding: 10px 12px; }
    .standalone-header h1 { font-size: 16px; }
    .header-points { font-size: 12px; padding: 3px 8px; }
    .assistant-container {
        padding: 56px 0 0;
        padding-bottom: 70px; /* 底部安全距离 */
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
    }
    .chat-area {
        flex: 1;
        padding: 12px;
        padding-bottom: 150px;
        background: #f5f7fa;
        border: none;
        border-radius: 0;
        overflow-x: hidden;
        overscroll-behavior: contain;
    }
    .chat-area::-webkit-scrollbar { width: 4px; }
    .chat-area::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
    .msg-row { padding: 0 8px; }
    .msg-row.assistant .msg-avatar { display: none; }
    .msg-bubble {
        max-width: 100%;
        font-size: 14px;
        line-height: 1.6;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .msg-row.user .msg-bubble {
        background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
        color: #fff;
        border-radius: 18px 18px 4px 18px;
        max-width: 85%;
    }
    .msg-row.assistant .msg-bubble {
        background: #fff;
        color: #333;
        border: 1px solid #e8e8e8;
        border-radius: 4px 18px 18px 18px;
        padding: 14px;
        width: 100%;
    }
    .msg-time { color: #bbb; font-size: 11px; }
    .msg-row.assistant .msg-time { padding-left: 0; }
    .welcome-card {
        padding: 20px 12px 20px;
        color: #999;
    }
    .welcome-card .welcome-icon { color: #4285f4; opacity: 0.6; }
    .welcome-card h3 { color: #555; font-size: 20px; }
    .welcome-card p { color: #888; }
    .recommendations-section {
        margin-bottom: 16px;
    }
    .recommendations-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding-bottom: 8px;
    }
    .recommendation-card {
        flex-shrink: 0;
        width: 100%;
        min-width: 0;
        padding: 12px 10px;
        background: #fff;
        border: 1px solid #e8e8e8;
        border-radius: 10px;
        cursor: pointer;
        text-align: center;
    }
    .recommendation-card p {
        font-size: 12px;
        color: #555;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .quick-prompt-btn {
        border-color: #d0d7de;
        background: #fff;
        color: #555;
        width: 100%;
        text-align: center;
    }
    .quick-prompt-btn:hover {
        border-color: #4285f4;
        background: #f0f6ff;
        color: #4285f4;
    }
    .input-area {
        position: fixed;
        bottom: 70px;
        left: 0;
        right: 0;
        background: #fff;
        border: none;
        border-top: 1px solid #e0e0e0;
        border-radius: 0;
        padding: 12px;
        z-index: 50;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    .input-wrapper textarea {
        background: #f8fafc;
        border: 2px solid #e0e7ff;
        color: #1e293b;
        border-radius: 16px;
        min-height: 48px;
        padding: 12px 68px 12px 16px; /* 右侧留出发送按钮空间 */
    }

    .input-wrapper textarea:focus {
        border-color: #3b82f6;
        background: #ffffff;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
        transform: translateY(-1px);
    }

    .input-wrapper textarea::placeholder { 
        color: #94a3b8; 
    }

    .send-btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: transparent;
        color: #64748b;
        position: absolute;
        right: 6px;
        bottom: 4px;
    }

    .send-btn:hover {
        transform: translateY(-2px);
    }

    .send-btn:hover i {
        color: #3b82f6;
        transform: scale(1.1);
    }
    .input-hint { color: #aaa; }
    .quick-prompts { flex-direction: column; align-items: center; gap: 6px; }
    .quick-prompt-btn { width: 100%; text-align: center; }
    .part-card {
        padding: 10px 12px;
        background: #fff;
        border-color: #e3e8ef;
        overflow: visible;
        min-width: 0;
        flex-wrap: wrap;
    }
    .part-card:hover { border-color: #4285f4; }
    .part-card-icon { width: 28px; height: 28px; font-size: 12px; flex-shrink: 0; }
    .part-card-info { flex: 1; min-width: 0; overflow: hidden; }
    .part-card-name { font-size: 12px; color: #333; white-space: normal; word-break: break-word; }
    .part-card-type { color: #888; font-size: 10px; }
    .part-card-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-left: auto;
        flex-shrink: 0;
    }
    .part-card-price { color: #e53935; font-size: 13px; flex-shrink: 0; }
    .jd-buy-btn {
        flex-shrink: 0;
        background: transparent;
        color: #e4393c;
        padding: 0;
        font-size: 10px;
    }
    
    .jd-buy-btn:hover {
        background: transparent;
        color: #c62828;
        transform: scale(1.1);
    }
    
    .jd-buy-btn span,
    .part-edit-btn span {
        display: inline;
    }
    
    .jd-buy-btn,
    .part-edit-btn {
        padding: 0;
        justify-content: center;
        min-width: auto;
        background: transparent;
    }
    .response-text {
        background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
        border: 1px solid #e0e5f0;
        color: #444;
        padding: 12px;
        border-radius: 10px;
        font-size: 13px;
        line-height: 1.45;
        box-shadow: 0 2px 8px rgba(66, 133, 244, 0.05);
    }
    .response-text h1 { font-size: 15px; }
    .response-text h2 { font-size: 14px; }
    .response-text h3 { font-size: 13px; }
    .response-text strong { color: #1a56db; }
    .response-text li { padding-left: 14px; font-size: 12px; margin-bottom: 1px; }
    .response-text table { font-size: 12px; }
    .response-text th, .response-text td { padding: 4px 8px; }
    .total-price-summary {
        background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    }
    .total-price-summary .label { color: #2e7d32; }
    .total-price-summary .price { color: #1b5e20; }
    .meta-tag.budget { background: #e3f2fd; color: #1565c0; }
    .meta-tag.total { background: #e8f5e9; color: #2e7d32; }
    .meta-tag.time { background: #f3e5f5; color: #7b1fa2; }
    .points-deducted-tag {
        background: #fff3e0;
        color: #e65100;
    }
    .import-btn-wrap { flex-direction: column; }
    .import-btn { width: 100%; justify-content: center; }
}


/* 响应式设计 - 手机 */
@media (max-width: 480px) {
    .standalone-header h1 { font-size: 15px; }
    .header-right { gap: 8px; }
    .header-points { display: none; }
    .msg-bubble { max-width: 95%; }
    .part-card-price { font-size: 12px; }
    .welcome-card .welcome-icon { font-size: 40px; }
    .welcome-card h3 { font-size: 18px; }
    .welcome-card p { font-size: 13px; }
}

/* 登录注册弹窗样式修复 */
#login-modal,
#register-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

#login-modal.hidden,
#register-modal.hidden {
    display: none !important;
}

#login-modal > div,
#register-modal > div {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
    margin: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
}

#login-modal .flex,
#register-modal .flex {
    display: flex;
}

#login-modal h2,
#register-modal h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1D2129;
}

#login-modal input,
#register-modal input,
#login-modal select,
#register-modal select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #C9CDD4;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
}

#login-modal input:focus,
#register-modal input:focus,
#login-modal select:focus,
#register-modal select:focus {
    border-color: #165DFF;
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.15);
}

#login-modal label,
#register-modal label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #4E5969;
    margin-bottom: 8px;
}

#login-modal button[type="submit"],
#register-modal button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #165DFF 0%, #1890FF 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#login-modal button[type="submit"]:hover,
#register-modal button[type="submit"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(22, 93, 255, 0.3);
}

#login-modal .space-y-4 > div,
#register-modal .space-y-4 > div {
    margin-bottom: 16px;
}

/* 底部导航栏样式修复 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: space-around;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

/* 删除确认弹窗样式 */
.delete-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.delete-confirm-modal.active {
    opacity: 1;
    visibility: visible;
}

.delete-confirm-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.delete-confirm-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    padding: 24px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.delete-confirm-modal.active .delete-confirm-content {
    transform: translateY(0);
}

.delete-confirm-header {
    text-align: center;
    margin-bottom: 20px;
}

.delete-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #ff6b6b;
}

.delete-confirm-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1d2129;
    margin: 0;
}

.delete-confirm-body {
    text-align: center;
    margin-bottom: 24px;
}

.delete-confirm-body p {
    font-size: 14px;
    color: #4e5969;
    line-height: 1.6;
    margin: 0;
}

.delete-confirm-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.delete-confirm-cancel,
.delete-confirm-delete {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.delete-confirm-cancel {
    background: #f2f3f5;
    color: #4e5969;
}

.delete-confirm-cancel:hover {
    background: #e5e6eb;
    transform: translateY(-1px);
}

.delete-confirm-delete {
    background: linear-gradient(135deg, #f53f3f 0%, #d93025 100%);
    color: #fff;
}

.delete-confirm-delete:hover {
    background: linear-gradient(135deg, #d93025 0%, #c1272d 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 63, 63, 0.3);
}

.delete-confirm-delete i {
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .delete-confirm-content {
        width: 95%;
        padding: 20px;
    }

    .delete-confirm-header h3 {
        font-size: 18px;
    }

    .delete-confirm-body p {
        font-size: 13px;
    }

    .delete-confirm-cancel,
    .delete-confirm-delete {
        padding: 8px 20px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    #login-modal > div,
    #register-modal > div {
        margin: 12px;
        padding: 24px;
        max-height: 85vh;
    }

    #login-modal h2,
    #register-modal h2 {
        font-size: 20px;
    }
}
