/* 移动优先的基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari */
    display: flex;
    flex-direction: column;
    margin: 0; /* 移除默认边距 */
    padding: 0; /* 移除默认内边距 */
}

/* 顶部标题样式 - 移动优先设计 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative; /* 改为相对定位，随页面滚动 */
    z-index: 100;
    min-height: 60px; /* 确保移动端最小高度 */
}

.nav-container {
    display: flex;
    justify-content: flex-start; /* 左对齐标题 */
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 60px; /* 移动端导航容器最小高度 */
}

.page-title {
    font-size: 1.25rem; /* 移动端稍小字体 */
    font-weight: bold;
    text-align: left; /* 左对齐标题 */
    line-height: 1.3; /* 增加移动端行高 */
    padding: 0 10px; /* 移动端增加内边距 */
    margin-right: auto; /* 推动菜单到右侧 */
}

.nav-menu {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: auto; /* 确保菜单靠右 */
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-size: 0.9rem;
    cursor: pointer;
}

.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.75rem; /* 增加移动端触控区域 */
    min-width: auto;
    min-height: 48px; /* 移动端推荐的最小触控尺寸 */
    border-radius: 8px; /* 移动端增加圆角 */
    transition: background-color 0.2s ease; /* 移动端添加过渡效果 */
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
    margin-left: auto; /* 确保汉堡菜单靠右 */
}

.mobile-menu-toggle:active {
    background-color: rgba(255, 255, 255, 0.1); /* 移动端点击反馈 */
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        flex-direction: column;
        padding: 0.75rem; /* 减少移动端内边距 */
        box-shadow: 0 4px 15px rgba(0,0,0,0.2); /* 更强的阴影 */
        border-radius: 0 0 8px 8px; /* 移动端添加底部圆角 */
        gap: 0.5rem; /* 移动端减少间距 */
    }
    
    .nav-menu.active {
        display: flex;
        animation: slideDown 0.3s ease-out; /* 移动端添加动画 */
    }
    
    .nav-menu a {
        width: 100%;
        text-align: left; /* 移动端改为左对齐 */
        margin-bottom: 0;
        padding: 1rem; /* 增加移动端内边距 */
        border-radius: 6px; /* 移动端增加圆角 */
        transition: background-color 0.2s ease; /* 移动端添加过渡 */
        font-size: 1rem; /* 移动端增大字体 */
        min-height: 48px; /* 移动端最小触控尺寸 */
        display: flex; /* 移动端使用flex布局 */
        align-items: center; /* 移动端垂直居中 */
        gap: 0.75rem; /* 移动端增加图标和文字间距 */
    }
    
    .nav-menu a:active {
        background-color: rgba(255, 255, 255, 0.15); /* 移动端点击反馈 */
    }
    
    /* 移动端帮助图标按钮适配 */
    .help-icon-btn {
        min-width: 44px; /* 移动端增大触控区域 */
        min-height: 44px; /* 移动端增大触控区域 */
        font-size: 1.4rem; /* 移动端增大图标 */
        padding: 0.6rem; /* 移动端增大内边距 */
    }
}

.page-title {
    font-size: 1.25rem; /* 移动端稍小字体 */
    font-weight: bold;
    text-align: left; /* 左对齐标题 */
    line-height: 1.3; /* 增加移动端行高 */
    padding: 0 10px; /* 移动端增加内边距 */
    flex: 1; /* 移动端允许标题占据可用空间 */
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 改为左对齐，移除元素间间隙 */
    gap: 0.3rem; /* 减小间距，使元素更紧凑 */
}

/* 帮助图标按钮样式 */
.help-icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: 0; /* 移除左侧边距 */
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

.help-icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.help-icon-btn:active {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(0.95);
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    padding: 8px 16px; /* 减少顶部padding以消除间隙 */
    padding-bottom: 16px; /* 减少底部padding */
}

/* 底部footer样式 - 基于ws/index.html设计 */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    position: relative; /* 改为相对定位，避免浮动问题 */
    margin-top: auto; /* 推到底部 */
    width: 100%;
    font-size: 0.875rem;
}

.footer-text {
    margin: 0;
}

/* 调整container样式 */
.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 0; /* 移除底部边距以消除间隙 */
}

h1 {
    color: #2c3e50;
    margin-bottom: 24px;
    font-size: 22px; /* 移动端稍小字体 */
    text-align: center;
    line-height: 1.3; /* 增加移动端行高 */
    padding: 0 10px; /* 移动端增加内边距 */
    word-wrap: break-word; /* 移动端允许换行 */
}

.form-group {
    margin-bottom: 24px; /* 增加移动端间距 */
}

/* 表单头部 - 标签和AI按钮水平对齐 */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px; /* 标签和文本框之间的间距 */
    gap: 12px; /* 标签和按钮之间的间距 */
}

label {
    display: flex;
    align-items: center;
    margin-bottom: 0; /* 移除底部间距，由form-header控制 */
    font-weight: 600;
    color: #555;
    font-size: 15px; /* 增大移动端字体 */
    line-height: 1.4; /* 增加移动端行高提升可读性 */
    flex: 1; /* 允许标签占据可用空间 */
    word-wrap: break-word; /* 允许长标签换行 */
}

