/* Extracted from index.html. Task list flow, arrange mode, toast, and task add/close controls. */

.task-list {
  display: flex;
  flex-direction: column;
  gap: 80px;
  padding-bottom: 28px;
}

/* 第一个任务栏位置不变，其余任务栏整体上移 29px（35 - 6） */
.task-list .task-shell:not(:first-child) {
  margin-top: -29px;
}

.arrange-mode .task-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  padding-top: 2px;
  touch-action: none;
}

.arrange-mode .task-list .task-shell:not(:first-child) {
  margin-top: 0;
}

.arrange-mode .task-shell {
  --arrange-tx: 0px;
  --arrange-ty: 0px;
  transform: translate(var(--arrange-tx), var(--arrange-ty)) scale(var(--arrange-scale, 0.72));
  transform-origin: top center;
  width: 100%;
  max-width: 1100px;
  cursor: grab;
  margin-bottom: -276px;
  transition: box-shadow 0.18s ease, transform 0.18s ease, margin 0.18s ease;
}

.arrange-mode .task-shell.drag-sorting {
  cursor: grabbing;
  opacity: 1;
  box-shadow: none;
  transition: none !important;
  transform: translate(var(--arrange-tx), var(--arrange-ty)) scale(var(--arrange-scale, 0.72)) !important;
}

@media (max-width: 1449px) {
  /* 窄屏排列：叠加一半高度（卡片 315px，步距约 157px，与宽屏同套拖拽逻辑） */
  .arrange-mode .task-shell {
    margin-bottom: -158px;
  }
}

.task-drag-preview {
  position: fixed;
  top: -9999px;
  left: -9999px;
  pointer-events: none;
  z-index: 2000;
  opacity: 0.88;
  filter: none;
}

.arrange-mode .task-shell .task-add-btn,
.arrange-mode .task-shell .task-close-btn {
  display: none !important;
}

.arrange-mode .task-shell .task-card {
  height: 500px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.1),
    0 12px 26px rgba(0, 0, 0, 0.2);
}

html.theme-dark .arrange-mode .task-shell .task-card {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 14px 30px rgba(0, 0, 0, 0.42);
}

.arrange-mode .task-shell .task-layout {
  min-width: 0;
  overflow: hidden;
}

.arrange-mode .task-shell .result-panel,
.arrange-mode .task-shell .result-stack,
.arrange-mode .task-shell .result-item {
  min-width: 0;
  max-width: 100%;
}

.arrange-mode .task-shell * {
  pointer-events: none;
  user-select: none;
}

.task-index-tag-bg,
.task-index-tag-text {
  position: absolute;
  top: 10px;
  left: 0;
  transform: translateX(-72%);
  width: 34px;
  height: 40px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: none;
}

.task-index-tag-bg {
  background: #F0EEE9;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  z-index: 1;
}

