/* 环评报告信息提取系统样式 - shadcn风格 */

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

:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
    overflow: hidden;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: hsl(var(--background));
}

/* 头部样式 */
.header {
    border-bottom: 1px solid hsl(var(--border));
    padding: 1.5rem 2rem;
    background-color: hsl(var(--card));
    flex-shrink: 0;
}

.header h1 {
    font-size: 1.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header .subtitle {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    font-weight: 400;
}

/* 导航标签样式 */
.nav-tabs {
    display: flex;
    background-color: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: hsl(var(--foreground));
    background-color: hsl(var(--accent));
}

.tab-btn.active {
    color: hsl(var(--foreground));
    border-bottom-color: hsl(var(--primary));
    background-color: hsl(var(--background));
}

.tab-btn i {
    margin-right: 0.5rem;
}

/* 标签页内容样式 */
.tab-content {
    display: none;
    background-color: hsl(var(--card));
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* 文件上传样式 */
.upload-area {
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    background-color: hsl(var(--card));
}

.upload-area:hover,
.upload-area.dragover {
    border-color: hsl(var(--primary));
    background-color: hsl(var(--accent));
}

.upload-icon {
    font-size: 3rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.5rem;
}

.upload-area h3 {
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
    font-weight: 600;
}

.upload-area p {
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

/* 文件信息样式 */
.file-info {
    background-color: hsl(var(--muted));
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid hsl(var(--border));
}

.file-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-details i {
    font-size: 1.5rem;
    color: hsl(var(--destructive));
}

.file-name {
    font-weight: 600;
    color: hsl(var(--foreground));
}

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

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    text-decoration: none;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.btn-success {
    background-color: hsl(142 76% 36%);
    color: hsl(var(--primary-foreground));
}

.btn-success:hover {
    background-color: hsl(142 76% 32%);
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.8);
}

/* 状态卡片样式 */
.status-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

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

.task-id {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    background-color: hsl(var(--muted));
    padding: 0.25rem 0.5rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* 进度条样式 */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: hsl(var(--secondary));
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background-color: hsl(var(--primary));
    width: 0%;
    transition: width 0.3s ease;
}

.status-text {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
}

.status-details {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* 表单样式 */
.config-form {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
}

.form-control:focus {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 7.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* 结果展示样式 */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.results-actions {
    display: flex;
    gap: 10px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* 表格样式 */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
}

.results-table th,
.results-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid hsl(var(--border));
}

.results-table th {
    background-color: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    font-weight: 600;
    font-size: 0.875rem;
}

.results-table tr:hover {
    background-color: hsl(var(--muted) / 0.5);
}

/* 统计信息样式 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin-bottom: 0.25rem;
}

.stat-label {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* 消息提示样式 */
.toast {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    color: hsl(var(--primary-foreground));
    font-weight: 500;
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    border: 1px solid hsl(var(--border));
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background-color: hsl(142 76% 36%);
    border-color: hsl(142 76% 32%);
}

.toast.error {
    background-color: hsl(var(--destructive));
    border-color: hsl(var(--destructive) / 0.8);
}

.toast.info {
    background-color: hsl(199 89% 48%);
    border-color: hsl(199 89% 44%);
}

/* 加载遮罩样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: hsl(var(--background) / 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: hsl(var(--foreground));
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: hsl(var(--primary));
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .nav-tabs {
        flex-direction: column;
    }

    .tab-content {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .results-actions {
        justify-content: center;
    }
}

/* 渲染模式样式 */
.render-mode-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid hsl(var(--border));
}

.mode-badge.table-mode {
    background: hsl(142 76% 36%);
    color: white;
}

.mode-badge.markdown-mode {
    background: hsl(199 89% 48%);
    color: white;
}

.mode-badge.raw-mode {
    background: hsl(var(--muted-foreground));
    color: white;
}

/* Markdown渲染样式 */
.markdown-content {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: hsl(var(--foreground));
    background: hsl(var(--card));
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    overflow-y: auto;
    max-height: 70vh;
}

.markdown-content h1, .markdown-content h2, .markdown-content h3,
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    color: hsl(var(--foreground));
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 16px;
}

.markdown-content h1 {
    font-size: 2em;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 0.3em;
}

.markdown-content h2 {
    font-size: 1.6em;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 0.3em;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    border-spacing: 0;
    overflow: auto;
}

.markdown-content table th,
.markdown-content table td {
    padding: 8px 16px;
    border: 1px solid hsl(var(--border));
    word-break: break-word;
    font-size: 14px;
}

.markdown-content table th {
    font-weight: 600;
    background-color: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.markdown-content table tr {
    background-color: hsl(var(--card));
    border-top: 1px solid hsl(var(--border));
}

.markdown-content table tr:nth-child(2n) {
    background-color: hsl(var(--muted) / 0.5);
}

.markdown-content pre {
    background-color: hsl(var(--muted));
    border-radius: 6px;
    font-size: 85%;
    line-height: 1.45;
    overflow: auto;
    padding: 16px;
    margin-bottom: 16px;
}

.markdown-content code {
    background-color: hsl(var(--muted) / 0.5);
    border-radius: 3px;
    font-size: 85%;
    margin: 0;
    padding: 0.2em 0.4em;
    font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
}

.markdown-content pre code {
    background-color: transparent;
    border: 0;
    display: inline;
    line-height: inherit;
    margin: 0;
    overflow: visible;
    padding: 0;
    word-wrap: normal;
}

/* JSON表格渲染样式 */
.json-table-container {
    background: hsl(var(--card));
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    overflow: hidden;
    margin-bottom: 20px;
}

.json-table-header {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    padding: 12px 16px;
    font-weight: 600;
    font-size: 16px;
}

.json-table {
    width: 100%;
    border-collapse: collapse;
}

.json-table th,
.json-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 14px;
}

.json-table th {
    background: hsl(var(--muted));
    font-weight: 600;
    color: hsl(var(--foreground));
}

.json-table tr:hover {
    background: hsl(var(--muted) / 0.5);
}

.json-table tr:last-child td {
    border-bottom: none;
}

/* 原始数据样式 */
.raw-data-container {
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 70vh;
    overflow-y: auto;
}

/* 登录模态框样式 */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.login-modal-content {
    background: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-header h2 {
    color: hsl(var(--foreground));
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.login-header p {
    color: hsl(var(--muted-foreground));
    margin: 0;
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-form label {
    color: hsl(var(--foreground));
    font-weight: 500;
    font-size: 0.9rem;
}

.login-form input[type="password"] {
    padding: 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 1rem;
    transition: border-color 0.2s;
}

.login-form input[type="password"]:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 2px hsl(var(--primary) / 0.2);
}

.login-form .form-actions {
    margin-top: 0.5rem;
}

.login-form .btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
}

.error-message {
    color: hsl(var(--destructive));
    background: hsl(var(--destructive) / 0.1);
    border: 1px solid hsl(var(--destructive) / 0.2);
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
}