textarea {
    width: 100%;
    padding: 14px; /* 增加移动端内边距 */
    border: 2px solid #e1e8ed;
    border-radius: 8px; /* 更大的圆角提升移动端体验 */
    font-size: 16px; /* 防止移动端缩放，使用16px作为基础 */
    resize: vertical;
    transition: border-color 0.3s ease, box-shadow 0.3s ease; /* 增加阴影过渡 */
    min-height: 120px; /* 增加移动端最小高度 */
    font-family: inherit;
    -webkit-appearance: none; /* 移除移动端默认样式 */
    appearance: none;
    touch-action: manipulation; /* 优化触摸响应 */
}

textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2); /* 更强的焦点指示 */
    transform: translateY(-1px); /* 微妙的提升效果 */
}

/* 移动端触摸反馈 */
textarea:active {
    transform: translateY(0);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.3);
}

/* 移动端快速滚动优化 */
textarea {
    -webkit-overflow-scrolling: touch; /* iOS平滑滚动 */
    overscroll-behavior: contain; /* 防止滚动穿透 */
}

/* 移动端输入框额外优化 */
.form-group textarea {
    -webkit-user-select: text; /* iOS文本选择优化 */
    user-select: text;
    -webkit-touch-callout: default; /* 允许长按菜单 */
    touch-action: manipulation; /* 优化触摸响应 */
}

/* 移动端表单焦点管理 */
.form-group {
    position: relative; /* 为移动端定位提供参考 */
}

/* 移动端标签点击区域扩大 */
label {
    cursor: pointer; /* 移动端可点击指示 */
    -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 移动端表单头部特殊处理 */
@media (max-width: 480px) {
    .form-header {
        flex-direction: column; /* 超小屏幕垂直排列 */
        align-items: flex-start; /* 左对齐 */
        gap: 8px; /* 减小间距 */
    }
    
    .form-header label {
        width: 100%; /* 标签占满宽度 */
    }
    
    .form-header .ai-suggest-btn {
        align-self: flex-end; /* 按钮右对齐 */
        margin-top: 4px; /* 添加顶部间距 */
    }
}

/* 移动端标签触摸反馈 */
label:active {
    opacity: 0.8;
}

.btn-container {
    display: flex;
    gap: 16px; /* 增加移动端按钮间距 */
    margin-top: 32px; /* 增加移动端顶部间距 */
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

button {
    padding: 16px 28px; /* 增加移动端内边距 */
    border: none;
    border-radius: 8px; /* 更大的圆角提升移动端体验 */
    font-size: 15px; /* 增大移动端字体 */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 52px; /* 增加移动端触控目标尺寸 */
    touch-action: manipulation;
    min-width: 240px; /* 增加移动端最小宽度 */
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* 增加图标和文字间距 */
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a3f9e);
    transform: translateY(-2px); /* 增强悬停效果 */
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4); /* 更强的阴影 */
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); /* 移动端点击效果 */
}

.btn-secondary {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5aa7ff, #0773cc);
    transform: translateY(-2px); /* 增强悬停效果 */
    box-shadow: 0 6px 16px rgba(116, 185, 255, 0.4); /* 更强的阴影 */
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(116, 185, 255, 0.3); /* 移动端点击效果 */
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 0 auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.modal-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e8ed;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    background: none;
    border: none;
    min-width: auto;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}

/* 使用说明模态框样式 */
.help-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.help-section {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.help-section:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.help-section h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #2c3e50;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section h3 i {
    color: #667eea;
}

.help-section p {
    margin-bottom: 12px;
    color: #495057;
    line-height: 1.5;
}

.help-section ul {
    margin: 0;
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
    color: #495057;
    line-height: 1.5;
}

.help-section li:last-child {
    margin-bottom: 0;
}

/* 移动端模态框适配 */
@media (max-width: 768px) {
    .modal-content {
        margin: 0 auto;
        width: 95%;
        padding: 15px;
        max-height: 85vh;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    
    .modal-content::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .close {
        font-size: 24px;
    }

    .help-section {
        padding: 12px;
    }

    .help-section h3 {
        font-size: 1.1rem;
    }
}

/* Ask AI 聊天模态框样式 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 60vh;
    max-height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #e9ecef;
}

.chat-message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.chat-message.user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    text-align: right;
}

.chat-message.ai {
    background: white;
    color: #2d3748;
    border: 1px solid #e2e8f0;
    margin-right: auto;
}

.chat-message .message-content {
    line-height: 1.5;
    font-size: 14px;
}

.chat-message .message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input-container textarea {
    flex: 1;
    min-height: 60px;
    max-height: 120px;
    resize: vertical;
    margin-bottom: 0;
}

.chat-input-container button {
    min-width: 80px;
    height: 60px;
    margin-bottom: 0;
}

/* 移动端聊天适配 */
@media (max-width: 768px) {
    .chat-container {
        height: 70vh;
        max-height: none;
    }

    .chat-messages {
        padding: 12px;
        margin-bottom: 12px;
    }

    .chat-message {
        max-width: 90%;
        padding: 10px 14px;
        margin-bottom: 10px;
    }

    .chat-input-container {
        flex-direction: column;
        gap: 8px;
    }

    .chat-input-container textarea {
        min-height: 80px;
    }

    .chat-input-container button {
        width: 100%;
        height: 48px;
        min-width: auto;
    }
}

/* 聊天加载状态 */
.chat-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.chat-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

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

/* AI输出容器样式 - 与troubleshooting部门格式一致 */
.ai-output-container {
    margin-top: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.ai-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #ddd;
}

.ai-output-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.ai-output-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    margin-right: 8px;
    border-radius: 2px;
}

