/**
 * TaskBuilder - project "Tasks" popup (Overview > Tasks), SaaS theme
 * Table/controls are scoped to .wppm-pt (the #wppm_get_project_tasks_frm form).
 * The shared popup frame is only restyled while it contains that form
 * (:has(.wppm-pt)), so every other dialog keeps its current look.
 * Colors from Settings > Appearance (task list header/rows, modal header/body/footer)
 * are applied inline and are never overridden here.
 */

/* ===================== Popup frame (only for this popup) ===================== */
#wppm_popup:has(.wppm-pt) {
  left: 0;
  right: 0;
  width: min(1100px, calc(100% - 32px)) !important;
  max-width: none;
  height: auto !important;
  margin: 0 auto !important;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 64px -12px rgba(15,23,42,.35), 0 2px 8px rgba(15,23,42,.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
#wppm_popup:has(.wppm-pt) #wppm_popup_title {
  margin: 0;
  padding: 18px 24px !important;
  border-bottom: 1px solid #e5e7eb;
}
#wppm_popup:has(.wppm-pt) #wppm_popup_title h3 {
  font: 700 17px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.01em;
}
#wppm_popup:has(.wppm-pt) #wppm_popup_body {
  margin: 0;
  max-height: calc(100vh - 200px);
  padding: 16px 24px 12px !important;
}
#wppm_popup:has(.wppm-pt) #wppm_popup_footer {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 14px 24px !important;
  border-top: 1px solid #e5e7eb;
}
#wppm_popup:has(.wppm-pt) #wppm_popup_footer > .col-md-3 {
  width: auto;
  padding: 0;
  float: none;
}
#wppm_popup:has(.wppm-pt) #wppm_popup_footer button {
  width: auto;
  min-width: 96px;
  height: 38px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid #e5e7eb;
  border-radius: 9px !important;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===================== Summary line ===================== */
.wppm-pt {
  --pt-primary: #4f46e5;
  --pt-primary-light: #eef2ff;
  --pt-ink: #111827;
  --pt-muted: #6b7280;
  --pt-border: #e5e7eb;
  --pt-soft: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13.5px;
}
.wppm-pt .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  line-height: 1;
}
.wppm-pt-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.wppm-pt-summary-total {
  margin-right: 4px;
  color: var(--pt-muted);
  font-size: 13px;
}
.wppm-pt-summary-total strong {
  color: var(--pt-ink);
  font-size: 15px;
}
.wppm-pt-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}
.wppm-pt-chip.done {
  background: #dcfce7;
  color: #15803d;
}
.wppm-pt-chip.overdue {
  background: #fee2e2;
  color: #dc2626;
}

/* ===================== DataTables controls ===================== */
.wppm-pt .dataTables_wrapper .dataTables_length,
.wppm-pt .dataTables_wrapper .dataTables_filter {
  margin-bottom: 12px;
  color: var(--pt-muted);
  font-size: 12.5px;
}
.wppm-pt .dataTables_wrapper .dataTables_length select,
.wppm-pt .dataTables_wrapper .dataTables_filter input {
  height: 34px;
  margin: 0 6px;
  padding: 0 10px;
  border: 1px solid var(--pt-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  font-size: 13px;
}
.wppm-pt .dataTables_wrapper .dataTables_length select {
  padding-right: 26px;
}
.wppm-pt .dataTables_wrapper .dataTables_filter input {
  width: 220px;
  margin-right: 0;
}
.wppm-pt .dataTables_wrapper .dataTables_length select:focus,
.wppm-pt .dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  border-color: var(--pt-primary);
  box-shadow: 0 0 0 3px var(--pt-primary-light);
}
.wppm-pt .dataTables_wrapper .dataTables_info {
  padding-top: 14px;
  color: var(--pt-muted);
  font-size: 12.5px;
}
.wppm-pt .dataTables_wrapper .dataTables_paginate {
  padding-top: 10px;
}
.wppm-pt .dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 32px;
  height: 32px;
  margin-left: 4px;
  padding: 0 10px !important;
  border: 1px solid var(--pt-border) !important;
  border-radius: 8px;
  background: #fff !important;
  color: var(--pt-ink) !important;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 30px !important;
}
.wppm-pt .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  border-color: var(--pt-primary) !important;
  background: var(--pt-primary-light) !important;
  color: var(--pt-primary) !important;
}
.wppm-pt .dataTables_wrapper .dataTables_paginate .paginate_button.current,
.wppm-pt .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  border-color: var(--pt-primary) !important;
  background: var(--pt-primary) !important;
  color: #fff !important;
}
.wppm-pt .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.wppm-pt .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  border-color: var(--pt-border) !important;
  background: #fff !important;
  color: #cbd5e1 !important;
  cursor: default;
}

