/* ==================== 全局 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* ==================== 顶部导航 ==================== */
.header {
    background: linear-gradient(135deg, #1a237e, #0d47a1);
    color: white;
    padding: 18px 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header h1 {
    font-size: 22px;
    margin-bottom: 14px;
}

.nav-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-tabs button {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-tabs button:hover {
    background: rgba(255, 255, 255, 0.25);
}

.nav-tabs button.active {
    background: white;
    color: #1a237e;
    font-weight: bold;
}

/* ==================== 搜索筛选栏 ==================== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.date-input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.date-sep {
    color: #999;
    white-space: nowrap;
}

/* ==================== 按钮 ==================== */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: #1a237e;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #283593;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover:not(:disabled) {
    background: #bdbdbd;
}

.btn-danger {
    background: #d32f2f;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #b71c1c;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

/* ==================== 统计概览 ==================== */
.stats-summary {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
    flex-wrap: wrap;
}

.stats-pad {
    padding: 15px 30px;
}

.green-text { color: #2e7d32; }
.blue-text { color: #1565c0; }

/* ==================== 信息卡片 ==================== */
.loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.empty {
    text-align: center;
    padding: 60px;
    font-size: 16px;
    color: #999;
}

.intel-list {
    padding: 20px 30px;
    max-width: 1100px;
    margin: 0 auto;
}

.intel-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #1a237e;
    transition: box-shadow 0.2s;
}

.intel-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.item-card {
    cursor: pointer;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.card-header h3 {
    font-size: 17px;
    color: #1a237e;
    flex: 1;
}

.pushed-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.pushed-badge.pushed { background: #e8f5e9; color: #2e7d32; }
.pushed-badge.not-pushed { background: #fce4ec; color: #c62828; }

.card-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #777;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.tag {
    background: #e8eaf6;
    color: #283593;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.tag-country { background: #e0f2f1; color: #00695c; }
.tag-duty { background: #fff3e0; color: #e65100; }

.card-summary {
    font-size: 14px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 10px;
}

.card-link {
    font-size: 13px;
    color: #1565c0;
    text-decoration: none;
}

.card-link:hover {
    text-decoration: underline;
}

.card-readmore {
    font-size: 12px;
    color: #aaa;
}

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 20px;
    font-size: 14px;
}

.pagination button {
    padding: 6px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== 弹窗 ==================== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    z-index: 100;
    overflow-y: auto;
}

.modal {
    background: white;
    border-radius: 12px;
    max-width: 860px;
    width: 100%;
    padding: 24px 28px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    border-bottom: 2px solid #e8eaf6;
    padding-bottom: 12px;
}

.modal-header h3 {
    font-size: 18px;
    color: #1a237e;
    flex: 1;
}

.modal-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #777;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.modal-section {
    margin-bottom: 16px;
}

.modal-section h4 {
    font-size: 14px;
    color: #1a237e;
    margin-bottom: 6px;
    padding-left: 8px;
    border-left: 3px solid #1a237e;
}

.modal-section p {
    font-size: 14px;
    color: #444;
    line-height: 1.8;
}

.modal-section .full-content {
    max-height: 320px;
    overflow-y: auto;
    background: #fafbfc;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px;
    white-space: pre-wrap;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.detail-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-table td:first-child {
    font-weight: bold;
    color: #555;
    width: 110px;
    background: #f8f9ff;
}

.modal-footer {
    margin-top: 16px;
    text-align: right;
}

/* ==================== 页面容器 ==================== */
.config-page, .scheduler-page {
    padding: 30px;
    max-width: 1100px;
    margin: 0 auto;
}

.config-page h2, .scheduler-page h2 {
    margin-top: 28px;
    margin-bottom: 16px;
    color: #1a237e;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8eaf6;
}

.config-page h2:first-child,
.config-page .config-toolbar + p,
.scheduler-page h2:first-child {
    margin-top: 0;
}

/* ==================== 信源管理 ==================== */
.sources-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    max-width: 1100px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.task-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 18px 24px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-info h3 {
    font-size: 16px;
    color: #1a237e;
    margin-bottom: 4px;
    word-break: break-all;
}

.task-info p {
    font-size: 13px;
    color: #777;
    word-break: break-all;
}

.task-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.source-type-tag {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 6px;
    vertical-align: middle;
}

.status-chip {
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.status-chip.on { background: #e8f5e9; color: #2e7d32; }
.status-chip.off { background: #fce4ec; color: #c62828; }

.source-label {
    font-size: 12px;
    color: #999;
}

/* ==================== 系统配置表单 ==================== */
.config-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.config-saved {
    color: #2e7d32;
    font-size: 14px;
}

.config-hint {
    margin-bottom: 20px;
    line-height: 1.7;
}

.config-form {
    background: white;
    padding: 24px 28px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.config-form h2 {
    margin-top: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: #555;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.form-group select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.form-row {
    display: flex;
    gap: 16px;
}

.radio-inline {
    display: flex;
    gap: 16px;
    padding-top: 6px;
}

.radio-inline-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal !important;
    cursor: pointer;
}

.radio-inline-item input[type="radio"] {
    width: auto;
    accent-color: #1a237e;
}

.label-hint {
    font-weight: normal;
    color: #999;
    font-size: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ==================== 任务调度 ==================== */
.job-id-tag {
    display: inline-block;
    background: #eceff1;
    color: #546e7a;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-family: Consolas, Monaco, monospace;
    margin-left: 6px;
    vertical-align: middle;
    word-break: break-all;
}

.trgger-text {
    font-family: Consolas, Monaco, monospace;
    color: #1565c0;
    margin-left: 4px;
}

/* ==================== 运行日志 ==================== */
.logs-panel {
    background: #0f1419;
    border-radius: 10px;
    padding: 16px 20px;
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    font-family: Consolas, Monaco, "Courier New", monospace;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.logs-panel .empty {
    color: #8b949e;
    padding: 40px;
}

.log-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #1c2430;
    font-size: 12.5px;
    line-height: 1.5;
    word-break: break-all;
}

.log-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.log-row.INFO { color: #c9d1d9; }
.log-row.WARNING { color: #e3b341; }
.log-row.ERROR { color: #f85149; }
.log-row.DEBUG { color: #8b949e; }

.log-level {
    flex-shrink: 0;
    font-weight: bold;
    min-width: 58px;
    text-align: center;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
}

.log-level.INFO { background: #1f6feb33; color: #58a6ff; }
.log-level.WARNING { background: #d2992233; color: #e3b341; }
.log-level.ERROR { background: #f8514940; color: #f85149; }
.log-level.DEBUG { background: #8b949e22; color: #8b949e; }

.log-time {
    flex-shrink: 0;
    color: #8b949e;
    font-size: 11.5px;
}

.log-module {
    flex-shrink: 0;
    color: #79c0ff;
    font-weight: bold;
}

.log-action {
    flex-shrink: 0;
    color: #7ee787;
}

.log-message {
    flex: 1;
    min-width: 0;
    color: inherit;
    white-space: pre-wrap;
}

/* ==================== 信源卡片 ==================== */
.source-card {
    cursor: default;
}

.source-card .task-info p {
    color: #555;
    font-size: 12.5px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .header { padding: 14px 16px; }
    .filter-bar { padding: 12px 16px; }
    .intel-list { padding: 12px 16px; }
    .config-page, .scheduler-page { padding: 16px; }
    .form-row { flex-direction: column; gap: 0; }
    .task-card { flex-direction: column; align-items: flex-start; }
    .task-actions { width: 100%; justify-content: flex-end; }
    .log-row { flex-wrap: wrap; gap: 4px 10px; }
    .log-module, .log-action { flex-shrink: 1; }
    .modal { padding: 18px 16px; }
}

/* ==================== 滚动条美化 ==================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c5cae9; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9fa8da; }
::-webkit-scrollbar-track { background: transparent; }

/* ==================== 港口查验 / 服务商搜索 ==================== */
.search-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    max-width: 900px;
}

.search-input-flex {
    flex: 1;
    min-width: 220px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-engine-hint {
    color: #999;
    font-size: 12px;
    margin-bottom: 18px;
}

.search-engine-hint code {
    background: #e8eaf6;
    color: #283593;
    padding: 2px 6px;
    border-radius: 4px;
}

.result-card {
    background: white;
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    max-width: 900px;
}

.result-card h3 {
    font-size: 15px;
    color: #1a237e;
    margin-bottom: 6px;
    word-break: break-all;
}

.result-card h3 a {
    color: #1565c0;
    text-decoration: none;
}

.result-card h3 a:hover {
    text-decoration: underline;
}

.result-snippet {
    font-size: 13.5px;
    color: #555;
    line-height: 1.7;
}

.result-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
}

.score-tag {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 10px;
}

/* 服务商搜索分类展示 */
.provider-categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.provider-type-block {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px 16px;
    background: #fafafa;
}
.provider-type-title {
    margin: 0 0 12px;
    font-size: 16px;
    color: #1a237e;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px;
}
.provider-country-block {
    margin-bottom: 14px;
}
.provider-country-title {
    margin: 0 0 8px;
    font-size: 14px;
    color: #555;
    font-weight: 600;
}

/* 服务商建联（联系方式提取 / 发送） */
.outreach-box {
    margin-top: 10px;
    border-top: 1px dashed #e0e0e0;
    padding-top: 10px;
}
.contact-info {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.8;
}
.contact-info p {
    margin: 4px 0;
}
.outreach-result {
    margin-top: 6px;
    font-size: 12px;
}
.outreach-ok {
    color: #2e7d32;
    background: #e8f5e9;
    padding: 2px 8px;
    border-radius: 10px;
}
.outreach-err {
    color: #c62828;
    background: #ffebee;
    padding: 2px 8px;
    border-radius: 10px;
}

.card-meta .tag {
    white-space: nowrap;
}