@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes trayOpen {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 250px;
    opacity: 1;
  }
}

@keyframes trayClose {
  from {
    max-height: 250px;
    opacity: 1;
  }
  to {
    max-height: 0;
    opacity: 0;
  }
}

.tasks-page {
  padding: 1rem;
  height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  background: #f9fafc;
  width: 100%;
  overflow: hidden;
}

.tasks-header h1 {
  font-size: 2rem;
  color: #2d3748;
  font-weight: 600;
  margin-bottom: 20px;
}

.tasks-group {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* TASK ROW STYLING */
.task-row {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  animation: slideIn 0.3s ease both;
  margin-bottom: 0.2rem;
  overflow: visible; /* ensures confirm dialog isn't clipped */
  transition: all 0.2s ease-in-out;
}

.task-row.starred {
  border: 2px solid #f6e05e;
  background-color: #fffcf0;
  box-shadow: 0 2px 8px rgba(246, 224, 94, 0.15);
}

.task-row.deleting {
  animation: fadeOut 0.3s ease forwards;
}

.task-row.task-edited {
  animation: fadeIn 0.5s ease-out;
}

/* The main row content (left, center, right) */
.task-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Left side: check circle + task title (bold) */
.task-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-title {
  font-weight: 700;
  font-size: 1rem;
  color: #2d3748;
}

/* Center: due date (gray) */
.task-center {
  flex: 1;
  text-align: center;
  color: #a0aec0;
  font-size: 0.95rem;
}

/* Right side: caret + star + edit + delete */
.task-right {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.caret-button {
  background: none;
  border: none;
  cursor: pointer;
  color: #718096;
  transition: transform 0.2s ease;
  margin-top: 5px;
  padding: 0;
}

.caret-button svg {
  font-size: 1.3rem;
}

.caret-button:hover {
  transform: scale(1.2);
}

/* The extra details shown on expand (description) */
.task-extra {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid #e2e8f0;
  animation: fadeIn 0.3s ease;
}

.task-extra p {
  margin: 0;
  font-size: 0.95rem;
  color: #4a5568;
}

/* The check circle button */
.check-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.check-icon {
  font-size: 1.4rem;
  color: #cbd5e0;
  transition: all 0.2s ease;
}

.check-button:hover .check-icon {
  color: #4299e1;
  transform: scale(1.1);
}

/* Icons on the right */
.star-icon,
.edit-icon,
.delete-icon {
  font-size: 1.3rem;
  padding: 6px;
  cursor: pointer;
  color: #718096;
  transition: all 0.2s ease;
  width: 28px;
  height: 28px;
}

.star-icon:hover {
  transform: scale(1.2);
  color: #f6ad55;
}

.star-icon.active {
  color: #f6ad55;
  fill: #f6ad55;
}

.edit-icon:hover {
  color: #4299e1;
  transform: scale(1.1);
}

.delete-icon:hover {
  color: #f56565;
  transform: scale(1.1);
}

/* CONFIRM DELETE DIALOG */
.confirm-dialog {
  position: relative;
  left: 0%;
  transform: translateY(10%);
  background: white;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 1rem;
  align-items: center;
  border: 1px solid #e2e8f0;
  height: 60px;
  width: 260px;
  z-index: 1000;
  transition: all 0.2s ease-in-out;
  justify-self: end;
}

.confirm-buttons {
  display: flex;
  gap: 0.5rem;
}

.confirm-yes,
.confirm-no {
  padding: 0.4rem 0.6rem;
  border: 2px solid;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
}

.confirm-yes {
  background: #48bb78;
  color: white;
}

.confirm-no {
  background: #f56565;
  color: white;
}

.confirm-yes:hover {
  border-color: #48bb78;
  background: white;
  color: #48bb78;
}

.confirm-no:hover {
  border-color: #f56565;
  background: white;
  color: #f56565;
}

/* COMPLETED TASKS SECTION */
.completed-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  margin-top: auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.completed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.8rem 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  transition: background 0.2s ease;
  margin-bottom: 0.5rem;
}

.completed-header:hover {
  background: #f1f3f5;
}

.completed-list {
  max-height: 250px;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: trayOpen 0.3s ease-in-out;
}

.completed-list.closed {
  max-height: 0;
  animation: trayClose 0.3s ease-in-out;
}

.completed-task {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #48bb78;
}

.completed-icon {
  color: #48bb78;
  cursor: pointer;
  font-size: 1.4rem;
  transition: transform 0.2s ease;
}

.completed-icon:hover {
  transform: scale(1.1);
}

/* ADD TASK BAR */
.add-task-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-top: 1rem;
  z-index: 1;
  margin-bottom: -1rem;
}

.add-task-container input {
  flex: 1;
  padding: 0.8rem 1.2rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  background: #f8f9fa;
  transition: all 0.2s ease-in-out;
}

.add-task-container input:focus {
  border-color: #4299e1;
  outline: none;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.1);
}

.add-button {
  background: #0052d4;
  color: white;
  border: none;
  padding: 0.8rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.add-button:hover {
  background: #0041ac;
  transform: scale(1.1);
}

.add-button svg {
  height: 20px;
  width: 20px;
}

/* EDIT FORM (when user clicks edit icon) */
.task-edit-form {
  padding: 1rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.task-edit-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-field label {
  font-size: 0.9rem;
  color: #4a5568;
  font-weight: 600;
}

.task-edit-input,
.task-edit-due,
.task-edit-description {
  padding: 0.8rem;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
  color: #2d3748;
}

.task-edit-description {
  min-height: 80px;
  resize: vertical;
}

.edit-form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* We use a different color for Save and Cancel to differentiate from the add-button. */
.save-button,
.cancel-button {
  background: #4dabf7;
  color: white;
  border: none;
  padding: 0.8rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.save-button:hover,
.cancel-button:hover {
  background: #0041ac;
  transform: scale(1.1);
}

.save-button svg,
.cancel-button svg {
  height: 20px;
  width: 20px;
}

/* Center: due date (gray) with a label */
.task-center {
  flex: 1;
  text-align: center;
  color: #a0aec0;
  font-size: 0.95rem;
}
.due-label {
  font-weight: 500;
  margin-right: 4px;
}

/* Expanded details (task extra) */
.task-extra {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid #e2e8f0;
  animation: fadeIn 0.3s ease;
}
.task-extra p {
  margin: 0;
  font-size: 0.95rem;
  color: #4a5568;
}
.task-extra-dates {
  margin-top: 0.5rem;
}
.task-extra-dates p {
  margin: 0.2rem 0;
  font-size: 0.9rem;
  color: #718096;
}