@keyframes task-complete-toast-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes task-complete-toast-wrap-enter {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
@keyframes task-complete-toast-wrap-leave {
  from { transform: translateX(-50%) translateY(0); opacity: 1; }
  to { transform: translateX(-50%) translateY(-20px); opacity: 0; }
}
@keyframes task-complete-toast-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes task-complete-toast-icon-pop {
  0% { transform: scale(0); opacity: 0; }
  55% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes task-complete-toast-icon-x {
  0% { transform: scale(0); opacity: 0; }
  55% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.task-complete-toast-wrap {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  padding: 20px;
  display: inline-block;
  z-index: 9998;
  pointer-events: none;
  visibility: hidden;
}
.task-complete-toast-wrap.visible {
  visibility: visible;
  pointer-events: auto;
  animation: task-complete-toast-wrap-enter 0.3s ease-out forwards;
}
.task-complete-toast-wrap.visible.leaving {
  animation: task-complete-toast-wrap-leave 0.3s ease-out forwards;
  pointer-events: none;
}
.task-complete-toast-wrap.visible.leaving .task-complete-toast {
  animation: task-complete-toast-fade-out 0.3s ease-out forwards;
}
.task-complete-toast {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  transform-origin: center center;
  transition: transform 0.2s ease;
  background: rgba(28, 28, 30, 0.96);
  border-radius: 9999px;
  padding: 8px 14px 8px 16px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.task-complete-toast-wrap.visible .task-complete-toast {
  animation: task-complete-toast-fade 0.3s ease-out forwards;
}
.task-complete-toast-wrap:hover .task-complete-toast {
  transform: scale(1.02);
}
.task-complete-toast .toast-index {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  line-height: 1;
}
.task-complete-toast .toast-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.task-complete-toast .toast-line1 {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}
.task-complete-toast .toast-line2 {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.3;
}
.task-complete-toast .toast-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-complete-toast .toast-icon svg {
  width: 100%;
  height: 100%;
}
.task-complete-toast .toast-icon.toast-icon-success {
  animation: task-complete-toast-icon-pop 0.4s ease-out forwards;
}
.task-complete-toast .toast-icon.toast-icon-success svg {
  color: #35c759;
}
.task-complete-toast .toast-icon.toast-icon-failure {
  animation: task-complete-toast-icon-x 0.4s ease-out forwards;
}
.task-complete-toast .toast-icon.toast-icon-failure svg {
  color: #ff5c60;
}
.task-complete-toast .toast-dismiss {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(58, 58, 60, 0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
  transform-origin: center;
  cursor: pointer;
  transition: opacity 140ms ease, transform 140ms cubic-bezier(0.23, 1, 0.32, 1);
}
.task-complete-toast .toast-dismiss svg {
  width: 13px;
  height: 13px;
}
.task-complete-toast .toast-dismiss:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  outline: 2px solid #ffd13f;
  outline-offset: 2px;
}
@media (hover: hover) and (pointer: fine) {
  .task-complete-toast:hover .toast-dismiss {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
  }
  .task-complete-toast .toast-dismiss:hover {
    transform: scale(1.06);
  }
  .task-complete-toast .toast-dismiss:active {
    transform: scale(0.96);
  }
}
html.theme-dark .task-complete-toast {
  background: rgba(240, 238, 233, 0.96);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
html.theme-dark .task-complete-toast .toast-index,
html.theme-dark .task-complete-toast .toast-line1 {
  color: #1d1d1f;
}
html.theme-dark .task-complete-toast .toast-line2 {
  color: rgba(29, 29, 31, 0.78);
}
html.theme-dark .task-complete-toast .toast-dismiss {
  border-color: rgba(29, 29, 31, 0.14);
  color: rgba(29, 29, 31, 0.9);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.task-index-tag-text {
  font-size: 13px;
  font-weight: 700;
  color: #1d1d1f;
  z-index: 3;
  letter-spacing: 0;
  text-align: center;
  transform: translateX(calc(-72% - 3px));
}

.task-add-btn {
  position: absolute;
  left: 50%;
  bottom: 0;
  /* 在任务卡底框（含 box-shadow 约 8px）之下留足间距，避免遮挡；与 gap 80px 配合上下各 25px */
  transform: translate(-50%, 40px);
  width: 44px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  background: rgba(0, 0, 0, 0.03);
  color: rgba(29, 29, 31, 0.45);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  cursor: pointer;
  opacity: 0.4;
  box-shadow: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    opacity 0.18s ease;
}

.task-add-btn:hover,
.task-add-btn:focus-visible {
  transform: translate(-50%, 40px) scale(1.05);
  background: #e7e7ec;
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(29, 29, 31, 0.72);
  opacity: 0.65;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  outline: none;
}

.task-add-btn:active {
  transform: translate(-50%, 40px) scale(1.08);
  background: #ececf1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
}

.task-add-btn:disabled,
.task-add-btn:disabled:hover,
.task-add-btn:disabled:focus-visible,
.task-add-btn:disabled:active {
  transform: translate(-50%, 40px);
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
  color: rgba(29, 29, 31, 0.28);
  opacity: 0.1;
  box-shadow: none;
  cursor: not-allowed;
}

.task-add-btn::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(20, 20, 22, 0.86);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.task-add-btn:hover::after,
.task-add-btn:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.task-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 999px;
  background: #ff5c60;
  color: #fff;
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  padding: 0;
  transform: scale(1);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

/* Modal close controls reuse the Super Banana task-card close language. */
.sb-task-card-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #ff5c60;
  color: transparent;
  font-size: 0;
  line-height: 0;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  transform: scale(1);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.sb-task-card-close:hover {
  background: #ff5c60;
  color: #802f31;
  transform: scale(1.2);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  filter: brightness(1.03);
}

.sb-task-card-close:active {
  transform: scale(1.14);
}

.sb-task-card-close:focus-visible {
  outline: 2px solid rgba(255, 92, 96, 0.42);
  outline-offset: 3px;
}

.task-close-btn::before,
.sb-task-card-close::before,
.tool-modal-close::before,
.my-prompts-close::before,
.generate-history-close::before,
.generate-case-close::before,
.client-dev-survey-modal-close::before,
.independent-task-restore-close::before,
.reverse-result-close::before,
.case-monthly-stats-close-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(45deg, transparent 43%, #802F31 43%, #802F31 57%, transparent 57%),
    linear-gradient(-45deg, transparent 43%, #802F31 43%, #802F31 57%, transparent 57%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0 0, 0 0;
  opacity: 0;
  transition: background-size 0.16s ease, opacity 0.16s ease;
  pointer-events: none;
}

.task-close-btn:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  filter: brightness(1.03);
}

.task-close-btn:hover::before,
.sb-task-card-close:hover::before,
.tool-modal-close:hover::before,
.my-prompts-close:hover::before,
.generate-history-close:hover::before,
.generate-case-close:hover::before,
.client-dev-survey-modal-close:hover::before,
.independent-task-restore-close:hover::before,
.reverse-result-close:hover::before,
.case-monthly-stats-close-btn:hover::before {
  background-size: 46% 46%, 46% 46%;
  opacity: 1;
}

.task-close-btn:active {
  transform: scale(1.14);
}

.task-close-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(20, 20, 22, 0.56);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.task-close-btn[data-tip=""]::after {
  display: none;
}

.task-close-btn:hover::after,
.task-close-btn:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}
