/* ========== 完全复用统一的全局样式 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

body {
    background-color: #f5f7fa;
    padding: 0;
    min-width: 1200px; /* 电脑端最小宽度 */
}

/* ========== 统一风格的导航栏 ========== */
.navbar {
    background-color: #28a745; /* 统一绿色导航栏 */
    color: #fff;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 999;
}
.navbar-container {
    max-width: 1920px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-logo {
    font-size: 20px;
    font-weight: 700;
}
.navbar-menu {
    display: flex;
    gap: 30px;
}
.navbar-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.3s;
}
.navbar-menu a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ========== 统一风格的页脚 ========== */
.footer {
    background-color: #333;
    color: #ccc;
    padding: 20px 15px;
    margin-top: 40px;
}
.footer-container {
    max-width: 1920px;
    margin: 0 auto;
}
.footer-copyright {
    text-align: center;
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

/* ========== 容器样式（适配统一风格） ========== */
.container {
    width: 98%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 0 15px;
}
.container-inner {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    padding: 30px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* ========== 模块样式（统一风格） ========== */
.module {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}
.title-btn-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e9f0;
}
.title-btn-container h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
    padding-left: 10px;
    border-left: 4px solid #28a745;
}
.card-link-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #28a745;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.2s;
}
.card-link-btn:hover {
    background: #218838;
}

/* ========== 表单样式（统一风格） ========== */
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 14px;
}
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e5e9f0;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}
.form-control:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.2);
}
.btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn:hover {
    background-color: #218838;
}

/* ========== 结果区域样式 ========== */
.result-area {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e9f0;
    overflow-x: auto; /* 全局表格横向滚动，更稳定 */
}
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    table-layout: fixed;
}
.result-table th, .result-table td {
    padding: 12px 15px;
    border: 1px solid #e5e9f0;
    text-align: left;
    word-wrap: break-word;
}
.result-table th {
    background-color: #f0f8f4;
    color: #28a745;
    font-weight: 600;
}
.result-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* ========== 状态样式 ========== */
.delay-low { color: #28a745; font-weight: 500; }
.delay-mid { color: #f59e0b; font-weight: 500; }
.delay-high { color: #ef4444; font-weight: 500; }
.error-msg { color: #ef4444; margin-bottom: 10px; padding: 8px; background: #fff1f0; border-radius: 4px; }

/* ========== 历史记录样式（关键修改：统一风格） ========== */
.history-display-area {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e9f0;
}
.history-display-area h4 {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}
.history-item {
    text-decoration: none;
    color: #333;
    cursor: pointer;
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
    margin: 0;
}
.history-item:hover {
    background: #e8f4f8;
    border-color: #28a745;
    color: #28a745;
}

/* ========== 文章模块样式 ========== */
.mod-article {
    margin-top: 20px;
}
.mod-article .hd {
    margin-bottom: 15px;
}
.mod-article .title {
    color: #28a745;
    font-size: 18px;
    font-weight: 600;
}
.mod-article .bd {
    line-height: 1.8;
    color: #555;
}
.mod-article .bd p {
    margin-bottom: 10px;
}

/* ========== 保留路由追踪页面特有的样式 ========== */
.result-loading {
    text-align: center;
    color: #28a745;
    font-size: 14px;
    padding: 20px;
}

/* 图2样式 - 核心布局 */
.traceroute-container { margin-bottom: 24px; }
.traceroute-top { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.traceroute-input { flex: 1; padding: 16px 20px; border: 1px solid #e5e7eb; border-radius: 12px; font-size: 16px; background: #fff; }
.traceroute-btn { padding: 16px 40px; background: #22c55e; color: #fff; border: none; border-radius: 12px; font-size: 18px; cursor: pointer; transition: background 0.3s; }
.traceroute-btn:hover { background: #16a34a; }

/* 选项区样式 */
.traceroute-options { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.option-group { display: flex; align-items: center; gap: 12px; }
.option-group label { font-size: 16px; color: #374151; }
.node-select { padding: 12px 16px; border: 1px solid #e5e7eb; border-radius: 12px; font-size: 16px; min-width: 280px; }
.dns-group { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.radio-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 16px; color: #374151; }
.radio-label input[type="radio"] { width: 20px; height: 20px; accent-color: #2563eb; }
.dns-input { padding: 12px 16px; border: 1px solid #e5e7eb; border-radius: 12px; font-size: 16px; min-width: 280px; }

/* 新增：检测中提示样式，更醒目 */
#loading {
    display: none;
    text-align: center;
    font-size: 16px;
    color: #007bff;
    padding: 12px;
    font-weight: 500;
    background: #e8f4fd;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid #b8daff;
}

/* ========== 响应式适配（终极优化：手机完美自适应） ========== */
@media only screen and (max-width: 767px) {
    body {
        min-width: unset !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }
    .container {
        width: 100% !important;
        padding: 0 10px !important;
    }
    .container-inner {
        padding: 15px !important;
        margin: 10px auto !important;
        border-radius: 8px !important;
    }

    /* 导航栏手机端完美适配 */
    .navbar {
        padding: 10px 15px !important;
    }
    .navbar-container {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }
    .navbar-menu {
        gap: 10px !important;
        flex-wrap: wrap !important;
        width: 100% !important;
    }
    .navbar-menu a {
        font-size: 12px !important;
    }

    /* 标题按钮区 */
    .title-btn-container {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    .card-link-btn, .btn {
        width: 100% !important;
        text-align: center !important;
    }

    .module {
        padding: 15px !important;
        margin-bottom: 15px !important;
    }

    /* 手机端：路由追踪输入框 + 按钮 垂直排列 */
    .traceroute-top {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .traceroute-input,
    .traceroute-btn {
        width: 100% !important;
    }

    /* 选项区手机端自动换行 */
    .traceroute-options,
    .option-group,
    .dns-group {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        width: 100% !important;
    }
    .node-select,
    .dns-input {
        min-width: unset !important;
        width: 100% !important;
    }

    /* 历史记录手机端优化 */
    .history-items {
        max-height: 120px !important;
        gap: 6px !important;
    }
    .history-item {
        font-size: 12px !important;
        padding: 5px 10px !important;
    }

    /* 表格手机端终极优化 */
    .result-area {
        padding: 10px !important;
    }
    .result-table {
        min-width: 600px !important;
        font-size: 12px !important;
    }
    .result-table th,
    .result-table td {
        padding: 8px 10px !important;
    }
}