/* MP Task Board — Dark Theme */

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.025em;
}

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

.task-count-summary {
  font-size: 13px;
  color: #94a3b8;
}

/* Auth widget (sign-in button or user pill) */
.auth-widget {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 999px;
  color: #e2e8f0;
  font-size: 12px;
}

.auth-pill img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.auth-pill .auth-roles {
  color: #94a3b8;
  font-size: 11px;
}

.btn-slack-signin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #4a154b;
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn-slack-signin:hover { background: #611f5f; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-ghost {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #334155;
}

.btn-ghost:hover {
  background: #334155;
  color: #e2e8f0;
}

.btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-close:hover {
  background: #334155;
  color: #f1f5f9;
}

/* Inputs */
.select-input,
.text-input {
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.select-input:focus,
.text-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.textarea-input {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 24px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-select {
  min-width: 150px;
}

/* Board Area */
.board-area {
  display: flex;
  gap: 16px;
  padding: 20px 24px;
  overflow-x: auto;
  min-height: calc(100vh - 130px);
  align-items: flex-start;
}

/* Columns */
.column {
  flex: 0 0 290px;
  min-width: 290px;
  background: #1e293b;
  border-radius: 10px;
  border: 1px solid #334155;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 160px);
}

.column-header {
  padding: 12px 14px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 3px solid var(--column-color, #3b82f6);
  border-radius: 10px 10px 0 0;
}

.column-name {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.column-count {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: #0f172a;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
}

.column-body {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.column-body::-webkit-scrollbar {
  width: 4px;
}

.column-body::-webkit-scrollbar-track {
  background: transparent;
}

.column-body::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 2px;
}

/* Drop target */
.column-body.drag-over {
  background: rgba(59, 130, 246, 0.05);
  border: 2px dashed #3b82f6;
  border-radius: 6px;
}

.column-empty {
  padding: 16px;
  text-align: center;
  color: #475569;
  font-size: 12px;
  font-style: italic;
}

/* Task Cards */
.task-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-left: 4px solid var(--priority-color, #3b82f6);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border-color: #475569;
}

.task-card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}

.task-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 8px;
  line-height: 1.4;
  word-break: break-word;
}

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.badge-client {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.badge-owner {
  background: rgba(168, 85, 247, 0.15);
  color: #c4b5fd;
}

.badge-executor {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.badge-due {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
}

.badge-overdue {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  animation: pulse-overdue 2s infinite;
}

@keyframes pulse-overdue {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.badge-type {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  text-transform: capitalize;
}

/* Confidence dot */
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot-high { background: #22c55e; }
.dot-medium { background: #f59e0b; }
.dot-low { background: #6b7280; }

/* Autonomy badge */
.badge-auto {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.badge-agent {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
}

.badge-human {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 24px;
  overflow-y: auto;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-create {
  max-width: 560px;
}

.modal-detail {
  max-width: 720px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #334155;
}

/* Form */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group-full {
  flex: 1 1 100%;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.required {
  color: #ef4444;
}

.form-group .text-input,
.form-group .select-input {
  width: 100%;
}

/* Detail Modal Specific */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-field-full {
  grid-column: 1 / -1;
}

.detail-field-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-field-value {
  font-size: 14px;
  color: #e2e8f0;
  word-break: break-word;
}

.detail-field-value a {
  color: #60a5fa;
  text-decoration: none;
}

.detail-field-value a:hover {
  text-decoration: underline;
}

/* Activity Log */
.activity-section {
  margin-top: 20px;
  border-top: 1px solid #334155;
  padding-top: 16px;
}

.activity-title {
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.activity-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  color: #94a3b8;
  padding: 6px 8px;
  background: #0f172a;
  border-radius: 6px;
}

.activity-time {
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-actor {
  color: #818cf8;
  font-weight: 600;
  flex-shrink: 0;
}

.activity-action {
  color: #cbd5e1;
}

/* Loading & empty states */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
  color: #64748b;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .filter-select {
    min-width: 120px;
  }

  .board-area {
    padding: 12px;
    gap: 12px;
  }

  .column {
    flex: 0 0 260px;
    min-width: 260px;
  }

  .form-row {
    flex-direction: column;
    gap: 14px;
  }

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

/* Dispatch Progress Bar */
.dispatch-progress {
  margin: 6px 0 4px;
}

.dispatch-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.dispatch-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.dispatch-progress-fill.pulse {
  animation: progressPulse 2s ease-in-out infinite;
  background: linear-gradient(90deg, #6366f1, #a78bfa, #6366f1);
  background-size: 200% 100%;
}

@keyframes progressPulse {
  0% { background-position: 0% 50%; opacity: 0.8; }
  50% { background-position: 100% 50%; opacity: 1; }
  100% { background-position: 0% 50%; opacity: 0.8; }
}

.dispatch-progress-label {
  font-size: 10px;
  color: #a78bfa;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.dispatch-progress-label.dispatch-done {
  color: #4ade80;
}

.dispatch-progress-label.dispatch-fail {
  color: #f87171;
}

/* Send Back button */
.btn-sendback {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-sendback:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

/* Send to Slack button */
.btn-slack {
  background: rgba(74, 21, 75, 0.3);
  color: #e9a0ff;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.btn-slack:hover {
  background: rgba(168, 85, 247, 0.3);
  color: #fff;
}

/* Feedback textarea in detail modal */
.feedback-input {
  width: 100%;
  min-height: 60px;
  margin-top: 8px;
  background: #0f172a;
  border: 1px solid #ef4444;
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.feedback-input::placeholder {
  color: #64748b;
}
