/**
 * Pipetree Visualization Styles
 */

/* ========================================
   Main Content Layout
   ======================================== */

main.rounded-3xl {
  border-radius: 1.5rem !important;
}

/* Reset border-radius on all content elements except badges */
main.rounded-3xl *:not(.badge):not([class*="rounded-full"]):not([class*="pill"]) {
  border-radius: 0 !important;
}

/* Ensure badges keep their rounded style */
.badge {
  border-radius: 9999px !important;
}

/* ========================================
   Sidebar Navigation
   ======================================== */

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #94a3b8;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-icon:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.1);
}

.nav-icon.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

/* ========================================
   Tree Controls (Layout Buttons)
   ======================================== */

.tree-controls {
  display: flex;
  gap: 0;
  background: #f1f5f9;
  padding: 4px;
}

.tree-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}

.tree-controls button:hover {
  background: #e2e8f0;
  color: #334155;
}

.tree-controls button.active {
  background: white;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ========================================
   Tree Container (SVG Visualization)
   ======================================== */

.tree-container {
  background: white;
  border: 1px solid #e2e8f0;
  overflow: auto;
  padding: 24px;
}

.tree-container.hidden {
  display: none;
}

#tree-svg {
  display: block;
}

/* ========================================
   List View Container
   ======================================== */

.list-view {
  background: white;
  border: 1px solid #e2e8f0;
  padding: 8px 0;
}

.list-view.hidden {
  display: none;
}

/* ========================================
   Step List Rows (CircleCI-style)
   ======================================== */

.step-list {
  display: flex;
  flex-direction: column;
}

.step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid transparent;
}

.step-row:hover {
  background: #f8fafc;
}

.step-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

/* Status Icons */
.step-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.step-status-icon.completed {
  color: #22c55e;
}

.step-status-icon.running {
  color: #3b82f6;
}

.step-status-icon.failed {
  color: #ef4444;
}

.step-status-icon.router {
  color: #8b5cf6;
}

.step-status-icon.pending {
  color: #94a3b8;
}

/* Step Name */
.step-name {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Branch Label */
.step-branch-label {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  background: #f1f5f9;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Progress */
.step-progress {
  font-size: 12px;
  color: #3b82f6;
  white-space: nowrap;
}

/* Duration */
.step-duration {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: #94a3b8;
  flex-shrink: 0;
  min-width: 40px;
  text-align: right;
}

/* ========================================
   SVG Node Styles
   ======================================== */

#tree-svg .node-rect {
  fill: white;
  stroke: #e2e8f0;
  stroke-width: 1;
}

#tree-svg .node-group {
  cursor: pointer;
}

#tree-svg .node-group:hover .node-rect {
  fill: #f8fafc;
}

#tree-svg .node-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  font-size: 13px;
  font-weight: 500;
  fill: #1e293b;
}

#tree-svg .node-duration {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  fill: #64748b;
}

/* ========================================
   SVG Link Styles
   ======================================== */

#tree-svg .link {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 2;
}

#tree-svg .link.active {
  stroke: #22c55e;
}

#tree-svg .link.router {
  stroke: #8b5cf6;
}

/* ========================================
   Animations
   ======================================== */

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#tree-svg .spinner {
  animation: spin 1s linear infinite;
  transform-origin: center;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ========================================
   Branch Text
   ======================================== */

#tree-svg .branch-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  fill: #64748b;
}

#tree-svg .branch-text.active {
  fill: #3b82f6;
}

/* ========================================
   Step Cards (Legacy)
   ======================================== */

.step-connector {
  position: absolute;
  top: 50%;
  left: 100%;
  width: 32px;
  height: 2px;
  background: #e2e8f0;
}

.step-connector.completed {
  background: #22c55e;
}

.step-connector.running {
  background: linear-gradient(90deg, #3b82f6 0%, #e2e8f0 100%);
  animation: pulse 1.5s ease-in-out infinite;
}

.step-card {
  transition: all 0.3s ease;
}

.step-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.step-card.running {
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
  }
}

.progress-bar {
  transition: width 0.3s ease;
}
