/**
 * Planning Pipeline Styles
 */

/* Main layout */
.planning-main {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Pipeline Overview Diagram */
.pipeline-overview {
  background: var(--surface);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.pipeline-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg);
  border-radius: 8px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
}

.pipeline-stage:hover {
  border-color: var(--accent-blue);
  background: rgba(29, 155, 240, 0.1);
}

.pipeline-stage.active {
  border-color: var(--accent-blue);
  background: rgba(29, 155, 240, 0.15);
}

.stage-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stage-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.stage-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-top: 0.25rem;
}

.pipeline-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
}

/* Stage Tabs */
.stage-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.stage-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.stage-tab:hover {
  background: var(--surface);
  color: var(--text);
}

.stage-tab.active {
  background: var(--accent-blue);
  color: white;
}

/* Stage Panels */
.stage-panel {
  display: none;
}

.stage-panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-header h2 {
  font-size: 1.2rem;
  color: var(--text);
  margin: 0;
}

/* Items Grid */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
}

/* Planning Item Card */
.planning-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.planning-item:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.item-title {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  flex: 1;
}

.item-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-domain {
  background: rgba(29, 155, 240, 0.2);
  color: var(--accent-blue);
}

.badge-segment {
  background: rgba(139, 92, 246, 0.2);
  color: #8b5cf6;
}

.badge-priority-high {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.badge-priority-medium {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.badge-priority-low {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.item-preview {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  max-height: 4.5em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Logs Container */
.logs-container {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.85rem;
  max-height: 600px;
  overflow-y: auto;
}

.log-line {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1rem;
}

.log-line:last-child {
  border-bottom: none;
}

.log-timestamp {
  color: var(--text-muted);
  min-width: 140px;
}

.log-message {
  color: var(--text);
  flex: 1;
}

.log-line.error .log-message {
  color: #ef4444;
}

.log-line.warning .log-message {
  color: #eab308;
}

.log-line.success .log-message {
  color: #22c55e;
}

/* Pipeline Health */
.pipeline-health {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-radius: 4px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.pipeline-health.healthy .health-dot {
  background: #22c55e;
}

.pipeline-health.degraded .health-dot {
  background: #eab308;
}

.pipeline-health.error .health-dot {
  background: #ef4444;
}

.health-text {
  font-size: 0.85rem;
  color: var(--text);
}

/* Empty and Loading states */
.empty, .loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--surface);
  border-radius: 8px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.detail-row {
  display: flex;
  margin-bottom: 0.75rem;
}

.detail-label {
  min-width: 100px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.detail-value {
  color: var(--text);
  flex: 1;
}

.detail-preview {
  background: var(--bg);
  padding: 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
  .pipeline-diagram {
    flex-direction: column;
  }

  .pipeline-arrow {
    transform: rotate(90deg);
  }

  .items-grid {
    grid-template-columns: 1fr;
  }

  .stage-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}
