/**
 * TaskBuilder - Calendar / Gantt view shell (wppm_get_tasks_timeline_view.php + wppm_tv_* in admin.js).
 * The shell reuses the Kanban look (.wppm-kb-shell header, toolbar, view toggle); everything here is
 * scoped to .wppm-tv-shell. Status colors come inline from Settings > Task Statuses (--tv-status).
 * The Gantt chart's own styles ship with the Gantt Chart add-on (wppm-gantt-view.css).
 */

/* ---------- Toolbar ---------- */
.wppm-tv-shell .wppm-tv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 14px;
}
.wppm-tv-shell .wppm-tv-toolbar .wppm-kb-toolbar-filters {
  align-items: center;
}
.wppm-tv-shell .wppm-tv-project-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: none;
  margin: 0;
}
.wppm-tv-shell .wppm-tv-project-filter label {
  margin: 0;
  color: var(--wppm-kb-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.wppm-tv-shell .wppm-tv-project-filter select {
  width: auto !important;
  min-width: 170px;
  max-width: 260px;
  height: 36px;
  min-height: 36px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--wppm-kb-border);
  border-radius: 8px;
  background-color: #fff;
  color: var(--wppm-kb-ink);
  font-size: 13px;
}
.wppm-tv-shell .wppm-tv-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.wppm-tv-shell .wppm-tv-controls:empty {
  display: none;
}
.wppm-tv-shell .wppm-tv-search {
  position: relative;
  display: flex;
  align-items: center;
}
.wppm-tv-shell .wppm-tv-search .dashicons {
  position: absolute;
  left: 11px;
  color: var(--wppm-kb-muted);
  pointer-events: none;
}
.wppm-tv-shell .wppm-tv-search input[type="search"] {
  width: 220px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 12px 0 34px;
  border: 1px solid var(--wppm-kb-border);
  border-radius: 8px;
  background: #fff;
  color: var(--wppm-kb-ink);
  font-size: 13px;
  box-shadow: none;
}
.wppm-tv-shell .wppm-tv-search input[type="search"]:focus {
  outline: none;
  border-color: var(--wppm-kb-primary);
  box-shadow: 0 0 0 3px var(--wppm-kb-primary-light);
}

/* Buttons + zoom segment */
.wppm-tv-shell .wppm-tv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--wppm-kb-border);
  border-radius: 8px;
  background: #fff;
  color: var(--wppm-kb-ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  text-transform: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.wppm-tv-shell .wppm-tv-btn:hover {
  border-color: #cbd5e1;
  background: #fff;
  color: var(--wppm-kb-ink);
}
.wppm-tv-shell .wppm-tv-btn.is-icon {
  width: 36px;
  padding: 0;
}
.wppm-tv-shell .wppm-tv-btn:focus-visible,
.wppm-tv-shell .wppm-tv-seg-btn:focus-visible {
  outline: 2px solid var(--wppm-kb-primary);
  outline-offset: 1px;
}
.wppm-tv-shell .wppm-tv-seg {
  display: inline-flex;
  gap: 2px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--wppm-kb-border);
  border-radius: 9px;
  background: var(--wppm-kb-bg);
}
.wppm-tv-shell .wppm-tv-seg-btn {
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--wppm-kb-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  text-transform: none;
  cursor: pointer;
}
.wppm-tv-shell .wppm-tv-seg-btn:hover {
  background: transparent;
  color: var(--wppm-kb-ink);
}
.wppm-tv-shell .wppm-tv-seg-btn.active {
  background: #fff;
  color: var(--wppm-kb-primary-dark);
  box-shadow: 0 1px 2px rgba(16,24,40,.08);
}
.wppm-tv-shell .wppm-tv-month-title {
  min-width: 140px;
  color: var(--wppm-kb-ink);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

/* ---------- View area ---------- */
.wppm-tv-shell .wppm-tv {
  position: relative;
  margin-top: 16px;
}
.wppm-tv-shell .wppm-tv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 16px;
  border: 1px dashed var(--wppm-kb-border);
  border-radius: var(--wppm-kb-radius-sm);
  background: #fff;
  color: var(--wppm-kb-muted);
  font-size: 13.5px;
}
.wppm-tv-shell .wppm-tv-empty .dashicons {
  width: 28px;
  height: 28px;
  font-size: 28px;
  color: #cbd5e1;
}
.wppm-tv-shell .wppm-tv-notice {
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12.5px;
}
.wppm-tv-shell .wppm-tv-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tv-status, #94a3b8);
}
.wppm-tv-shell .wppm-tv-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--wppm-kb-col-bg);
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- Calendar ---------- */
.wppm-tv-shell .wppm-tv-calendar {
  overflow: hidden;
  border: 1px solid var(--wppm-kb-border);
  border-radius: var(--wppm-kb-radius-sm);
  background: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.wppm-tv-shell .wppm-tv-c-head,
.wppm-tv-shell .wppm-tv-c-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.wppm-tv-shell .wppm-tv-c-wd {
  padding: 9px 10px;
  border-bottom: 1px solid var(--wppm-kb-border);
  background: var(--wppm-kb-bg);
  color: var(--wppm-kb-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.wppm-tv-shell .wppm-tv-c-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 116px;
  padding: 6px;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color .1s ease;
}
.wppm-tv-shell .wppm-tv-c-cell:nth-child(7n) {
  border-right: 0;
}
.wppm-tv-shell .wppm-tv-c-cell.is-out {
  background: #fafbfc;
}
.wppm-tv-shell .wppm-tv-c-cell.is-out .wppm-tv-c-date {
  color: #cbd5e1;
}
.wppm-tv-shell .wppm-tv-c-cell.is-drop {
  background: var(--wppm-kb-primary-light);
  box-shadow: inset 0 0 0 2px #c7d2fe;
}
.wppm-tv-shell .wppm-tv-c-date {
  display: flex;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}
.wppm-tv-shell .wppm-tv-c-date span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
}
.wppm-tv-shell .wppm-tv-c-cell.is-today .wppm-tv-c-date span {
  background: var(--wppm-kb-primary);
  color: #fff;
}

/* Chips (calendar + "No dates") */
.wppm-tv-shell .wppm-tv-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  height: 26px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid #e8ecf2;
  border-radius: 7px;
  background: #fff;
  box-shadow: inset 3px 0 0 var(--tv-status, #cbd5e1);
  color: var(--wppm-kb-ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  text-transform: none;
  cursor: pointer;
}
.wppm-tv-shell .wppm-tv-chip:hover {
  border-color: #c7d2fe;
  background: #fff;
  color: var(--wppm-kb-ink);
}
.wppm-tv-shell .wppm-tv-chip:focus-visible {
  outline: 2px solid var(--wppm-kb-primary);
  outline-offset: 1px;
}
.wppm-tv-shell .wppm-tv-chip.is-editable {
  cursor: grab;
}
.wppm-tv-shell .wppm-tv-chip.is-dragging {
  opacity: .5;
}
.wppm-tv-shell .wppm-tv-chip.is-done .wppm-tv-chip-name {
  color: var(--wppm-kb-muted);
  text-decoration: line-through;
}
.wppm-tv-shell .wppm-tv-chip-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.wppm-tv-shell .wppm-tv-more {
  align-self: flex-start;
  min-height: 0;
  margin: 0;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--wppm-kb-primary);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: none;
  cursor: pointer;
}
.wppm-tv-shell .wppm-tv-more:hover {
  background: var(--wppm-kb-primary-light);
  color: var(--wppm-kb-primary-dark);
}

/* "No dates" panel */
.wppm-tv-shell .wppm-tv-unscheduled {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--wppm-kb-border);
  border-radius: var(--wppm-kb-radius-sm);
  background: #fff;
}
.wppm-tv-shell .wppm-tv-unscheduled-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 10px;
}
.wppm-tv-shell .wppm-tv-unscheduled-title {
  color: var(--wppm-kb-ink);
  font-size: 13px;
  font-weight: 700;
}
.wppm-tv-shell .wppm-tv-unscheduled-hint {
  flex-basis: 100%;
  color: var(--wppm-kb-muted);
  font-size: 12px;
}
.wppm-tv-shell .wppm-tv-unscheduled-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wppm-tv-shell .wppm-tv-unscheduled .wppm-tv-chip {
  max-width: 260px;
}

