/* TaskPilot App Dashboard */

.app-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ---- Sidebar ---- */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem 1.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
}

.logo-icon { font-size: 1.3rem; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--fg); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-icon { font-size: 1rem; }

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.status-dot-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #888;
}

.status-dot.online {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.status-text {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* ---- Main content ---- */
.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: calc(100vw - 220px);
}

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

.app-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.25rem;
}

.app-subtitle {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* ---- Buttons ---- */
.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--fg); }

.btn-danger {
  background: rgba(255, 80, 80, 0.12);
  color: #ff6b6b;
  border: 1px solid rgba(255, 80, 80, 0.2);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.btn-danger:hover { background: rgba(255, 80, 80, 0.2); }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.82rem; }

/* ---- Task form card ---- */
.task-form-card {
  background: var(--bg-card);
  border: 1px solid rgba(0, 212, 170, 0.2);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 1.25rem;
}

.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.optional { font-weight: 400; color: #555; }

.form-input,
.form-textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  padding: 0.7rem 1rem;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.form-input::placeholder,
.form-textarea::placeholder { color: rgba(136,136,160,0.5); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ---- Task list ---- */
.tasks-container {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  overflow: hidden;
}

.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.tasks-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Empty state ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 2rem;
  gap: 0.75rem;
  text-align: center;
}

.empty-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.empty-state h3 { font-family: 'Space Grotesk', sans-serif; font-size: 1.2rem; color: var(--fg); }
.empty-state p { color: var(--fg-muted); font-size: 0.9rem; max-width: 340px; margin-bottom: 0.5rem; }

/* ---- Task cards ---- */
.task-list { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }

.task-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.task-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
}

.task-card.status-pending  { border-left-color: #8888a0; }
.task-card.status-running  { border-left-color: #fbbf24; }
.task-card.status-completed { border-left-color: var(--accent); }
.task-card.status-failed   { border-left-color: #f87171; }

.task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.task-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg);
  line-height: 1.4;
}

.task-card-desc {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* ---- Status badges ---- */
.status-badge, .modal-status-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.status-badge-pending, .badge-pending   { background: rgba(136,136,160,0.15); color: #8888a0; }
.status-badge-running, .badge-running   { background: rgba(251,191,36,0.15);  color: #fbbf24; }
.status-badge-completed, .badge-completed { background: rgba(0,212,170,0.15); color: var(--accent); }
.status-badge-failed, .badge-failed    { background: rgba(248,113,113,0.15); color: #f87171; }

.running-pulse {
  color: #fbbf24;
  animation: pulse 1.4s ease-in-out infinite;
}

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

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.4;
  margin-top: 0.35rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s;
}

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

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-desc {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* ---- Logs ---- */
.logs-section {}
.logs-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

.logs-container {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: 'DM Mono', 'Courier New', monospace;
}

.log-entry {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.log-time { color: var(--fg-muted); white-space: nowrap; flex-shrink: 0; }
.log-msg  { color: var(--fg); word-break: break-word; }
.log-empty { color: var(--fg-muted); font-style: italic; }

/* ---- Result ---- */
.result-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.6rem;
}

.result-content {
  background: rgba(0,212,170,0.04);
  border: 1px solid rgba(0,212,170,0.15);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.88rem;
  color: var(--fg);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-content.result-failed {
  background: rgba(248,113,113,0.04);
  border-color: rgba(248,113,113,0.2);
  color: #f87171;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

/* ---- Responsive ---- */
@media (max-width: 700px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 1.25rem; max-width: 100vw; }
  .app-header { flex-direction: column; gap: 1rem; }
}