.ai-output-content {
    padding: 15px;
    background-color: white;
}

.ai-result {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #333;
    font-size: 14px;
    background-color: white;
    border-radius: 4px;
}

/* 移动端AI输出适配 */
@media (max-width: 768px) {
    .ai-output-container {
        margin-top: 8px;
    }
    
    .ai-output-header {
        padding: 8px 12px;
    }
    
    .ai-output-title {
        font-size: 13px;
    }
    
    .ai-output-content {
        padding: 12px;
    }
    
    .ai-result {
        font-size: 13px;
        line-height: 1.5;
    }
}

.upload-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid #ecf0f1;
}

.saved-problems {
    margin-top: 40px; /* 在已保存的问题部分添加上边距，与按钮区域形成清晰分隔 */
    padding-top: 24px; /* 添加内边距增强视觉分隔效果 */
}

.saved-problems h2 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-size: 18px; /* 移动端稍小字体 */
    text-align: center; /* 移动端居中显示 */
    line-height: 1.3; /* 增加移动端行高 */
    padding: 0 10px; /* 移动端增加内边距 */
    word-wrap: break-word; /* 移动端允许换行 */
}

.problem-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.problem-card:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.problem-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.problem-card h3 {
    color: #495057;
    margin-bottom: 0;
    font-size: 16px;
    flex: 1;
    margin-right: 8px;
}

.delete-btn {
    background: #dc3545;
    border: none;
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

.delete-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

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

.delete-btn svg {
    width: 14px;
    height: 14px;
}

.problem-card p {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 4px;
}

.timestamp {
    color: #adb5bd;
    font-size: 12px;
    text-align: right;
}

/* 响应式调整 */
@media (min-width: 768px) {
    .page-title {
        font-size: 1.8rem;
    }
    
    /* 桌面端帮助图标按钮适配 */
    .help-icon-btn {
        min-width: 40px; /* 桌面端适中触控区域 */
        min-height: 40px; /* 桌面端适中触控区域 */
        font-size: 1.3rem; /* 桌面端适中图标大小 */
        padding: 0.55rem; /* 桌面端适中内边距 */
    }
    
    .main-content {
        padding: 8px 24px; /* 保持垂直padding，水平padding与control-panel保持一致 */
        padding-bottom: 24px; /* 桌面端也使用相对定位的padding */
    }
    
    .saved-problems {
        margin-top: 48px; /* 平板端增加间距 */
        padding-top: 32px; /* 平板端增加内边距 */
    }
    
    .footer {
        font-size: 14px;
        padding: 20px;
        position: relative;
        margin-top: auto;
    }
}

@media (min-width: 1025px) {
    .page-title {
        font-size: 2rem;
    }
    
    /* 大屏幕帮助图标按钮适配 */
    .help-icon-btn {
        min-width: 42px; /* 大屏幕稍大触控区域 */
        min-height: 42px; /* 大屏幕稍大触控区域 */
        font-size: 1.35rem; /* 大屏幕稍大图标 */
        padding: 0.6rem; /* 大屏幕稍大内边距 */
    }
    
    .main-content {
        padding: 32px;
        padding-bottom: 32px; /* 大屏幕也使用相对定位的padding */
    }
    
    .saved-problems {
        margin-top: 56px; /* 桌面端使用更大的间距 */
        padding-top: 40px; /* 桌面端使用更大的内边距 */
    }
    
    .footer {
        position: relative;
        margin-top: auto;
    }
}
@media (min-width: 768px) {
    body {
        padding: 0; /* 移除body padding以消除间隙 */
    }

    .container {
        padding: 32px;
        max-width: 800px;
        margin-bottom: 0; /* 移除容器底部边距 */
    }

    h1 {
        font-size: 28px;
        text-align: left;
    }

    .btn-container {
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }

    button {
        min-width: 240px; /* 平板端适中按钮宽度 */
        font-size: 15px; /* 平板端适中字体 */
        padding: 16px 28px; /* 平板端适中内边距 */
        min-height: 52px; /* 平板端适中触控尺寸 */
    }

    textarea {
        min-height: 120px;
        font-size: 15px;
    }

    /* 平板端表单头部布局 */
    .form-header {
        margin-bottom: 12px; /* 平板端稍大的间距 */
        gap: 16px; /* 平板端更大的间距 */
    }

    /* 平板端AI建议按钮优化 */
    .ai-suggest-btn {
        padding: 6px 14px; /* 紧凑的内边距 */
        min-height: 34px; /* 适中的触控高度 */
        font-size: 13px; /* 标准字体大小 */
        gap: 4px; /* 紧凑的图标间距 */
    }
}

/* 桌面设备样式 (>1024px) */
@media (min-width: 1025px) {
    body {
        padding: 0; /* 移除body padding以消除间隙 */
    }

    .container {
        max-width: 1000px;
        padding: 48px;
        margin-bottom: 0; /* 移除容器底部边距 */
    }

    h1 {
        font-size: 32px;
        margin-bottom: 32px;
    }

    .form-group {
        margin-bottom: 24px;
    }

    label {
        font-size: 15px;
    }

    textarea {
        min-height: 150px;
        font-size: 16px;
        padding: 16px;
    }

    .btn-container {
        gap: 16px;
        justify-content: center;
        align-items: center;
    }

    button {
        min-width: 260px; /* 更大的按钮 */
        font-size: 16px; /* 桌面端更大字体 */
        padding: 18px 32px; /* 桌面端增加内边距 */
        min-height: 56px; /* 桌面端更高按钮 */
    }

    /* 桌面端表单头部布局 */
    .form-header {
        margin-bottom: 14px; /* 桌面端更大的间距 */
        gap: 20px; /* 桌面端更大的间距 */
    }

    /* 桌面端AI建议按钮优化 */
    .ai-suggest-btn {
        padding: 6px 16px; /* 紧凑的内边距 */
        min-height: 36px; /* 适中的触控高度 */
        font-size: 13px; /* 标准字体大小 */
        gap: 4px; /* 紧凑的图标间距 */
    }

    .saved-problems {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 16px;
    }

    .problem-card {
        margin-bottom: 0;
    }
}

/* 加载动画 */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

/* Font Awesome 图标样式 */
.fas {
    margin-right: 6px;
}

.control-label .fas {
    margin-right: 8px;
    color: #667eea;
}

.ai-suggest-btn .fas {
    margin-right: 4px;
}

h2 .fas {
    margin-right: 10px;
    color: #667eea;
}

/* 表单标签图标样式 */
.form-group label .fas {
    margin-right: 8px;
    color: #667eea;
    font-size: 16px;
}

/* 浮动消息图标样式 - 移动优先设计 */
.floating-message-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
    touch-action: manipulation; /* 优化触摸响应 */
    min-width: 56px; /* 确保最小触控尺寸 */
    min-height: 56px; /* 确保最小触控尺寸 */
}