/* ===================== Table ===================== */
.wppm-pt .table-responsive {
  border: none;
}
.wppm-pt #tbl_project_tasks {
  margin: 0 !important;
  border: 1px solid var(--pt-border) !important;
  border-collapse: separate !important;
  border-spacing: 0;
  border-radius: 10px;
  overflow: hidden;
}
.wppm-pt #tbl_project_tasks th {
  padding: 10px 12px !important;
  border: none !important;
  border-bottom: 1px solid var(--pt-border) !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.wppm-pt #tbl_project_tasks td {
  padding: 10px 12px !important;
  border: none !important;
  border-bottom: 1px solid var(--pt-border) !important;
  font-size: 13px;
  line-height: 1.4;
  vertical-align: middle;
}
.wppm-pt #tbl_project_tasks tbody tr:last-child td {
  border-bottom: none !important;
}
.wppm-pt #tbl_project_tasks tbody tr {
  cursor: pointer;
}
.wppm-pt #tbl_project_tasks tbody tr td:first-child {
  box-shadow: inset 3px 0 0 transparent;
  transition: box-shadow .12s ease;
}
.wppm-pt #tbl_project_tasks tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--pt-primary);
}
/* DataTables' own sort-arrow images sit over the uppercase labels; give them room. */
.wppm-pt #tbl_project_tasks thead .sorting,
.wppm-pt #tbl_project_tasks thead .sorting_asc,
.wppm-pt #tbl_project_tasks thead .sorting_desc {
  padding-right: 26px !important;
}
.wppm-pt-id {
  color: var(--pt-muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.wppm-pt-name {
  font-weight: 600;
}
.wppm-pt .wppm_subtask_badge {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font: 600 10.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wppm-pt .wppm_td_task_status,
.wppm-pt .wppm_td_task_priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.wppm-pt .wppm_td_task_priority .dashicons {
  font-size: 12px;
  width: 12px;
  height: 12px;
}
.wppm-pt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.wppm-pt-dash {
  color: #cbd5e1;
  font-weight: 700;
}
.wppm-pt-muted {
  color: var(--pt-muted);
  font-size: 12.5px;
}
.wppm-pt-avatars {
  display: flex;
  align-items: center;
}
.wppm-pt-avatars > a {
  display: inline-flex;
  margin-left: -7px;
}
.wppm-pt-avatars > a:first-child {
  margin-left: 0;
}
.wppm-pt-avatars .avatar {
  width: 26px !important;
  height: 26px !important;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--pt-border);
}
.wppm-pt-avatars #wppm_avatar.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background-color: #e5e7eb !important;
  color: #374151;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.wppm-pt-date {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.wppm-pt-date > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wppm-pt-date small {
  color: var(--pt-muted);
  font-size: 11px;
}
.wppm-pt-date.overdue {
  padding: 3px 9px;
  border-radius: 9px;
  background: #fee2e2;
  color: #dc2626;
  font-weight: 600;
}
.wppm-pt-date.overdue small {
  color: #ef4444;
  font-weight: 500;
}

@media (max-width: 767px) {
  #wppm_popup:has(.wppm-pt) {
    width: calc(100% - 20px) !important;
    border-radius: 12px;
  }
  #wppm_popup:has(.wppm-pt) #wppm_popup_body {
    padding: 14px 14px 10px !important;
  }
  .wppm-pt .dataTables_wrapper .dataTables_filter input {
    width: 100%;
    margin: 6px 0 0;
  }
}

/* The page's modal style sets "#wppm_popup_body span { color }" (from Appearance > Modal).
   Keep the meaning colors of these specific badges; all other text keeps that setting. */
#wppm_popup_body .wppm-pt .wppm-pt-chip.done,
#wppm_popup_body .wppm-pt .wppm-pt-chip.done span { color: #15803d; }
#wppm_popup_body .wppm-pt .wppm-pt-chip.overdue,
#wppm_popup_body .wppm-pt .wppm-pt-chip.overdue span,
#wppm_popup_body .wppm-pt .wppm-pt-date.overdue,
#wppm_popup_body .wppm-pt .wppm-pt-date.overdue > span { color: #dc2626; }
#wppm_popup_body .wppm-pt .wppm-pt-date.overdue small { color: #ef4444; }
#wppm_popup_body .wppm-pt .wppm-pt-id,
#wppm_popup_body .wppm-pt .wppm-pt-date small,
#wppm_popup_body .wppm-pt .wppm-pt-muted { color: #6b7280; }
#wppm_popup_body .wppm-pt .wppm-pt-dash { color: #cbd5e1; }
#wppm_popup_body .wppm-pt .wppm-pt-avatars #wppm_avatar.avatar { color: #374151; }

/* Left-align like the other redesigned lists (older rules centre these cells). */
.wppm-pt #tbl_project_tasks th,
.wppm-pt #tbl_project_tasks td {
  text-align: left !important;
}
.wppm-pt #tbl_project_tasks td:first-child,
.wppm-pt #tbl_project_tasks th:first-child {
  width: 70px;
}

/* ===================== Inline Tasks page (Overview > Tasks tab) =====================
   Same table as the popup, shown on the project page like the Kanban View
   (wppm_get_project_tasks_list_view.php). Only applies inside .wppm-pt-page, so the
   popup keeps its current look. Appearance colors stay inline / in the page <style>. */
.wppm-op-shell .wppm-pt-page {
  padding: 18px 20px 14px;
  border: 1px solid var(--op-border, #e5e7eb);
  border-radius: var(--op-radius, 14px);
  background: var(--op-surface, #fff);
  box-shadow: var(--op-shadow, 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.10));
}
.wppm-op-shell .wppm-pt-page .wppm-pt-summary {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--pt-border);
}
.wppm-op-shell .wppm-pt-page .wppm-pt-summary-total strong {
  font-size: 17px;
}
.wppm-op-shell .wppm-pt-page #tbl_project_tasks tbody tr {
  cursor: pointer;
}
/* DataTables puts length + search in two floated halves; line them up as a toolbar */
.wppm-op-shell .wppm-pt-page .dataTables_wrapper > .row:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
}
.wppm-op-shell .wppm-pt-page .dataTables_wrapper > .row:first-child > [class*="col-"] {
  width: auto;
  float: none;
  padding: 0;
}
@media (max-width: 767px) {
  .wppm-op-shell .wppm-pt-page {
    padding: 14px 12px 10px;
  }
}
