/* ============================================================
   COMMAND.CSS — Command Center dashboard styles
   ============================================================ */

/* ─── Page Header Flex ──────────────────────────────────── */
.page-header-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-shrink: 0;
}

#refresh-btn {
  font-size: 16px;
  padding: 4px 8px;
}

/* ─── Pipeline Stage Bar ─────────────────────────────────── */
.pipeline-bar {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.pipeline-stage {
  flex: 1;
  min-width: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.pipeline-stage:hover {
  border-color: var(--text-muted);
}

.pipeline-stage .stage-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.pipeline-stage .stage-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-top: 6px;
}

.pipeline-stage.active-stage {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.pipeline-stage.active-stage .stage-count {
  color: var(--accent);
}

/* Chevron arrows between stages */
.pipeline-stage:not(:last-child)::after {
  content: '›';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-faint);
  z-index: 1;
  pointer-events: none;
}

/* ─── Action Required Panel ─────────────────────────────── */
.action-list {
  list-style: none;
}

.action-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  padding-left: var(--space-md);
  margin-left: -1px;
}

.action-item:last-child {
  border-bottom: none;
}

.action-item.action-overdue {
  border-left-color: var(--danger);
}

.action-item.action-stale {
  border-left-color: var(--text-muted);
}

.action-item.action-idea {
  border-left-color: var(--info);
}

.action-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.action-body {
  flex: 1;
  min-width: 0;
}

.action-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.action-clear {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  color: var(--success);
  font-size: 13px;
  font-weight: 500;
}

.action-clear .clear-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

/* ─── Activity Feed ──────────────────────────────────────── */
.activity-list {
  list-style: none;
}

.activity-list-fixed {
  height: 380px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

/* Prevent activity/schedule cards from blowing out grid width */
.grid-2 > .card {
  min-width: 0;
  overflow: hidden;
}

.activity-item {
  max-width: 100%;
  overflow: hidden;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-type-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-title a {
  color: inherit;
  text-decoration: none;
}

.activity-title a:hover {
  color: var(--accent);
}

.activity-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

.activity-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Activity filter pills */
.activity-filters {
  display: flex;
  gap: 4px;
}

.filter-pill {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Upcoming Schedule ─────────────────────────────────── */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.schedule-day-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 8px 0 4px;
}

.schedule-day-label:first-child {
  padding-top: 0;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  font-size: 13px;
}

.schedule-item .platform-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}

.schedule-item .platform-chip.chip-ig { background: #E1306C; }
.schedule-item .platform-chip.chip-yt { background: #FF0000; }
.schedule-item .platform-chip.chip-tt { background: #010101; }
.schedule-item .platform-chip.chip-x { background: #1DA1F2; }
.schedule-item .platform-chip.chip-th { background: #000000; }
.schedule-item .platform-chip.chip-yts { background: #FF0000; }

.schedule-item-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.schedule-item-time {
  font-size: 11px;
  color: var(--text-faint);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.schedule-empty {
  padding: var(--space-md);
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

/* ─── Training Pulse ────────────────────────────────────── */
.training-pulse {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.pulse-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.pulse-stat-label {
  color: var(--text-muted);
}

.pulse-stat-value {
  font-weight: 600;
  color: var(--text-primary);
}

.pulse-week-grid {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}

.pulse-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pulse-day-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}

.pulse-dot.filled {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.pulse-dot.today {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── System Health ─────────────────────────────────────── */
.system-status-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.system-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--space-md);
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.system-status-row .sys-label {
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.system-status-row .sys-value {
  font-size: 12px;
  color: var(--text-faint);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green {
  background: var(--success);
  animation: pulse-green 2s infinite;
}

.status-dot.yellow {
  background: var(--warning);
}

.status-dot.red {
  background: var(--danger);
}

.status-dot.grey {
  background: var(--text-faint);
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 4px var(--success); }
  50% { box-shadow: 0 0 10px var(--success); }
}

/* ─── Trend Arrows ─────────────────────────────────────── */
.trend-up {
  color: var(--success);
  font-size: 14px;
  font-weight: 700;
  margin-left: 4px;
}

.trend-down {
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
  margin-left: 4px;
}

.trend-flat {
  color: var(--text-faint);
  font-size: 14px;
  margin-left: 4px;
}

/* ─── Approve / Reject Buttons ─────────────────────────── */
.action-buttons {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-approve {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
  font-weight: 600;
}

.btn-approve:hover {
  background: rgba(74, 222, 128, 0.25);
}

.btn-approve:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-reject {
  background: rgba(248, 113, 113, 0.08);
  color: var(--text-faint);
  border: 1px solid var(--border);
  font-weight: 500;
}

.btn-reject:hover {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.3);
}

.btn-reject:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Training Progress Bar ────────────────────────────── */
.pulse-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.pulse-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ─── Exercise Tags ────────────────────────────────────── */
.pulse-exercises {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

.pulse-exercise-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.exercise-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.exercise-count {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 600;
}

/* ─── Habits Widget ────────────────────────────────────── */
.habit-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.2s;
}

.habit-row:last-child {
  border-bottom: none;
}

.habit-row.habit-done {
  opacity: 0.6;
}

.habit-check {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  background: transparent;
  color: transparent;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}

.habit-check:hover {
  border-color: var(--accent);
}

.habit-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.habit-check:disabled {
  cursor: wait;
  opacity: 0.5;
}

.habit-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.habit-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.habit-done .habit-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.habit-streak {
  font-size: 10px;
  font-weight: 600;
  color: var(--warning);
  background: rgba(251, 191, 36, 0.12);
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

/* ─── Goals Widget ─────────────────────────────────────── */
.goal-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.goal-row:last-child {
  border-bottom: none;
}

.goal-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 6px;
}

.goal-area-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.goal-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.goal-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.goal-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.goal-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .page-header-flex {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .pipeline-stage:not(:last-child)::after {
    display: none;
  }

  .activity-filters {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pipeline-bar {
    flex-direction: column;
  }

  .pipeline-stage {
    min-width: unset;
  }

  .schedule-item .platform-chip {
    font-size: 9px;
    padding: 1px 4px;
  }
}