.floating-message-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.floating-message-icon:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.floating-message-icon i {
    color: white;
    font-size: 24px;
    margin: 0; /* 移除默认边距 */
    line-height: 1; /* 确保图标居中 */
}

/* 平板设备样式 (768px-1024px) */
@media (min-width: 768px) {
    .floating-message-icon {
        width: 60px;
        height: 60px;
        bottom: 30px;
        right: 30px;
    }

    .floating-message-icon i {
        font-size: 26px;
    }
}

/* 桌面设备样式 (>1024px) */
@media (min-width: 1025px) {
    .floating-message-icon {
        width: 64px;
        height: 64px;
        bottom: 40px;
        right: 40px;
    }

    .floating-message-icon i {
        font-size: 28px;
    }
}

.loading.active {
    display: block;
}

/* 成功提示 */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.success-message.active {
    display: block;
}

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

/* 加载状态 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-overlay .loading-spinner-overlay {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* AI建议按钮样式 - 移动优先设计 */
.textarea-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px; /* 增加移动端间距 */
}

/* AI建议按钮 - 基础样式 */
.ai-suggest-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px; /* 紧凑的内边距，精确适应文本 */
    border-radius: 6px; /* 适中的圆角 */
    cursor: pointer;
    font-size: 13px; /* 稍小的字体 */
    transition: all 0.2s ease;
    min-height: 32px; /* 最小触控高度 */
    height: auto; /* 自动高度 */
    display: flex;
    align-items: center;
    justify-content: center; /* 居中对齐 */
    gap: 4px; /* 紧凑的图标间距 */
    width: auto !important; /* 自动宽度适应文本 */
    max-width: none !important; /* 移除最大宽度限制 */
    min-width: auto !important; /* 移除最小宽度限制 */
    white-space: nowrap; /* 防止文本换行 */
    flex-shrink: 0; /* 防止按钮被压缩 */
    margin: 0; /* 移除外边距 */
    align-self: center; /* 垂直居中对齐 */
    touch-action: manipulation; /* 优化触摸响应 */
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

/* 按钮内加载指示器样式 */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 6px;
    vertical-align: middle;
}