/* Save feedback */
.wppm-tv-shell .wppm-tv-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100000;
  padding: 10px 14px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(15,23,42,.5);
}
.wppm-tv-shell .wppm-tv-toast.is-error {
  background: #b91c1c;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 782px) {
  .wppm-tv-shell .wppm-tv-search,
  .wppm-tv-shell .wppm-tv-search input[type="search"] {
    width: 100%;
  }
  .wppm-tv-shell .wppm-tv-c-cell {
    min-height: 84px;
    padding: 4px;
  }
  .wppm-tv-shell .wppm-tv-chip.is-cal {
    padding: 0 5px;
    font-size: 11px;
  }
  .wppm-tv-shell .wppm-tv-chip.is-cal .wppm-tv-dot {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wppm-tv-shell .wppm-tv-c-cell {
    transition: none;
  }
}

/* ---------- Locked Pro views (Gantt / Calendar add-on not active; site admins in wp-admin only) ---------- */
.wppm-op-tab.wppm-view-locked,
.wppm-tl-view-btn.wppm-view-locked,
.wppm-kb-view-btn.wppm-view-locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9ca3af !important;
  text-decoration: none !important;
  cursor: pointer;
}
.wppm-op-tab.wppm-view-locked:hover,
.wppm-tl-view-btn.wppm-view-locked:hover,
.wppm-kb-view-btn.wppm-view-locked:hover {
  color: #6b7280 !important;
  background: transparent;
}
.wppm-op-tab.wppm-view-locked:focus-visible,
.wppm-tl-view-btn.wppm-view-locked:focus-visible,
.wppm-kb-view-btn.wppm-view-locked:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 1px;
  box-shadow: none;
}
.wppm-view-locked .wppm-view-pro-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: -1px;
  border-radius: 999px;
  background: #fef3c7;
}
.wppm-view-locked .wppm-view-pro-badge svg {
  display: block;
}
