/* =============================================================================
   MakeHaven Tasks — action panel & card styles
   ============================================================================= */

/* ---- Full-node action panel (task-action-panel) ---- */

.task-action-panel {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Status context badges */
.tap-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tap-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.tap-badge--inprogress {
  background: #cfe2ff;
  color: #084298;
  border: 1px solid #9ec5fe;
}

.tap-badge--incomplete {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffda6a;
}

.tap-badge--badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.tap-badge--staff {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Primary action buttons row */
.tap-primary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.tap-btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.tap-btn:hover {
  transform: translateY(-1px);
}

/* "Claim task" / "Pick this up" — blue */
.tap-btn--claim {
  background: #0d6efd;
  color: #fff !important;
}

.tap-btn--claim:hover {
  background: #0b5ed7;
  color: #fff !important;
}

/* "You've claimed this" — muted state (not a link) */
.tap-btn--claimed {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  background: #e9ecef;
  color: #495057;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: default;
}

/* Flag module "Mark as Done" — style as a prominent green button */
.node--type-task .flag-task-completed,
.flag-task-completed {
  display: inline-flex;
}

.node--type-task .flag-task-completed a,
.node--type-task .flag-task-completed .flag-action {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  background: #198754;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none !important;
  transition: background 0.15s, transform 0.1s;
  border: none;
  cursor: pointer;
}

.node--type-task .flag-task-completed a:hover,
.node--type-task .flag-task-completed .flag-action:hover {
  background: #157347;
  color: #fff !important;
  transform: translateY(-1px);
}

/* The flag field wrapper — remove default margin/padding so it sits inline */
.node--type-task .field--name-flag-task-completed {
  display: inline-flex;
  margin: 0;
}

/* Secondary actions row */
.tap-secondary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #dee2e6;
}

.tap-link {
  font-size: 0.9rem;
  color: #6c757d;
  text-decoration: none;
  border-bottom: 1px dashed #adb5bd;
  padding-bottom: 1px;
}

.tap-link:hover {
  color: #343a40;
  border-bottom-style: solid;
}

.tap-link--danger {
  color: #dc3545;
  border-bottom-color: #f5a0a7;
}

.tap-link--danger:hover {
  color: #b02a37;
}

/* ---- Staff action bar (top of /tasks, manager-only) ---- */

.task-staff-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.task-staff-btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 5px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none !important;
  background: #f8f9fa;
  color: #343a40 !important;
  border: 1px solid #ced4da;
  transition: background 0.15s;
}

.task-staff-btn:hover {
  background: #e9ecef;
}

.task-staff-btn--primary {
  background: #0d6efd;
  color: #fff !important;
  border-color: #0d6efd;
}

.task-staff-btn--primary:hover {
  background: #0b5ed7;
  border-color: #0b5ed7;
}

/* ---- How-it-works banner (tasks list page) ---- */

.task-how-it-works {
  background: #f0f7ff;
  border: 1px solid #c8dff5;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.task-how-it-works p {
  margin: 0 0 0.75rem;
}

.task-how-steps {
  margin: 0.5rem 0 0.75rem 1.25rem;
  padding: 0;
}

.task-how-steps li {
  margin-bottom: 0.3rem;
}

.task-how-links {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #555;
}

.task-how-links a {
  color: #0d6efd;
  text-decoration: none;
}

.task-how-links a:hover {
  text-decoration: underline;
}

/* ---- Card meta badges (task list view) ---- */

.task-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.task-card-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.task-card-inprogress {
  background: #cfe2ff;
  color: #084298;
  border: 1px solid #9ec5fe;
}

.task-card-incomplete {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffda6a;
}

.task-card-time {
  background: #e9ecef;
  color: #495057;
  border: 1px solid #ced4da;
}

.task-card-category {
  background: #d1e7dd;
  color: #0a3622;
  border: 1px solid #a3cfbb;
}

/* ---- Card action buttons (in list view) ---- */

.task-card-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.task-action-btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: #0d6efd;
  color: #fff !important;
  border-radius: 5px;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: background 0.15s;
}

.task-action-btn:hover {
  background: #0b5ed7;
  color: #fff !important;
}

.task-card-details-link {
  font-size: 0.875rem;
  color: #6c757d;
  text-decoration: none;
}

.task-card-details-link:hover {
  color: #0d6efd;
  text-decoration: underline;
}

/* =============================================================================
   Leaderboard page (/tasks/leaderboard)
   ============================================================================= */

.task-leaderboard-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.task-lb-intro {
  background: #f0f7ff;
  border: 1px solid #c8dff5;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
  font-size: 0.95rem;
  color: #333;
}

.task-lb-intro p {
  margin: 0;
}

/* ── Two-column layout (all-time + this month) ── */

.task-lb-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 640px) {
  .task-lb-columns {
    grid-template-columns: 1fr;
  }
}

.task-lb-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #dee2e6;
}

.task-lb-chart-section {
  margin-bottom: 2.5rem;
}

/* ── Ranked list ── */

.task-lb-table {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.task-lb-row {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  transition: box-shadow 0.15s;
}

.task-lb-row:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.task-lb-row--top3 {
  border-color: #c8dff5;
  background: #f8fbff;
}

.task-lb-row-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.task-lb-medal {
  font-size: 1.2rem;
  line-height: 1;
}

.task-lb-rank {
  display: inline-block;
  min-width: 2rem;
  font-weight: 700;
  color: #6c757d;
  font-size: 0.85rem;
}

.task-lb-name {
  font-weight: 600;
  color: #212529;
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-lb-name:hover {
  color: #0d6efd;
  text-decoration: underline;
}

.task-lb-count {
  font-weight: 700;
  color: #0d6efd;
  font-size: 1rem;
  white-space: nowrap;
}

.task-lb-milestone {
  font-size: 0.75rem;
  font-weight: 600;
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffda6a;
  border-radius: 12px;
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
}

/* Progress bar inside each row */
.task-lb-bar-wrap {
  height: 5px;
  background: #e9ecef;
  border-radius: 3px;
  overflow: hidden;
}

.task-lb-bar {
  height: 100%;
  background: linear-gradient(90deg, #0d6efd, #6ea8fe);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.task-lb-empty {
  color: #6c757d;
  font-style: italic;
  font-size: 0.9rem;
}

/* ── Horizontal bar chart (monthly trend + category) ── */

.task-lb-hbar-chart {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.task-lb-hbar-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  align-items: center;
  gap: 0.75rem;
}

@media (max-width: 480px) {
  .task-lb-hbar-row {
    grid-template-columns: 6rem 1fr;
  }
}

.task-lb-hbar-label {
  font-size: 0.85rem;
  color: #495057;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-lb-hbar-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f0f3f5;
  border-radius: 4px;
  padding: 0 0.4rem;
  min-height: 28px;
}

.task-lb-hbar {
  height: 18px;
  background: linear-gradient(90deg, #198754, #5cb85c);
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.4s ease;
}

.task-lb-hbar-val {
  font-size: 0.8rem;
  font-weight: 600;
  color: #495057;
  white-space: nowrap;
}

/* =============================================================================
   User profile task stats (hook_user_view)
   ============================================================================= */

.task-profile-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.task-profile-count {
  color: #212529;
}

.task-profile-count strong {
  font-size: 1.1rem;
  color: #0d6efd;
}

.task-profile-milestone {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffda6a;
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.task-profile-links {
  margin-left: auto;
  font-size: 0.85rem;
  color: #6c757d;
}

.task-profile-links a {
  color: #0d6efd;
  text-decoration: none;
}

.task-profile-links a:hover {
  text-decoration: underline;
}
