/* ── Redirect Path Tracer subpage Stylesheet ── */

/* Workspace Grid & Cards */
.workspace-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px 60px;
  animation: fadeUp 0.5s var(--ease);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 32px;
  align-items: start;
}

.fav-preview-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

@media (max-width: 1024px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

.ws-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  position: relative;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.ws-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.ws-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.ws-card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Inputs & Form Groups */
.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-70);
  margin-bottom: 8px;
}

.control-group input[type="url"] {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  padding: 12px 16px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.control-group input:focus {
  outline: none;
  border-color: var(--border-hover);
  background: var(--surface-3);
}

.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Buttons */
.btn-primary,
.btn-secondary {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  background: var(--fg);
  cursor: pointer;
  color: var(--bg);
  transition: all 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--fg);
}

.btn-primary:hover {
  background: rgba(245, 245, 245, 0.85);
  border-color: rgba(245, 245, 245, 0.85);
}

.btn-large {
  padding: 14px 24px;
  font-size: 0.95rem;
}

.btn-full-width {
  width: 100%;
}

.btn-loader {
  display: inline-flex;
  align-items: center;
}

.spinner {
  animation: rotate-spinner 1.2s linear infinite;
  width: 16px;
  height: 16px;
  color: inherit;
}

@keyframes rotate-spinner {
  100% {
    transform: rotate(360deg);
  }
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.control-panel .ws-card {
  padding: 32px !important;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.control-panel .ws-card .control-group {
  margin-bottom: 0;
}

/* Summary stats grid */
.summary-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stat-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--fg-40);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-40);
}

.empty-state p {
  font-size: 0.88rem;
  font-weight: 500;
}

/* Timeline Components */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  padding-left: 12px;
}

.timeline-container::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 21px;
  width: 2px;
  background: var(--border-strong);
  z-index: 0;
}

.timeline-node {
  position: relative;
  z-index: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-left: 32px;
  transition: all 0.25s ease;
}

.timeline-node:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
}

/* Custom bullet on left line */
.timeline-node::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fg-40);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--border-strong);
}

.timeline-node.success::before {
  background: #10b981;
}

.timeline-node.redirect::before {
  background: #f59e0b;
}

.timeline-node.error::before {
  background: #ef4444;
}

/* Node layout */
.node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.node-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hop-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--fg-40);
  text-transform: uppercase;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.redirect {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.node-url {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--fg);
  word-break: break-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

@media (max-width: 768px) {
  .node-url {
    max-width: 250px;
  }
}

.node-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.time-ms {
  font-size: 0.8rem;
  color: var(--fg-40);
  font-weight: 600;
}

.ssl-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ssl-badge.insecure {
  color: var(--fg-40);
}

.btn-toggle-headers {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-70);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toggle-headers:hover {
  border-color: var(--border-hover);
  color: var(--fg);
}

.headers-collapsible {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
  margin-top: 0;
}

.headers-collapsible.open {
  max-height: 300px;
  margin-top: 14px;
  overflow-y: auto;
}

.headers-pre {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 12px;
  color: #a855f7;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}
