/* ============================================================
   test-agent.html — browser tunnel console
   ============================================================ */

.nav-links .nav-agent { color: var(--mint); }
.nav-links .nav-agent.active { color: var(--mint); }

.agent-section { padding-top: 96px; }

.agent-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  padding: 13px 16px;
  border: 1px solid rgba(255, 191, 105, 0.22);
  border-radius: 12px;
  background: rgba(255, 191, 105, 0.045);
}
.agent-banner-tag {
  flex: none;
  margin-top: 1px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--amber);
  color: #1a1205;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.agent-banner p {
  margin: 0;
  color: #c9b99f;
  font-size: 12.5px;
  line-height: 1.7;
}

.agent-grid {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 18px;
  align-items: start;
}

.agent-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 25, 39, 0.78), rgba(9, 16, 26, 0.78));
}
.agent-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.agent-card-head h3 { margin: 0; font-size: 1rem; }
.agent-card-head .tag { margin: 0; }

.agent-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}
.agent-state b { font-weight: 600; }

.agent-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 0 rgba(66, 232, 180, 0);
}
.agent-dot.is-online {
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(66, 232, 180, 0.55);
  animation: pulse 2.4s ease-out infinite;
}
.agent-dot.is-warn { background: var(--amber); animation: blink 1.4s ease-in-out infinite; }
.agent-dot.is-error { background: var(--red); }
.agent-dot.is-offline { background: var(--dim); }

