/* ============================================================
 * latency-tool.css
 * 网络时延查询工具样式
 * ============================================================ */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-hover: 0 4px 6px rgba(0,0,0,0.1), 0 10px 24px rgba(0,0,0,0.08);
}


body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---- Header ---- */
.query-header { text-align: center; padding: 30px 0 20px; }
.query-header h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px; }
.query-header p { color: var(--text-secondary); font-size: 15px; }

/* ---- Query Panel ---- */
.query-panel {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 26px; margin-bottom: 20px;
}
.node-selectors { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 10px; }
.node-group { flex: 1; }
.node-group label {
  display: block; font-size: 15px; font-weight: 600;
  color: #333; margin-bottom: 8px;
}
.node-group select {
  width: 100%; height: 46px; padding: 0 36px 0 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: var(--card-bg);
  cursor: pointer; transition: border-color .2s, box-shadow .2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.node-group select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.swap-btn {
  width: 40px; height: 40px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card-bg);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transform: rotate(90deg);
  transition: all .2s;  flex-shrink: 0;
}
.swap-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.swap-btn svg { width: 18px; height: 18px; }

.query-actions {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.route-options { display: flex; align-items: center; gap: 20px; }
.route-options label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; cursor: pointer; font-weight: 500;
}
.route-options input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer;margin-top: 0;
}
.route-label--required {
  font-size: 14px; font-weight: 600; 
}

