/* 法规库后台样式 */

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

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f6f8;
    color: #333;
    line-height: 1.6;
}

/* 左侧导航布局 */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #1a3a5c;
    color: #fff;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    box-sizing: border-box;
    overflow-y: auto;
}

.site-title {
    display: block;
    color: #fff;
    text-decoration: none;
    font-size: 19px;
    font-weight: 600;
    padding: 4px 24px 18px;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.side-nav a {
    color: #c8d8e8;
    text-decoration: none;
    font-size: 15px;
    padding: 10px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.side-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.side-footer {
    margin-top: auto;
    padding: 16px 20px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sidebar {
    display: flex;
    flex-direction: column;
}

.side-user {
    color: #c8d8e8;
    font-size: 13px;
}

.logout-btn {
    background: none;
    border: 1px solid #3d5a7a;
    color: #c8d8e8;
    font-size: 12px;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
}

.logout-btn:hover {
    color: #fff;
    border-color: #c8d8e8;
}

/* 登录页 */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1a3a5c;
}

.login-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    padding: 36px 40px;
    width: 340px;
    box-sizing: border-box;
}

.login-title {
    text-align: center;
    color: #1a3a5c;
    font-size: 22px;
    margin: 0 0 24px;
}

.login-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.login-field label {
    font-size: 14px;
    color: #475569;
}

.login-field input {
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 15px;
}

.login-field input:focus {
    outline: none;
    border-color: #1a6fb0;
}

.login-submit {
    width: 100%;
    margin-top: 8px;
    padding: 11px;
    font-size: 15px;
}

/* MCP调试页 */
.mcp-desc {
    color: #64748b;
    font-size: 14px;
    margin: 4px 0 16px;
}

.mcp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.mcp-field-label {
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
}

.mcp-raw {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.mcp-raw .mcp-field {
    flex: 1;
}

.mcp-textarea {
    box-sizing: border-box;
    width: 100%;
    background: #0f172a;
    color: #e2e8f0;
    border: none;
    border-radius: 6px;
    padding: 12px;
    font-size: 12px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    line-height: 1.5;
    resize: vertical;
}

.mcp-tool-label {
    font-size: 14px;
    color: #475569;
    white-space: nowrap;
    align-self: center;
}

.mcp-date-sep {
    color: #64748b;
    align-self: center;
}

.mcp-json {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 6px;
    padding: 16px;
    font-size: 13px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    overflow-x: auto;
    max-height: 640px;
    overflow-y: auto;
    white-space: pre;
    margin: 0;
}

.mcp-json-error {
    color: #f87171;
}

.container {
    flex: 1;
    min-width: 0;
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 24px;
}

/* 搜索表单 */
.search-form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
}

.search-input:focus {
    border-color: #1a6fb0;
}

.btn-primary {
    padding: 10px 24px;
    background: #1a6fb0;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}

.btn-primary:hover {
    background: #155a92;
}

.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-reload {
    margin-left: auto;
    padding: 8px 16px;
    background: #fff;
    color: #1a6fb0;
    border: 1px solid #1a6fb0;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.btn-reload:hover {
    background: #eef5fb;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    min-width: 140px;
}

/* 结果摘要 */
.result-summary {
    margin-bottom: 12px;
    color: #666;
    font-size: 14px;
}

/* 结果表格 */
.result-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-collapse: collapse;
}

.result-table th,
.result-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #eef0f3;
    font-size: 14px;
}

.result-table th {
    background: #f0f4f8;
    color: #475569;
    font-weight: 600;
    white-space: nowrap;
}

.result-table tbody tr:hover {
    background: #f8fafc;
}

.col-id {
    width: 70px;
}

.col-type {
    width: 90px;
}

.col-date {
    width: 110px;
}

.col-status {
    width: 80px;
}

.col-title a {
    color: #1a6fb0;
    text-decoration: none;
}

.col-title a:hover {
    text-decoration: underline;
}

.empty {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

/* 状态标签 */
.status-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    white-space: nowrap;
}

.status-现行有效 {
    background: #e6f7ed;
    color: #1a7d3a;
}

.status-废止或失效 {
    background: #fde8e8;
    color: #b91c1c;
}

.status-已被修改 {
    background: #fff4e6;
    color: #b45309;
}

