/* ========================================================
   微信域名全链路跳转追踪与拦截检测系统
   设计风格：简约、克制、清新专业 (Minimalist Clean SaaS)
   ======================================================== */

:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --primary: #0f172a;
    --primary-hover: #1e293b;
    
    --pass-text: #15803d;
    --pass-bg: #f0fdf4;
    --pass-border: #bbf7d0;
    
    --warn-text: #b45309;
    --warn-bg: #fffbeb;
    --warn-border: #fde68a;
    
    --block-text: #b91c1c;
    --block-bg: #fef2f2;
    --block-border: #fecaca;
    
    --info-text: #0369a1;
    --info-bg: #f0f9ff;
    --info-border: #bae6fd;
    
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    padding: 24px 20px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    width: 100%;
    max-width: 1720px;
    margin: 0 auto;
    transition: max-width 0.2s ease;
}

/* 顶部导航 Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.title h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.title p {
    font-size: 13px;
    color: var(--text-muted);
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mode-toggle-group {
    display: flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.mode-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mode-btn.active {
    background: #ffffff;
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
}

/* Tab 选项卡 */
.nav-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: #f1f5f9;
}

.tab-btn.active {
    color: var(--text-primary);
    background: #ffffff;
    font-weight: 600;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* 页面内容板块 */
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}

/* 卡片容器 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

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

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.sub-text {
    font-size: 13px;
    color: var(--text-muted);
}

/* 表单与输入框 */
.input-group {
    display: flex;
    gap: 10px;
}