.agent-state-detail {
  margin: 7px 0 0;
  min-height: 17px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.agent-kv {
  display: grid;
  gap: 0;
  margin: 16px 0 0;
}
.agent-kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(126, 170, 210, 0.08);
}
.agent-kv > div:first-child { border-top: 1px solid rgba(126, 170, 210, 0.08); }
.agent-kv dt {
  flex: none;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.agent-kv dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  min-width: 0;
  color: #c7d6e5;
  font-size: 12px;
  text-align: right;
}
.agent-kv dd code {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 10.5px;
}
.agent-kv dd a {
  color: var(--mint);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.agent-kv dd a:hover { text-decoration: underline; }
.agent-kv dd a[aria-disabled="true"] {
  color: var(--dim);
  pointer-events: none;
  text-decoration: none;
}

.agent-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.agent-mini:hover {
  color: var(--mint);
  border-color: rgba(66, 232, 180, 0.4);
}
.agent-mini.strong {
  background: var(--mint);
  border-color: var(--mint);
  color: #04130d;
  font-weight: 700;
}
.agent-mini.strong:hover { background: #5cf0c2; color: #04130d; }
.agent-mini:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: var(--dim);
  border-color: var(--line);
  background: transparent;
}

.agent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.agent-btn { padding: 8px 14px; font-size: 12px; }
.agent-btn.btn-primary { font-size: 12px; }

.agent-domain-form { margin-top: 18px; }
.agent-domain-form > label {
  display: block;
  margin-bottom: 6px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.agent-domain-row { display: flex; gap: 6px; }
.agent-domain-row input {
  min-width: 0;
  flex: 1;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #060c14;
  color: #cfe3f5;
  font-family: var(--mono);
  font-size: 10.5px;
  outline: none;
  transition: border-color 0.2s ease;
}
.agent-domain-row input:focus { border-color: rgba(66, 232, 180, 0.5); }
.agent-domain-row input::placeholder { color: #4f6277; }
.agent-hint {
  margin: 6px 0 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.6;
}

.agent-tests {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.agent-tests-label {
  margin-right: 2px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agent-result {
  margin: 12px 0 0;
  min-height: 74px;
  max-height: 170px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #060c14;
  color: #a9bccf;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.agent-endpoints {
  display: grid;
  max-height: 420px;
  margin-top: 12px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}
.agent-endpoint {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 2px;
  border-bottom: 1px solid rgba(126, 170, 210, 0.07);
}
.agent-endpoint-main { min-width: 0; }
.agent-endpoint-main code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: #cfe3f5;
  font-size: 10.5px;
  overflow-wrap: anywhere;
}
.agent-endpoint-desc {
  display: block;
  margin-top: 2px;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.45;
}
.agent-method {
  display: inline-block;
  width: 40px;
  padding: 2px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--mint);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
}
.agent-method.post { color: var(--blue); }
.agent-auth {
  margin-left: 4px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  vertical-align: 1px;
}
.agent-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
}
.agent-links a {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 10.5px;
  text-decoration: none;
}
.agent-links a:hover { text-decoration: underline; }
.agent-links a[aria-disabled="true"] { color: var(--dim); pointer-events: none; }

.agent-curl {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #060c14;
}
.agent-curl pre {
  max-height: 230px;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  color: #cfe0ef;
  font-size: 10.5px;
  line-height: 1.75;
}

.agent-logs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}
.agent-log-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(13, 24, 38, 0.72), rgba(8, 15, 25, 0.72));
}
.agent-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}
.agent-log {
  max-height: 240px;
  overflow: auto;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.8;
  scrollbar-width: thin;
}
.agent-log-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(126, 170, 210, 0.05);
  white-space: nowrap;
}
.agent-log-row:last-child { border-bottom: 0; }
.agent-log-time { flex: none; color: #52677d; }
.agent-log-path {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #a9bccf;
  text-overflow: ellipsis;
}
.agent-log-ms { flex: none; color: var(--dim); }
.agent-log-status {
  flex: none;
  color: var(--mint);
  font-weight: 600;
}
.agent-log-status.warn { color: var(--amber); }
.agent-log-status.err { color: var(--red); }
.agent-frame-dir { flex: none; color: var(--mint); }
.agent-frame-dir.out { color: var(--blue); }
.agent-frame-type { flex: 1; color: #a9bccf; }
.agent-frame-size { flex: none; color: var(--dim); }
.agent-empty {
  margin: 6px 0;
  color: #52677d;
  font-family: var(--mono);
  font-size: 10px;
}
.agent-muted { color: var(--dim); font-family: var(--mono); font-size: 9.5px; }

.agent-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 220;
  max-width: min(90vw, 420px);
  padding: 8px 14px;
  border: 1px solid rgba(66, 232, 180, 0.35);
  border-radius: 8px;
  background: #0b1622;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.9);
  color: var(--mint);
  font-size: 11.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.agent-toast.show { opacity: 1; transform: translate(-50%, 0); }

.agent-copy-area {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* element highlight used by POST /agent/highlight */
.agent-highlight {
  outline: 3px solid var(--mint) !important;
  outline-offset: 3px !important;
  border-radius: 4px;
  box-shadow: 0 0 0 6px rgba(66, 232, 180, 0.12), 0 0 40px rgba(66, 232, 180, 0.25) !important;
  transition: outline-color 0.3s ease, box-shadow 0.3s ease;
  animation: agentGlow 1.4s ease-in-out infinite alternate;
}

@keyframes agentGlow {
  from { box-shadow: 0 0 0 4px rgba(66, 232, 180, 0.08), 0 0 20px rgba(66, 232, 180, 0.16); }
  to { box-shadow: 0 0 0 9px rgba(66, 232, 180, 0.16), 0 0 46px rgba(66, 232, 180, 0.32); }
}

@media (max-width: 1000px) {
  .agent-grid { grid-template-columns: 1fr; }
  .agent-logs { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .agent-section { padding-top: 82px; }
  .agent-card { padding: 20px; }
  .agent-kv > div { align-items: flex-start; flex-direction: column; gap: 5px; }
  .agent-kv dd { justify-content: flex-start; text-align: left; }
  .agent-endpoint { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .agent-method { width: 36px; }
  .agent-domain-row { flex-wrap: wrap; }
  .agent-domain-row input { flex-basis: 100%; }
  .agent-links { flex-wrap: wrap; }
  .agent-curl pre { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .agent-highlight { animation: none; }
}
