/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 主容器 */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* 顶部导航栏 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.app-title i {
    margin-right: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

/* 主内容区域 */
.main-content {
    padding-bottom: 80px; /* 为底部导航留空间 */
}

.page {
    display: none;
    padding: 1rem;
}

.page.active {
    display: block;
}

/* 页面头部 */
.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #667eea;
    margin-right: 1rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Dashboard样式 */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.date-info {
    color: #666;
    font-size: 0.9rem;
}

.date-info i {
    margin-right: 0.5rem;
}

/* 快速操作卡片 */
.quick-actions {
    margin-bottom: 2rem;
}

.action-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

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

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.action-card:not(.primary) .card-icon {
    background: #f0f2ff;
    color: #667eea;
}

.action-card.primary .card-icon {
    background: rgba(255,255,255,0.2);
}

.card-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.card-content p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.card-arrow {
    margin-left: auto;
    opacity: 0.6;
}

/* 统计概览 */
.stats-overview {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stats-overview h3 {
    margin-bottom: 1rem;
    color: #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

/* 最近检查记录 */
.recent-inspections {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.recent-inspections h3 {
    margin-bottom: 1rem;
}

.inspection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.inspection-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.inspection-time {
    font-size: 0.8rem;
    color: #666;
}

.inspection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.inspection-status.pass {
    color: #10b981;
}

.inspection-status.fail {
    color: #ef4444;
}

/* 检查类型选择 */
.inspection-types {
    margin-bottom: 2rem;
}

.inspection-types h3 {
    margin-bottom: 1rem;
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.type-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

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

.type-card i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #667eea;
}

.type-card.selected i {
    color: white;
}

/* 作业场景描述区域 */
.scenario-section {
    margin-bottom: 2rem;
}

.scenario-section h3 {
    margin-bottom: 1rem;
    color: #374151;
    font-weight: 600;
}

.scenario-input-area {
    position: relative;
}

.scenario-input-area textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.scenario-input-area textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.scenario-input-area textarea::placeholder {
    color: #9ca3af;
}

.char-count {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 图片上传区域 */
.upload-section {
    margin-bottom: 2rem;
}

.upload-section h3 {
    margin-bottom: 1rem;
}

.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-area:hover {
    border-color: #667eea;
}

.upload-placeholder i {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 1rem;
}

.upload-placeholder p {
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* 图片预览 */
.image-preview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* 按钮样式 */
.action-buttons {
    margin: 2rem 0;
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* 分析结果 */
.analysis-result {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f0f9ff;
    border-radius: 8px;
}

.result-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #10b981;
    font-weight: 500;
}

.confidence-score {
    color: #666;
    font-size: 0.9rem;
}

.detailed-results {
    margin-bottom: 1.5rem;
}

.result-item {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.result-item.detailed {
    padding: 1.5rem;
    border: 2px solid #e5e7eb;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.result-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1f2937;
}

.result-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.result-badge.pass {
    background: #dcfce7;
    color: #166534;
}

.result-badge.fail {
    background: #fee2e2;
    color: #dc2626;
}

.result-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.result-detail {
    color: #666;
    font-size: 0.9rem;
}

/* 详细分析结果样式 */
.result-content {
    margin-top: 1rem;
}

.regulation-info {
    background: #f8fafc;
    border-left: 4px solid #667eea;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 8px 8px 0;
}

.regulation-info h4 {
    margin: 0 0 0.5rem 0;
    color: #667eea;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.regulation-section {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.regulation-clause {
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
}

.analysis-details {
    margin-top: 1rem;
}

.detail-row {
    display: flex;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.detail-row .label {
    font-weight: 500;
    color: #374151;
    min-width: 80px;
    margin-right: 0.5rem;
}

.detail-row .value {
    color: #6b7280;
    flex: 1;
}

.reasoning-section,
.deviation-section,
.suggestion-section {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
}

.reasoning-section {
    background: #f0f9ff;
    border-left: 4px solid #3b82f6;
}

.deviation-section {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.suggestion-section {
    background: #f0fdf4;
    border-left: 4px solid #10b981;
}

.reasoning-section h4,
.deviation-section h4,
.suggestion-section h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reasoning-section h4 {
    color: #3b82f6;
}

.deviation-section h4 {
    color: #f59e0b;
}

.suggestion-section h4 {
    color: #10b981;
}

.risk-level {
    display: flex;
    align-items: center;
    margin-top: 0.75rem;
}

.risk-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.risk-badge.risk-低,
.risk-badge.risk-low {
    background: #dcfce7;
    color: #166534;
}

.risk-badge.risk-中,
.risk-badge.risk-medium {
    background: #fef3c7;
    color: #92400e;
}

.risk-badge.risk-高,
.risk-badge.risk-high {
    background: #fee2e2;
    color: #dc2626;
}

/* 技术分析部分 */
.technical-analysis-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.technical-analysis-section h3 {
    margin: 0 0 1rem 0;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.tech-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tech-label {
    font-weight: 500;
    color: #374151;
    font-size: 0.85rem;
}

.tech-value {
    color: #6b7280;
    font-size: 0.9rem;
}

/* 原始内容显示样式 */
.raw-content-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #fbbf24;
}

.raw-content-section h4 {
    margin-bottom: 1rem;
    color: #92400e;
    font-size: 14px;
}

.raw-content {
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
}

.raw-content pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.fallback-note {
    margin-top: 0.5rem;
    font-size: 12px;
    color: #92400e;
    font-style: italic;
}

.fallback-note i {
    margin-right: 4px;
}

/* 建议部分 */
.recommendations-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f0fdf4;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.recommendations-section h3 {
    margin: 0 0 1rem 0;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.rec-category {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #d1fae5;
}

.rec-category h4 {
    margin: 0 0 0.75rem 0;
    color: #059669;
    font-size: 0.9rem;
}

.rec-category ul {
    margin: 0;
    padding-left: 1.25rem;
    list-style-type: disc;
}

.rec-category li {
    margin-bottom: 0.5rem;
    color: #374151;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* 底部导航栏 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    padding: 0.5rem 0;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    transition: color 0.2s;
    color: #9ca3af;
}

.nav-item.active {
    color: #667eea;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.7rem;
}

/* 规范管理页面样式 */
.standards-list {
    margin-bottom: 2rem;
}

.standards-list h3 {
    margin-bottom: 1rem;
}

.document-item {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.document-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.document-icon {
    width: 48px;
    height: 48px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.5rem;
}

.document-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.document-meta {
    font-size: 0.8rem;
    color: #666;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #f3f4f6;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #667eea;
    color: white;
}

/* 搜索功能样式 */
.search-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.search-section h3 {
    margin-bottom: 1rem;
}

.search-box {
    display: flex;
    margin-bottom: 1rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px 0 0 8px;
    font-size: 1rem;
    outline: none;
}

.search-box input:focus {
    border-color: #667eea;
}

.search-btn {
    padding: 0.75rem 1rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
}

.search-results {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.search-results .result-item {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.result-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #667eea;
}

.result-content {
    margin-bottom: 0.5rem;
    color: #333;
}

.result-source {
    font-size: 0.8rem;
    color: #666;
}

/* 历史记录页面样式 */
.stats-charts {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stats-charts h3 {
    margin-bottom: 1rem;
}

.chart-container {
    margin-bottom: 1rem;
}

.chart-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.simple-chart {
    display: flex;
    align-items: end;
    height: 120px;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px 4px 0 0;
    min-height: 20px;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #666;
}

/* 历史记录列表样式 */
.history-list {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.history-item {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.item-title {
    font-weight: 500;
    font-size: 1.1rem;
}

.item-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-info span {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-confidence {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 500;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.view-btn, .export-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.view-btn:hover, .export-btn:hover {
    background: #667eea;
    color: white;
}

/* 导出功能样式 */
.export-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.export-section h3 {
    margin-bottom: 1rem;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .type-grid {
        grid-template-columns: 1fr;
    }

    .document-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .document-actions {
        align-self: flex-end;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .item-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .item-actions {
        width: 100%;
        justify-content: space-between;
    }

    .export-options {
        gap: 0.5rem;
    }
}