.status-部分废止或失效 {
    background: #fff4e6;
    color: #b45309;
}

.status-尚未施行 {
    background: #e8eef7;
    color: #3b5b92;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-block;
    min-width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    padding: 0 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.page-btn:hover {
    border-color: #1a6fb0;
    color: #1a6fb0;
}

.page-btn.current {
    background: #1a6fb0;
    color: #fff;
    border-color: #1a6fb0;
}

/* 详情页 */
.detail-header {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.back-link {
    color: #1a6fb0;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    margin-bottom: 12px;
}

.back-link:hover {
    text-decoration: underline;
}

.detail-header h1 {
    font-size: 22px;
    color: #1a3a5c;
    margin-bottom: 8px;
}

.detail-sub {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #666;
    font-size: 14px;
}

.meta-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-collapse: collapse;
    margin-bottom: 20px;
}

.meta-table th,
.meta-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef0f3;
    font-size: 14px;
    text-align: left;
}

.meta-table th {
    background: #f0f4f8;
    color: #475569;
    font-weight: 600;
    width: 110px;
    white-space: nowrap;
}

.content-title {
    font-size: 18px;
    color: #1a3a5c;
    margin-bottom: 12px;
}

.content-body {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.content-body pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: "PingFang SC", "Microsoft YaHei", monospace;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
}

/* 操作列与删除按钮 */
.col-action {
    width: 70px;
    text-align: center;
}

.btn-delete {
    padding: 4px 12px;
    background: #fff;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.btn-delete:hover {
    background: #fef2f2;
}

/* 可编辑表单 */
.edit-table select,
.edit-input,
.edit-textarea {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.edit-select {
    padding: 6px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.edit-textarea {
    resize: vertical;
}

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

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    cursor: pointer;
}

.content-textarea {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    font-family: "PingFang SC", "Microsoft YaHei", monospace;
    font-size: 15px;
    line-height: 1.8;
    resize: vertical;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

.btn-cancel {
    padding: 10px 24px;
    background: #fff;
    color: #666;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 15px;
    text-decoration: none;
    display: inline-block;
    line-height: 1.5;
}

.btn-cancel:hover {
    background: #f5f6f8;
}

/* 导入页面 */
.import-page h1 {
    font-size: 22px;
    color: #1a3a5c;
    margin-bottom: 20px;
}

.import-form {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
}

.form-group input[type="file"] {
    font-size: 14px;
}

.log-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.log-container h2 {
    font-size: 18px;
    color: #1a3a5c;
    margin-bottom: 12px;
}

.log-output {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 6px;
    font-family: "SF Mono", "Menlo", monospace;
    font-size: 13px;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

.log-line {
    padding: 2px 0;
}

.log-success {
    color: #4ade80;
    font-weight: 600;
    padding: 4px 0;
}

.log-error {
    color: #f87171;
    font-weight: 600;
    padding: 4px 0;
}

.log-warn {
    color: #fbbf24;
    font-weight: 600;
    padding: 4px 0;
}

.result-actions {
    margin-top: 16px;
}

#import-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 检索模式切换 */
.mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-tab {
    padding: 6px 20px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    background: #fff;
    transition: all 0.15s;
}

.mode-tab input[type="radio"] {
    display: none;
}

.mode-tab.active {
    background: #1a6fb0;
    color: #fff;
    border-color: #1a6fb0;
}

/* 语义检索结果卡片 */
.semantic-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.semantic-card {
    background: #fff;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-left: 3px solid #1a6fb0;
}

.semantic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.semantic-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a3a5c;
    text-decoration: none;
}

.semantic-title:hover {
    color: #1a6fb0;
}

.semantic-score {
    font-size: 13px;
    color: #1a6fb0;
    font-weight: 600;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 4px;
}

.semantic-label {
    font-size: 13px;
    color: #475569;
    margin-bottom: 8px;
    font-weight: 500;
}

.semantic-text {
    font-size: 14px;
    color: #333;
    line-height: 1.7;
    margin-bottom: 8px;
    max-height: 80px;
    overflow: hidden;
}

.semantic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: #94a3b8;
}

.semantic-meta-chunk {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed #334155;
    color: #64748b;
}

.limit-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #94a3b8;
    white-space: nowrap;
}

.semantic-limit {
    width: 72px;
}