.btn-query {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 28px; background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.btn-query:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-query:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-query svg { width: 16px; height: 16px; }

.legend-bar {
  display: flex; align-items: center; gap: 16px; margin-top: 16px;
  padding-top: 16px; border-top: 1px solid var(--border-light); flex-wrap: wrap;
}
.legend-text { font-size: 13px; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-good   { background: var(--success); }
.dot-medium { background: var(--warning); }
.dot-high   { background: var(--danger); }

/* ---- Feature Cards ---- */
.features {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px;
}
@media (max-width: 900px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .features { grid-template-columns: 1fr; } }

.feature-card {
  background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 20px 12px; display: flex; align-items: flex-start; gap: 14px; transition: box-shadow .3s;
}
.feature-card:hover { box-shadow: var(--shadow-hover); }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.feature-icon svg { width: 20px; height: 20px; }
.icon-blue   { background: #eff6ff; color: var(--primary); }
.icon-teal   { background: #f0fdfa; color: #14b8a6; }
.icon-orange { background: #fff7ed; color: #f97316; }
.icon-purple { background: #faf5ff; color: #a855f7; }
.feature-content h4 { font-size: 15px; font-weight: 600; margin-bottom: 3px; margin-top: 0;}
.feature-content p  { font-size: 13px; color: var(--text-muted); }

/* ---- Map Section ---- */
.map-section {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 80px;
}
.map-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap; gap: 10px;
}
.map-toolbar h3 { font-size: 15px; font-weight: 600; margin: 0; }
.route-tabs { display: flex; gap: 6px; }
.route-tab {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; background: var(--border-light);
  color: var(--text-secondary); transition: all .2s;
}
.route-tab.active { background: var(--primary); color: white; }

.map-wrapper { position: relative; width: 100%; height: 560px; background: #eaf0f8; }
#map { width: 100%; height: 100%; }

/* MapLibre attribution */
.maplibregl-ctrl-attrib { font-size: 10px !important; opacity: 0.7; }
.maplibregl-ctrl-attrib:hover { opacity: 1; }

/* Map legend overlay */
.map-legend {
  position: absolute; bottom: 30px; left: 10px; z-index: 10;
  background: rgba(255,255,255,0.94); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; font-size: 12px; color: var(--text-secondary);
  backdrop-filter: blur(6px); box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.map-legend-item { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.map-legend-item:last-child { margin-bottom: 0; }
.ml-dot  { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid white; flex-shrink: 0; }
.ml-line { display: inline-block; width: 22px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.ml-dash { display: inline-block; width: 22px; height: 0; border-top: 2.5px dashed; flex-shrink: 0; }

/* Loading overlay */
.loading-overlay {
  position: absolute; inset: 0; background: rgba(248,250,252,.88);
  display: none; align-items: center; justify-content: center;
  z-index: 20; font-size: 14px; color: var(--text-secondary); gap: 10px;
  flex-direction: column;
}
.loading-overlay.active { display: flex; }
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Map error fallback */
.map-error-fallback {
  position: absolute; inset: 0; display: none; flex-direction: column;
  align-items: center; justify-content: center;
  background: #f8fafc; color: var(--text-secondary); gap: 12px; z-index: 15;
}
.map-error-fallback.active { display: flex; }
.map-error-fallback svg { width: 48px; height: 48px; color: var(--text-muted); }
.map-error-fallback p { font-size: 14px; text-align: center; max-width: 360px; line-height: 1.7; }
.map-error-fallback .retry-btn {
  margin-top: 4px; padding: 8px 20px; background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .2s;
}
.map-error-fallback .retry-btn:hover { background: var(--primary-hover); }

/* ---- Results Panel ---- */
.results-panel { padding: 16px 20px 20px; border-top: 1px solid var(--border-light); background: #fafbfc; }
.results-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.results-header h4 { font-size: 15px; font-weight: 600; margin: 0;}
.latency-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.badge-good   { background: #dcfce7; color: #166534; }
.badge-medium { background: #fef3c7; color: #92400e; }
.badge-high   { background: #fee2e2; color: #991b1b; }

.route-path { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-bottom: 12px; }
.route-node { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.route-node-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid white; }
.route-arrow { color: var(--text-muted); font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }

/* 段时延标签（箭头旁显示每跳延时） */
.seg-latency {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 2px;
}

/* 无路由数据提示 */
.no-route-tip {
  text-align: center;
  padding: 14px 16px 0;
  color: var(--text-muted);
}
.no-route-tip svg { margin: 0 auto 8px; stroke: var(--text-muted); }
.no-route-tip p { font-size: 14px; }
.no-route-sub { font-size: 12px; margin-top: 4px; color: var(--text-muted); opacity: 0.7; }

.route-details {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
}
.detail-item {
  background: white; padding: 12px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.detail-item .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.detail-item .value { font-size: 18px; font-weight: 700; }
.detail-item .unit { font-size: 12px; color: var(--text-muted); margin-left: 2px; font-weight: 400; }

.route-rule-tip {
  background: #f0f9ff; border: 1px solid #bae6fd; border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 12px; color: #0369a1; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 6px;
}
.route-rule-tip svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

/* ---- Coverage Section ---- */
.coverage-section {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 32px; margin-bottom: 40px;
}
.coverage-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.coverage-header svg { width: 28px; height: 28px; color: var(--primary); }
.coverage-header h3 { font-size: 18px; font-weight: 700; }
.coverage-header .count { color: var(--primary); font-weight: 700; }

.coverage-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
@media (max-width: 900px) { .coverage-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .coverage-grid { grid-template-columns: 1fr; }

.route-options input[type="checkbox"] {
  width: 15px; height: 15px;margin-top: 0;
}

}
.route-options label{
  margin-bottom: 0;
}
.coverage-region { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.region-title { padding: 10px 14px; background: var(--primary-light); font-size: 14px; font-weight: 600; color: var(--primary); }
.region-nodes { padding: 0px 14px; }
.region-nodes li {
  list-style: none; padding: 6px 0; font-size: 13px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--border-light);
}
.region-nodes li:last-child { border-bottom: none; }
.region-nodes li.is-hub-node { color: #f97316; font-weight: 600; }

/* ---- MapLibre popup ---- */
.node-popup .maplibregl-popup-content {
  background: rgba(15,23,42,0.9); color: white;
  padding: 8px 12px; border-radius: 8px; font-size: 12px;
  backdrop-filter: blur(6px); box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.node-popup .maplibregl-popup-tip { border-top-color: rgba(15,23,42,0.9); }
.node-popup strong { font-size: 13px; }
.node-popup .popup-sub { opacity: 0.75; font-size: 11px; margin-top: 2px; }
.el-select-group__title{
  color: #2563eb; font-weight: 600; border-bottom: 1px solid #98b3ed; font-size: 14px;padding-top: 5px;
}
.el-select-group__title:first-child{padding-top: 0;}
.el-select-group .el-select-dropdown__item{padding-left: 28px;}
.el-select__input{
      opacity: 0 !important;
}
.el-select__input:focus{
  border: unset !important;
  box-shadow: unset !important;
}
.route-section{
  margin-bottom: 20px;
}