/* 评估报告质量按钮加载状态 */
.btn-secondary.loading {
    /* Preserve original gradient background - no grey background change */
    cursor: not-allowed;
    opacity: 0.8;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary.loading .btn-spinner {
    margin: 0; /* 居中显示 */
    flex-shrink: 0;
}

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

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

.ai-suggest-btn.loading {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.8;
}

.ai-suggest-btn::before {
    content: none;
}

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

/* 描述工具栏样式 - 基于ws/new-fault.html的设计 */
.description-toolbar {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #ddd;
    justify-content: space-between;
    align-items: center;
}

/* 左侧按钮组 */
.icon-buttons-group {
    display: flex;
    gap: 0.25rem;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    background-color: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2c3e50;
    /* Override general button styles */
    min-width: auto !important;
    min-height: auto !important;
    width: auto !important;
    height: auto !important;
}

.toolbar-btn:hover {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    transform: translateY(-2px);
}

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

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-btn:disabled:hover {
    background-color: transparent;
    color: #2c3e50;
    border-color: #ddd;
    transform: none;
}

/* AI分析按钮特殊样式 */
.ai-btn {
    width: auto !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 10px !important;
    gap: 6px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.ai-btn:hover {
    background: linear-gradient(135deg, #5a0dbb 0%, #1565e0 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.ai-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ai-btn:disabled {
    background: #cccccc;
    color: #666666;
    cursor: not-allowed;
}

.ai-btn:disabled:hover {
    background: #cccccc;
    color: #666666;
    transform: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 图标按钮样式 */
.icon-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 0 !important;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2c3e50;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .icon-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        font-size: 16px;
    }
    
    .description-toolbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

.icon-btn:hover {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    transform: translateY(-2px);
}

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

.icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-btn:disabled:hover {
    background-color: #f8f9fa;
    color: #2c3e50;
    border-color: #ddd;
    transform: none;
}

.btn-text {
    font-size: 14px;
    line-height: 1;
}

/* 控制面板样式 */
.control-panel {
    margin-bottom: 2px;
    margin-top: 20px; /* 添加与header相同的间隙 */
    padding: 8px 16px; /* 移动端增加内边距 - 与main-content保持一致 */
}

.control-row {
    display: flex;
    gap: 12px; /* 减少移动端间距 */
    flex-wrap: wrap;
    align-items: flex-end;
    flex-direction: column; /* 移动端改为垂直布局 */
}

.language-selector,
.model-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.problem-type-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-select {
    padding: 12px 14px; /* 增加移动端内边距 */
    border: 1px solid #ccc;
    border-radius: 8px; /* 更大的圆角提升移动端体验 */
    background-color: white;
    color: #333;
    font-size: 16px; /* 移动端使用16px防止缩放 */
    cursor: pointer;
    min-width: 120px;
    width: 100%; /* 移动端全宽 */
    min-height: 48px; /* 移动端最小触控尺寸 */
    -webkit-appearance: none; /* 移除移动端默认样式 */
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px; /* 为下拉箭头留出空间 */
    transition: all 0.2s ease; /* 添加过渡效果 */
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

/* 移动端下拉选择框触摸反馈 */
.dropdown-select:active {
    transform: translateY(1px); /* 微妙的按压效果 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* 添加阴影 */
}

/* 移动端下拉选择框焦点状态 */
.dropdown-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); /* 焦点指示 */
}

/* 移动端导航菜单触摸优化 */
@media (max-width: 768px) {
    .nav-menu a {
        -webkit-tap-highlight-color: transparent; /* 移除点击高亮 */
        position: relative; /* 为触摸反馈提供定位 */
    }

    /* 移动端导航项触摸反馈 */
    .nav-menu a:active {
        background-color: rgba(102, 126, 234, 0.1); /* 微妙的背景色 */
        transform: translateX(4px); /* 轻微的滑动效果 */
    }

    /* 移动端导航项触摸波纹效果 */
    .nav-menu a::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(102, 126, 234, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.3s, height 0.3s;
    }

    .nav-menu a:active::after {
        width: 40px;
        height: 40px;
    }
}

.dropdown-select:focus {
    outline: none;
    border-color: #4CAF50;
}

.control-label {
    font-weight: 600;
    color: #495057;
    font-size: 15px; /* 移动端增大字体 */
    margin-bottom: 6px; /* 增加移动端间距 */
    display: flex;
    align-items: center;
    gap: 10px; /* 增加移动端图标间距 */
    line-height: 1.4; /* 增加移动端行高 */
}

.control-label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* 语言选择器标签不显示小竖条 */
.language-selector .control-label::before {
    display: none;
}

/* 问题类型选择器标签不显示小竖条 */
.problem-type-selector .control-label::before {
    display: none;
}

/* 模型选择器标签不显示小竖条 */
.model-selector .control-label::before {
    display: none;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lang-btn,
.model-btn {
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-height: 44px; /* 移动端触控目标 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover,
.model-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.lang-btn.active, .model-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.lang-btn:hover, .model-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.lang-btn:active, .model-btn:active {
    transform: translateY(0);
}

.lang-btn:active,
.model-btn:active {
    transform: scale(0.98);
}

.api-config {
    background: white;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.api-config .form-group {
    margin-bottom: 12px;
}

.api-config input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* 移动设备样式 (≤768px) */
@media (max-width: 768px) {
    .control-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .language-selector,
    .model-selector,
    .problem-type-selector {
        width: 100%;
    }
    
    .control-panel {
        padding: 8px;
        margin-bottom: 2px;
    }
    
    .main-content {
        padding: 8px 24px; /* 保持垂直padding，水平padding与control-panel保持一致 */
    }
    
    .main-content .container {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .control-panel .container {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .dropdown-select {
        width: 100%;
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 12px;
    }
    
    /* AI容器移动端优化 */
    .ai-analysis-container,
    .ai-suggestions-container {
        margin: 12px 0;
        border-radius: 6px;
    }
    
    .ai-analysis-title,
    .ai-suggestions-title {
        padding: 10px 12px;
        font-size: 13px;
        border-radius: 6px 6px 0 0;
    }
    
    .collapse-btn {
        width: 28px; /* 移动端增大触控区域 */
        height: 28px;
        font-size: 16px;
        min-width: 28px;
        min-height: 28px;
        line-height: 1;
        flex-shrink: 0;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 50% !important;
    }
    
    .collapse-btn svg {
        width: 18px; /* 移动端增大图标尺寸 */
        height: 18px;
    }
    
    .ai-analysis-content,
    .ai-suggestions-content {
        padding: 12px;
        font-size: 13px;
        max-height: 300px; /* 移动端减小最大高度 */
    }
    
    .ai-suggestions-actions {
        padding: 8px 12px;
        flex-direction: column; /* 移动端改为垂直布局 */
        gap: 8px;
    }
    
    .ai-action-btn {
        width: 100%;
        padding: 10px 12px;
        font-size: 14px;
        min-height: 40px; /* 移动端增大触控高度 */
    }
    
    /* 移动端触控优化 */
    .collapse-btn {
        -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
        touch-action: manipulation; /* 优化触控响应 */
    }

    .ai-analysis-title span,
    .ai-suggestions-title span {
        flex: 1;
    }
    
    .collapse-btn:active {
        background-color: rgba(255,255,255,0.3);
        transform: scale(0.9);
    }
}

/* 响应式调整 */
@media (min-width: 768px) {
    .control-panel {
        margin-top: 16px; /* 平板和桌面端增加间隙 */
    }
    
    .control-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }

    .language-selector,
    .model-selector,
    .problem-type-selector {
        flex: 1;
        max-width: 250px;
    }

    .btn-group {
        flex-direction: row;
    }

    .lang-btn,
    .model-btn {
        flex: 1;
        min-width: 80px;
    }
}

@media (min-width: 1025px) {
    .control-panel {
        padding: 16px 32px;
        margin-top: 24px; /* 桌面端更大的间隙 */
    }

    .control-row {
        gap: 32px;
    }

    .language-selector,
    .model-selector,
    .problem-type-selector {
        max-width: 280px;
    }

    .control-label {
        font-size: 15px;
    }

    .lang-btn,
    .model-btn {
        font-size: 15px;
        padding: 10px 18px;
    }

    /* 桌面端结构化内容增强 */
    .ai-suggestions-content {
        padding: 24px;
        font-size: 15px;
        line-height: 1.7;
    }

    .ai-suggestions-content h3 {
        font-size: 18px;
        margin: 24px 0 16px 0;
        padding: 12px 16px;
        border-left-width: 6px;
    }

    .ai-suggestions-content h4 {
        font-size: 15px;
        padding: 8px 12px;
        margin: 16px 0 10px 0;
    }

    .ai-suggestions-content ul, .ai-suggestions-content ol {
        margin: 12px 0 16px 24px;
    }

    .ai-suggestions-content li {
        margin: 8px 0;
        padding: 6px 0;
    }

    .ai-suggestions-content .priority-high,
    .ai-suggestions-content .priority-medium {
        padding: 4px 8px;
        border-left-width: 4px;
    }

    .ai-suggestions-content .checklist,
    .ai-suggestions-content .warning-box {
        padding: 16px;
        margin: 16px 0;
    }

    .ai-suggestions-content .emoji {
        font-size: 18px;
        margin-right: 8px;
    }

    .ai-suggestions-content .code-block {
        padding: 16px;
        font-size: 13px;
    }
}

/* AI分析容器样式 */
.ai-analysis-container {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: slideDown 0.3s ease-out;
}

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

.ai-analysis-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 14px;
}

.ai-analysis-title span {
    flex: 1;
}

.collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50% !important;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 14px;
    min-width: 24px;
    min-height: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.collapse-btn:hover {
    background-color: rgba(255,255,255,0.15);
    transform: scale(1.1);
}

.collapse-btn:active {
    background-color: rgba(255,255,255,0.25);
    transform: scale(0.95);
}

.collapse-btn.collapsed {
    transform: rotate(180deg);
}

.collapse-btn.collapsed:hover {
    transform: rotate(180deg) scale(1.1);
}

/* 确保按钮始终保持圆形 */
.collapse-btn:focus,
.collapse-btn:active,
.collapse-btn:hover {
    border-radius: 50% !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
}

.ai-analysis-content {
    padding: 16px;
    line-height: 1.6;
    color: #495057;
    font-size: 14px;
    max-height: 400px;
    overflow-y: auto;
}

.ai-analysis-content h1, .ai-analysis-content h2, .ai-analysis-content h3 {
    color: #2c3e50;
    margin: 12px 0 8px 0;
    font-size: 16px;
}

.ai-analysis-content ul, .ai-analysis-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-analysis-content li {
    margin: 4px 0;
}

.ai-analysis-content strong {
    color: #e74c3c;
}

/* AI排查建议容器样式 */
.ai-suggestions-container {
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    border: 1px solid #b3d9ff;
    border-radius: 8px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: slideDown 0.3s ease-out;
}

.ai-suggestions-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 14px;
}

.ai-suggestions-title span {
    flex: 1;
}

.ai-suggestions-content {
    padding: 16px;
    line-height: 1.6;
    color: #2c3e50;
    font-size: 14px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
}

.ai-suggestions-content h1, .ai-suggestions-content h2, .ai-suggestions-content h3 {
    color: #2c3e50;
    margin: 12px 0 8px 0;
    font-size: 16px;
}

.ai-suggestions-content h3 {
    color: #2c3e50;
    margin: 20px 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    border-left: 4px solid #3498db;
    padding-left: 12px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 10px 12px;
    border-radius: 4px;
}

.ai-suggestions-content h4 {
    color: #34495e;
    margin: 16px 0 8px 0;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    background: #f1f3f4;
    border-radius: 3px;
    border-left: 2px solid #95a5a6;
}

.ai-suggestions-content .priority-high {
    color: #e74c3c;
    font-weight: 600;
    background: #fff5f5;
    padding: 2px 6px;
    border-radius: 3px;
    border-left: 3px solid #e74c3c;
}

.ai-suggestions-content .priority-medium {
    color: #f39c12;
    font-weight: 500;
    background: #fffaf0;
    padding: 2px 6px;
    border-radius: 3px;
    border-left: 3px solid #f39c12;
}

.ai-suggestions-content ul, .ai-suggestions-content ol {
    margin: 8px 0 12px 20px;
    padding-left: 0;
}

.ai-suggestions-content li {
    margin: 6px 0;
    padding: 4px 0;
    line-height: 1.5;
}

.ai-suggestions-content strong {
    color: #2c3e50;
    font-weight: 600;
    background: #ecf0f1;
    padding: 1px 4px;
    border-radius: 2px;
}

.ai-suggestions-content .emoji {
    font-size: 18px;
    margin-right: 6px;
}

.ai-suggestions-content .checklist {
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    border: 1px solid #27ae60;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
}

.ai-suggestions-content .warning-box {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 1px solid #f39c12;
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
}

.ai-suggestions-actions {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
}

.ai-action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ai-copy-btn {
    background: #6c757d;
    color: white;
}

.ai-copy-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.ai-apply-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.ai-apply-btn:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-1px);
}



/* 移动端适配 */
@media (max-width: 768px) {
    html {
        height: 100%;
    }
    
    body {
        min-height: 100vh;
        min-height: -webkit-fill-available; /* iOS Safari */
        display: flex;
        flex-direction: column;
    }
    
    .main-content {
        flex: 1;
        padding: 8px 12px; /* 减少移动端padding以消除间隙 */
        padding-bottom: 12px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .footer {
        position: relative;
        margin-top: auto;
        flex-shrink: 0; /* 防止footer被压缩 */
        width: 100%;
        box-sizing: border-box;
    }
    
    .ai-analysis-container {
        margin: 12px -8px;
        border-radius: 0;
    }

    .ai-analysis-title {
        padding: 10px 12px;
        font-size: 13px;
    }

    .ai-analysis-content {
        padding: 12px;
        font-size: 13px;
        max-height: 300px;
    }

    .ai-suggestions-container {
        margin: 12px -8px;
        border-radius: 0;
    }

    .ai-suggestions-title {
        padding: 10px 12px;
        font-size: 13px;
    }

    .ai-suggestions-content {
        padding: 12px;
        font-size: 13px;
        max-height: 300px;
    }

    .ai-suggestions-actions {
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
    }

    .ai-action-btn {
        width: 100%;
        justify-content: center;
    }

    /* 移动端结构化内容适配 */
    .ai-suggestions-content h3 {
        font-size: 14px;
        margin: 12px 0 8px 0;
        padding: 6px 8px;
        border-left-width: 3px;
    }

    .ai-suggestions-content h4 {
        font-size: 12px;
        padding: 4px 6px;
        margin: 10px 0 6px 0;
    }

    .ai-suggestions-content ul, .ai-suggestions-content ol {
        margin: 6px 0 8px 16px;
    }

    .ai-suggestions-content li {
        margin: 3px 0;
        padding: 2px 0;
        font-size: 12px;
    }

    .ai-suggestions-content .priority-high,
    .ai-suggestions-content .priority-medium {
        padding: 2px 4px;
        border-left-width: 2px;
        font-size: 12px;
    }

    .ai-suggestions-content .checklist,
    .ai-suggestions-content .warning-box {
        padding: 10px;
        margin: 10px 0;
        font-size: 12px;
    }

    .ai-suggestions-content .emoji {
        font-size: 14px;
        margin-right: 4px;
    }

    .ai-suggestions-content .code-block {
        padding: 10px;
        font-size: 11px;
    }

    /* 移动端触控优化 */
    .ai-suggestions-title {
        min-height: 44px; /* 确保触控目标最小尺寸 */
        display: flex;
        align-items: center;
    }

    .collapse-btn {
        min-height: 32px;
        min-width: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .ai-action-btn {
        min-height: 44px; /* 触控友好的按钮高度 */
        padding: 12px 16px;
    }

    /* 移动端触控反馈效果 */
    .ai-action-btn:active {
        transform: scale(0.98);
        opacity: 0.8;
    }

    .collapse-btn:active {
        background: rgba(255,255,255,0.1);
        transform: scale(0.95);
    }

}

/* 平板适配 */
@media (min-width: 769px) and (max-width: 1024px) {
    /* 修复控制面板与头部重叠问题 */
    .header {
        position: relative;
        z-index: 100;
    }
    
    .control-panel {
        position: relative;
        z-index: 1;
        margin-top: 20px; /* 增加与header的间隙 */
        padding-top: 8px; /* 保持顶部padding */
        padding-left: 24px; /* 添加水平内边距与main-content保持一致 */
        padding-right: 24px; /* 添加水平内边距与main-content保持一致 */
    }
    
    .control-panel .container {
        padding: 16px; /* 减少平板上的内边距 */
        margin-bottom: 8px;
    }
    
    .control-row {
        gap: 12px; /* 减少控件间距 */
    }
    
    .language-selector,
    .model-selector,
    .problem-type-selector {
        max-width: 200px; /* 限制选择器最大宽度 */
    }

    .ai-analysis-container {
        margin: 14px 0;
    }

    .ai-analysis-content {
        max-height: 350px;
    }

    .ai-suggestions-container {
        margin: 14px 0;
    }

    .ai-suggestions-content {
        max-height: 350px;
    }

    .ai-suggestions-actions {
        flex-direction: row;
        gap: 10px;
    }

    .ai-action-btn {
        flex: 1;
        justify-content: center;
    }

    /* 结构化内容在平板上的优化 */
    .ai-suggestions-content h3 {
        font-size: 15px;
        margin: 16px 0 10px 0;
        padding: 8px 10px;
    }

    .ai-suggestions-content h4 {
        font-size: 13px;
        padding: 5px 8px;
    }

    .ai-suggestions-content li {
        margin: 4px 0;
        padding: 3px 0;
    }
    
    /* 平板端折叠按钮优化 */
    .ai-analysis-title,
    .ai-suggestions-title {
        padding: 11px 14px;
        font-size: 14px;
    }

    .ai-analysis-title span,
    .ai-suggestions-title span {
        flex: 1;
    }
    
    .collapse-btn {
        width: 26px;
        height: 26px;
        min-width: 26px;
        min-height: 26px;
        line-height: 1;
        flex-shrink: 0;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 50% !important;
    }
    
    .collapse-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .ai-analysis-content,
    .ai-suggestions-content {
        padding: 14px;
        font-size: 14px;
    }
}

/* 图像上传区域样式 - 移动优先 */
.upload-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 16px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.upload-container h3 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-area {
    margin-bottom: 16px;
    position: relative;
}

.file-input {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    background-color: #f7fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 120px;
    text-align: center;
}

.upload-label:hover {
    border-color: #667eea;
    background-color: #ebf4ff;
}

.upload-label i {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 8px;
}

.upload-label span {
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
}

.image-preview {
    margin-top: 16px;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
}

.prompt-container {
    margin-bottom: 16px;
}

.prompt-container textarea {
    min-height: 80px;
    font-size: 14px;
}

/* 识别模式选择样式 */
.recognition-mode-container {
    margin-bottom: 16px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.recognition-mode-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    min-height: 48px; /* 移动端触控目标尺寸 */
    -webkit-tap-highlight-color: transparent; /* 移除移动端点击高亮 */
}

.radio-option:hover {
    background-color: #e9ecef;
}

.radio-option:active {
    background-color: #dee2e6;
    transform: scale(0.98);
}

.radio-option input[type="radio"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-text {
    font-size: 14px;
    color: #495057;
    user-select: none;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.button-group button {
    flex: 1;
    min-height: 48px; /* 移动端触控目标尺寸 */
    font-size: 14px;
}

.result-container {
    margin-top: 20px;
    padding: 16px;
    background-color: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.result-content {
    color: #2d3748;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* 桌面端增强样式 */
@media (min-width: 768px) {
    .upload-container {
        padding: 32px;
        margin: 24px auto;
        max-width: 800px;
    }

    .upload-container h3 {
        font-size: 20px;
        margin-bottom: 24px;
    }

    .upload-label {
        padding: 48px 24px;
        min-height: 160px;
    }

    .upload-label i {
        font-size: 40px;
        margin-bottom: 12px;
    }

    .upload-label span {
        font-size: 16px;
    }

    .image-preview img {
        max-height: 300px;
    }

    .prompt-container textarea {
        min-height: 100px;
        font-size: 16px;
    }

    .button-group {
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }

    .button-group button {
        max-width: 200px;
    }

    .result-content {
        font-size: 16px;
    }

    /* 桌面端识别模式样式 */
    .recognition-mode-container {
        padding: 16px;
        margin-bottom: 20px;
    }

    .recognition-mode-label {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .radio-group {
        gap: 24px;
    }

    .radio-option {
        padding: 12px 16px;
        min-height: 52px;
    }

    .radio-option input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }

    .radio-text {
        font-size: 16px;
    }
}

/* 大桌面端样式 */
@media (min-width: 1024px) {
    .upload-container {
        max-width: 800px;
        margin: 32px auto;
        /* Keep consistent with main container width */
    }

    .upload-label {
        padding: 64px 32px;
        min-height: 200px;
    }

    .upload-label i {
        font-size: 48px;
    }
}

/* 加载状态样式 */
.loading-state {
    opacity: 0.7;
    pointer-events: none;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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