.url-input {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.url-input:focus {
    border-color: #64748b;
    box-shadow: 0 0 0 1px #64748b;
}

.btn {
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: #f8fafc;
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.quick-links {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.sample-chip {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 3px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.sample-chip:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

/* 诊断结论 Banner */
.result-banner {
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.result-banner.pass {
    background: var(--pass-bg);
    border-color: var(--pass-border);
}
.result-banner.warn {
    background: var(--warn-bg);
    border-color: var(--warn-border);
}
.result-banner.block {
    background: var(--block-bg);
    border-color: var(--block-border);
}
.result-banner.err {
    background: #f8fafc;
    border-color: var(--border);
}

.banner-content h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.result-banner.pass .banner-content h3 { color: var(--pass-text); }
.result-banner.warn .banner-content h3 { color: var(--warn-text); }
.result-banner.block .banner-content h3 { color: var(--block-text); }
.result-banner.err .banner-content h3 { color: var(--text-primary); }

.banner-content p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.banner-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-tag {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
}

/* 逐跳时间线节点 */
.timeline-flow {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hop-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: border-color 0.15s;
}

.hop-card:hover {
    border-color: var(--border-hover);
}

.hop-card.intercept-node {
    border-color: #fca5a5;
    background: #fffafa;
}

.hop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.hop-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.hop-num {
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.hop-card.intercept-node .hop-num {
    background: var(--block-bg);
    color: var(--block-text);
    border-color: var(--block-border);
}

.status-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
}

.status-badge.status-200 {
    background: var(--pass-bg);
    color: var(--pass-text);
    border: 1px solid var(--pass-border);
}
.status-badge.status-302, .status-badge.status-301 {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}
.status-badge.status-403, .status-badge.status-404, .status-badge.status-500, .status-badge.status-502 {
    background: var(--block-bg);
    color: var(--block-text);
    border: 1px solid var(--block-border);
}

.hop-telemetry {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.hop-url-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
    margin-bottom: 6px;
}

.hop-target {
    font-size: 12px;
    color: #2563eb;
    margin-top: 4px;
}

.hop-target code {
    background: #eff6ff;
    padding: 2px 6px;
    border-radius: 4px;
    word-break: break-all;
}

.hop-alert-box {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    background: var(--block-bg);
    border-left: 3px solid #dc2626;
    color: var(--block-text);
}

.hop-iframe-box {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    background: var(--warn-bg);
    border-left: 3px solid #d97706;
    color: var(--warn-text);
    word-break: break-all;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.val-pass { color: var(--pass-text); }
.val-warn { color: var(--warn-text); }
.val-block { color: var(--block-text); }

/* 批量页面 */
.batch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.batch-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.form-select {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
    outline: none;
}

.batch-textarea {
    width: 100%;
    height: 160px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 13px;
    outline: none;
    resize: vertical;
    margin-bottom: 12px;
}

.batch-textarea:focus {
    border-color: #64748b;
    box-shadow: 0 0 0 1px #64748b;
}

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

/* 表格 */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.custom-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.custom-table th, .custom-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.custom-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

/* 列宽分配与防止挤压 */
.custom-table td:nth-child(1) { white-space: nowrap; width: 140px; }
.custom-table td:nth-child(2) { min-width: 280px; max-width: 360px; word-break: break-all; font-family: monospace; font-size: 12px; }
.custom-table td:nth-child(3) { white-space: nowrap; width: 70px; }
.custom-table td:nth-child(4) { white-space: nowrap; width: 65px; }
.custom-table td:nth-child(5) { white-space: nowrap; width: 90px; }
.custom-table td:nth-child(6) { white-space: nowrap; width: 80px; }
.custom-table td:nth-child(7) { min-width: 140px; }
.custom-table td:nth-child(8) { min-width: 140px; }
.custom-table td:nth-child(9) { white-space: nowrap; width: 60px; }

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

.custom-table tr:hover td {
    background: #f8fafc;
}

.text-center {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
}

/* API 文档区 */
.section-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 20px;
}

.api-block {
    margin-bottom: 20px;
}

.api-block h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.api-param-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.code-block {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-family: monospace;
    font-size: 13px;
    color: #1e293b;
    overflow-x: auto;
}

/* 按钮组与搜索框 */
.flex-wrap {
    flex-wrap: wrap;
    gap: 12px;
}

.search-wrap {
    flex: 1;
    min-width: 260px;
    max-width: 400px;
}

.search-wrap .url-input {
    width: 100%;
}

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

/* Spinner 与 Toast */
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 10px 16px;
    background: #0f172a;
    color: #ffffff;
    border-radius: var(--radius-md);
    font-size: 13px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================================
   自适应响应式系统：全屏(宽屏/2K/4K)与移动端(H5)深度适配
   ======================================================== */

/* 1. 超宽屏 / 2K / 4K 全屏优化 (Widescreen & Fullscreen 1920px ~ 2560px+) */
@media (min-width: 1920px) {
    body {
        padding: 32px 40px;
    }
    .app-container {
        max-width: 2100px;
    }
    .card {
        padding: 24px 28px;
    }
    .title h1 {
        font-size: 20px;
    }
    .batch-textarea {
        height: 220px;
    }
    .stat-card {
        padding: 20px 24px;
    }
    .stat-value {
        font-size: 28px;
    }
}

@media (min-width: 2560px) {
    body {
        padding: 36px 48px;
    }
    .app-container {
        max-width: 2400px;
    }
}

/* 2. 平板与中等屏幕自适应 (Tablet / Laptop <= 1024px) */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .custom-table {
        min-width: 900px;
    }
}

/* 3. 移动端 H5 深度自适应 (Mobile H5 <= 768px) */
@media (max-width: 768px) {
    body {
        padding: 12px 12px calc(18px + env(safe-area-inset-bottom, 0px)) 12px;
    }
    
    header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px 14px;
        margin-bottom: 14px;
    }
    
    .brand {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .title h1 {
        font-size: 16px;
    }
    
    .title p {
        font-size: 12px;
    }
    
    .header-tools {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
    
    .mode-toggle-group {
        flex: 1;
    }
    
    .mode-btn {
        flex: 1;
        text-align: center;
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .status-indicator {
        font-size: 11px;
        padding: 5px 8px;
        white-space: nowrap;
    }
    
    .nav-tabs {
        margin-bottom: 14px;
        padding-bottom: 6px;
        gap: 6px;
    }
    
    .tab-btn {
        padding: 7px 12px;
        font-size: 13px;
    }
    
    .card {
        padding: 16px 14px;
        margin-bottom: 14px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .input-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .url-input {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .btn {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }
    
    .quick-links {
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 14px;
    }
    
    .quick-links span {
        width: 100%;
        margin-bottom: 2px;
    }
    
    .sample-chip {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .result-banner {
        padding: 14px;
        margin-bottom: 14px;
    }
    
    .banner-content h3 {
        font-size: 14px;
    }
    
    .banner-tags {
        gap: 6px;
    }
    
    .meta-tag {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .hop-card {
        padding: 12px;
    }
    
    .hop-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .hop-title {
        width: 100%;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .hop-telemetry {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 11px;
        padding-top: 6px;
        border-top: 1px dashed var(--border);
    }
    
    .hop-url-box {
        font-size: 11px;
        padding: 6px 8px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 14px;
    }
    
    .stat-card {
        padding: 12px 14px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .batch-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .batch-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .batch-textarea {
        height: 140px;
        font-size: 12px;
    }
    
    .batch-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .batch-footer .btn {
        width: 100%;
    }
    
    .search-wrap {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    
    .btn-group {
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1;
        min-height: 40px;
    }
    
    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        text-align: center;
        transform: translateY(20px);
    }
    
    .code-block {
        font-size: 12px;
        padding: 10px 12px;
    }
}

/* 4. 小屏手机适配 (Mobile <= 380px) */
@media (max-width: 380px) {
    body {
        padding: 8px 8px calc(14px + env(safe-area-inset-bottom, 0px)) 8px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .tab-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}
