/* ========== 完全复用统一的全局样式 ========== */
* {
    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;
    max-width: 500px;
}
.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;
}
.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; /* 长文本换行 */
    font-size: 13px;
}
.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; /* 重置margin */
}
.history-item:hover {
    background: #e8f4f8; /* 统一hover背景 */
    border-color: #28a745; /* 统一hover边框色 */
    color: #28a745; /* 统一hover文字色 */
}

/* ========== 文章模块样式 ========== */
.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;
    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;
        width: 100%;
        overflow-x: hidden;
    }
    .container {
        width: 100%;
        padding: 0 10px;
    }
    .container-inner {
        padding: 15px;
        margin: 10px auto;
        border-radius: 8px;
    }
    .navbar {
        padding: 10px 15px;
    }
    .navbar-container {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .navbar-menu {
        gap: 10px;
        flex-wrap: wrap;
        width: 100%;
    }
    .navbar-menu a {
        font-size: 12px;
    }
    .title-btn-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .card-link-btn {
        width: 100%;
        text-align: center;
    }
    .module {
        padding: 15px;
        margin-bottom: 15px;
    }
    .btn {
        width: 100%;
    }
    
    /* ========== 核心修改：手机端历史记录样式 ========== */
    .history-items {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        max-height: 150px; /* 固定高度 */
        overflow-y: auto;   /* 垂直滚动 */
        padding-right: 5px; /* 滚动条内边距 */
        flex-direction: row; /* 保持横向排列 */
    }
    .history-item {
        padding: 6px 12px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 13px;
        color: #333;
        cursor: pointer;
        transition: all 0.2s;
        white-space: nowrap;
        text-decoration: none;
        width: auto; /* 重置宽度 */
        margin: 0; /* 重置margin */
        text-align: left; /* 重置对齐方式 */
    }
    
    .result-table {
        font-size: 12px;
    }
    .result-table th, .result-table td {
        padding: 8px 10px;
    }

    /* 适配表单控件在移动端的显示 */
    .form-control {
        max-width: unset;
        width: 100%;
    }

    /* 按钮间距适配 */
    div[style*="display: flex; gap: 10px; flex-wrap: wrap;"] {
        flex-direction: column;
        gap: 8px !important;
    }
}

/* 表格响应式优化 */
.result-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 固定表格布局，防止列宽错乱 */
}
.result-table th, .result-table td {
    padding: 12px 8px; /* 减小内边距 */
    word-wrap: break-word; /* 长文本换行 */
    font-size: 13px;
}
/* 移动端表格横向滚动 */
@media only screen and (max-width: 767px) {
    .result-area {
        overflow-x: auto; /* 横向滚动 */
    }
    .result-table {
        min-width: 600px; /* 保证表格最小宽度 */
    }
}

/* 图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; }
.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; }

/* 数组标签样式（兼容原有功能） */
.list-item {
    padding: 3px 8px;
    background-color: #f0f7ff;
    border-radius: 4px;
    color: #409eff;
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 5px;
}
/* ============================== */
/* 导航栏下拉菜单 - 手机自适应修复 */
/* ============================== */
.navbar-dropdown {
  position: relative;
  display: inline-block;
}
.navbar-submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  z-index: 9999;
  background: #ffffff;
  padding: 5px 0;
}
.navbar-submenu a {
  display: block;
  padding: 8px 15px;
  color: #333 !important;
  white-space: nowrap;
  text-decoration: none;
}
.navbar-submenu a:hover {
  background: #f5f5f5;
  color: #28a745 !important;
}
.navbar-dropdown:hover .navbar-submenu {
  display: block;
}

/* ============================== */
/* 手机端专属优化（不影响电脑端） */
/* ============================== */
@media only screen and (max-width: 767px) {
  /* 导航栏换行 + 下拉菜单正常显示 */
  .navbar-menu {
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: flex-start !important;
    width: 100% !important;
  }
  .navbar-dropdown {
    display: inline-block;
  }
  .navbar-submenu {
    position: fixed !important;
    left: auto !important;
    right: 10px !important;
    top: auto !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 4px;
  }

  /* 搜索框 + 查询 重置按钮 手机端自动换行不挤压 */
  .module div[style*="display:flex"] {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  #urlInput {
    min-width: 200px !important;
    flex: 1 !important;
  }

  /* 表格手机端不被挤压 */
  .result-area {
    overflow-x: auto !important;
    padding: 10px !important;
  }
  .result-table {
    min-width: 500px !important;
  }
}
       /* 新增：检测中提示样式，更醒目 */
        #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;
        }